Merge pull request #7296 from hashicorp/import-aws-cloudwatcher
provider/aws: Support Import for `aws_cloudwatch_event_rule`
This commit is contained in:
commit
b1e933385b
|
@ -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
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
|
@ -20,6 +20,9 @@ func resourceAwsCloudWatchEventRule() *schema.Resource {
|
||||||
Read: resourceAwsCloudWatchEventRuleRead,
|
Read: resourceAwsCloudWatchEventRuleRead,
|
||||||
Update: resourceAwsCloudWatchEventRuleUpdate,
|
Update: resourceAwsCloudWatchEventRuleUpdate,
|
||||||
Delete: resourceAwsCloudWatchEventRuleDelete,
|
Delete: resourceAwsCloudWatchEventRuleDelete,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: schema.ImportStatePassthrough,
|
||||||
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": &schema.Schema{
|
"name": &schema.Schema{
|
||||||
|
|
Loading…
Reference in New Issue