provider/aws: Support Import of `aws_cloudwatch_metric_alarm` (#7687)
``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSCloudWatchMetricAlarm_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSCloudWatchMetricAlarm_ -timeout 120m === RUN TestAccAWSCloudWatchMetricAlarm_importBasic --- PASS: TestAccAWSCloudWatchMetricAlarm_importBasic (17.82s) === RUN TestAccAWSCloudWatchMetricAlarm_basic --- PASS: TestAccAWSCloudWatchMetricAlarm_basic (17.11s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 34.957s ```
This commit is contained in:
parent
1cf1b5c9d6
commit
565733398d
|
@ -0,0 +1,28 @@
|
||||||
|
package aws
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccAWSCloudWatchMetricAlarm_importBasic(t *testing.T) {
|
||||||
|
resourceName := "aws_cloudwatch_metric_alarm.foobar"
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccAWSCloudWatchMetricAlarmConfig,
|
||||||
|
},
|
||||||
|
|
||||||
|
resource.TestStep{
|
||||||
|
ResourceName: resourceName,
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
|
@ -16,6 +16,9 @@ func resourceAwsCloudWatchMetricAlarm() *schema.Resource {
|
||||||
Read: resourceAwsCloudWatchMetricAlarmRead,
|
Read: resourceAwsCloudWatchMetricAlarmRead,
|
||||||
Update: resourceAwsCloudWatchMetricAlarmUpdate,
|
Update: resourceAwsCloudWatchMetricAlarmUpdate,
|
||||||
Delete: resourceAwsCloudWatchMetricAlarmDelete,
|
Delete: resourceAwsCloudWatchMetricAlarmDelete,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: schema.ImportStatePassthrough,
|
||||||
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"alarm_name": &schema.Schema{
|
"alarm_name": &schema.Schema{
|
||||||
|
|
Loading…
Reference in New Issue