diff --git a/builtin/providers/aws/import_aws_ses_receipt_rule_set_test.go b/builtin/providers/aws/import_aws_ses_receipt_rule_set_test.go new file mode 100644 index 000000000..c5294bcb4 --- /dev/null +++ b/builtin/providers/aws/import_aws_ses_receipt_rule_set_test.go @@ -0,0 +1,28 @@ +package aws + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSSESReceiptRuleSet_importBasic(t *testing.T) { + resourceName := "aws_ses_receipt_rule_set.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckSESReceiptRuleSetDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSSESReceiptRuleSetConfig, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/aws/resource_aws_ses_receipt_rule_set.go b/builtin/providers/aws/resource_aws_ses_receipt_rule_set.go index 547835b37..dfaf98cf8 100644 --- a/builtin/providers/aws/resource_aws_ses_receipt_rule_set.go +++ b/builtin/providers/aws/resource_aws_ses_receipt_rule_set.go @@ -14,6 +14,9 @@ func resourceAwsSesReceiptRuleSet() *schema.Resource { Create: resourceAwsSesReceiptRuleSetCreate, Read: resourceAwsSesReceiptRuleSetRead, Delete: resourceAwsSesReceiptRuleSetDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "rule_set_name": &schema.Schema{ @@ -50,12 +53,15 @@ func resourceAwsSesReceiptRuleSetRead(d *schema.ResourceData, meta interface{}) if !ruleSetExists { log.Printf("[WARN] SES Receipt Rule Set (%s) not found", d.Id()) d.SetId("") + return nil } if err != nil { return err } + d.Set("rule_set_name", d.Id()) + return nil }