provider/aws: Support Import of `aws_ses_receipt_filter`

```
% make testacc TEST=./builtin/providers/aws  TESTARGS='-run=TestAccAWSSESReceiptFilter_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSSESReceiptFilter_ -timeout 120m
=== RUN   TestAccAWSSESReceiptFilter_importBasic
--- PASS: TestAccAWSSESReceiptFilter_importBasic (18.18s)
=== RUN   TestAccAWSSESReceiptFilter_basic
--- PASS: TestAccAWSSESReceiptFilter_basic (18.42s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    36.633s
```
This commit is contained in:
stack72 2016-07-07 17:37:56 +01:00
parent 21e2173e0a
commit a74bd870e2
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,28 @@
package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSSESReceiptFilter_importBasic(t *testing.T) {
resourceName := "aws_ses_receipt_filter.test"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckSESReceiptFilterDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSSESReceiptFilterConfig,
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

View File

@ -14,6 +14,9 @@ func resourceAwsSesReceiptFilter() *schema.Resource {
Create: resourceAwsSesReceiptFilterCreate,
Read: resourceAwsSesReceiptFilterRead,
Delete: resourceAwsSesReceiptFilterDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
@ -77,6 +80,7 @@ func resourceAwsSesReceiptFilterRead(d *schema.ResourceData, meta interface{}) e
if *element.Name == d.Id() {
d.Set("cidr", element.IpFilter.Cidr)
d.Set("policy", element.IpFilter.Policy)
d.Set("name", element.Name)
found = true
}
}