Merge pull request #7539 from hashicorp/import-aws-receiptruleset

provider/aws: Support Import of `aws_ses_receipt_rule_set`
This commit is contained in:
James Nugent 2016-07-08 11:00:17 +01:00 committed by GitHub
commit f5bb652bd6
2 changed files with 34 additions and 0 deletions

View File

@ -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,
},
},
})
}

View File

@ -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
}