Merge pull request #7296 from hashicorp/import-aws-cloudwatcher

provider/aws: Support Import for `aws_cloudwatch_event_rule`
This commit is contained in:
James Nugent 2016-06-24 14:44:17 +03:00 committed by GitHub
commit b1e933385b
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSCloudWatchEventRule_importBasic(t *testing.T) {
resourceName := "aws_cloudwatch_event_rule.foo"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSCloudWatchEventRuleConfig,
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"is_enabled"}, //this has a default value
},
},
})
}

View File

@ -20,6 +20,9 @@ func resourceAwsCloudWatchEventRule() *schema.Resource {
Read: resourceAwsCloudWatchEventRuleRead,
Update: resourceAwsCloudWatchEventRuleUpdate,
Delete: resourceAwsCloudWatchEventRuleDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{