Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cloudwatch event target import #9431

Merged

Conversation

chaspy
Copy link
Contributor

@chaspy chaspy commented Jul 21, 2019

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Fixes #9264

Release note for CHANGELOG:

resource/aws_cloudwatch_event_target: Support resource import

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_basic -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_basic
=== PAUSE TestAccAWSCloudWatchEventTarget_basic
=== CONT  TestAccAWSCloudWatchEventTarget_basic
--- PASS: TestAccAWSCloudWatchEventTarget_basic (59.97s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	60.034s

@ghost ghost added size/L Managed by automation to categorize the size of a PR. service/cloudwatchevents documentation Introduces or discusses updates to documentation. labels Jul 21, 2019
@chaspy chaspy force-pushed the chaspy/import_cloudwatch_event_target branch from b1363d3 to 64c2fed Compare July 21, 2019 15:30
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/L Managed by automation to categorize the size of a PR. size/XS Managed by automation to categorize the size of a PR. labels Jul 21, 2019
@chaspy chaspy force-pushed the chaspy/import_cloudwatch_event_target branch from e719fd5 to 70b5e91 Compare July 21, 2019 15:59
@chaspy chaspy changed the title Chaspy/import cloudwatch event target Add support for cloudwatch event target import Jul 21, 2019
@chaspy chaspy marked this pull request as ready for review July 21, 2019 16:10
@chaspy chaspy requested a review from a team July 21, 2019 16:10
ImportState: true,
ImportStateIdFunc: testAccAWSCloudWatchEventTargetImportStateIdFunc("aws_cloudwatch_event_target.moobar"),
ImportStateVerify: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @chaspy - thanks so much for this contribution! Overall, this looks great, but for the sake of completeness, could you add this block to all of the TestAccAWSCloudWatchEventTarget acceptance tests in this file?

{
				ResourceName:      "aws_cloudwatch_event_target.moobar",
				ImportState:       true,
				ImportStateIdFunc: testAccAWSCloudWatchEventTargetImportStateIdFunc("aws_cloudwatch_event_target.moobar"),
				ImportStateVerify: true,
			},

You'll want to make sure that ResourceName matches for each test since it looks like they vary a bit from test to test. If you're able to add these and re-run the acceptance tests for us, we can go ahead and get this merged in. Thanks! 👍

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. waiting-response Maintainers are waiting on response from community or contributor. labels Jul 23, 2019
@ghost ghost added size/M Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Jul 23, 2019
@chaspy chaspy force-pushed the chaspy/import_cloudwatch_event_target branch from 67edbd2 to 98d0c6a Compare July 23, 2019 16:14
@chaspy
Copy link
Contributor Author

chaspy commented Jul 23, 2019

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_basic -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_basic
=== PAUSE TestAccAWSCloudWatchEventTarget_basic
=== CONT  TestAccAWSCloudWatchEventTarget_basic
--- PASS: TestAccAWSCloudWatchEventTarget_basic (68.25s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	68.305s

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_missingTargetId'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_missingTargetId -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_missingTargetId
=== PAUSE TestAccAWSCloudWatchEventTarget_missingTargetId
=== CONT  TestAccAWSCloudWatchEventTarget_missingTargetId
--- PASS: TestAccAWSCloudWatchEventTarget_missingTargetId (39.58s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	39.643s

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_full'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_full -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_full
=== PAUSE TestAccAWSCloudWatchEventTarget_full
=== CONT  TestAccAWSCloudWatchEventTarget_full
--- PASS: TestAccAWSCloudWatchEventTarget_full (113.50s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	113.561s

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_ssmDocument'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_ssmDocument -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_ssmDocument
=== PAUSE TestAccAWSCloudWatchEventTarget_ssmDocument
=== CONT  TestAccAWSCloudWatchEventTarget_ssmDocument
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (45.69s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	45.751s

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_batch'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_batch -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_batch
=== PAUSE TestAccAWSCloudWatchEventTarget_batch
=== CONT  TestAccAWSCloudWatchEventTarget_batch
--- PASS: TestAccAWSCloudWatchEventTarget_batch (156.70s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	156.753s

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_kinesis'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_kinesis -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_kinesis
=== PAUSE TestAccAWSCloudWatchEventTarget_kinesis
=== CONT  TestAccAWSCloudWatchEventTarget_kinesis
--- PASS: TestAccAWSCloudWatchEventTarget_kinesis (113.28s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	113.348s

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_sqs'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_sqs -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_sqs
=== PAUSE TestAccAWSCloudWatchEventTarget_sqs
=== CONT  TestAccAWSCloudWatchEventTarget_sqs
--- PASS: TestAccAWSCloudWatchEventTarget_sqs (39.36s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	39.420s

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_input_transformer'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_input_transformer -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_input_transformer
=== PAUSE TestAccAWSCloudWatchEventTarget_input_transformer
=== CONT  TestAccAWSCloudWatchEventTarget_input_transformer
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (52.70s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	52.755s

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Jul 23, 2019
@chaspy chaspy force-pushed the chaspy/import_cloudwatch_event_target branch from 98d0c6a to e5b0716 Compare July 23, 2019 16:33
@chaspy
Copy link
Contributor Author

chaspy commented Jul 23, 2019

😢

$ make testacc TESTARGS='-run=TestAccAWSCloudWatchEventTarget_ecs'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSCloudWatchEventTarget_ecs -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudWatchEventTarget_ecs
=== PAUSE TestAccAWSCloudWatchEventTarget_ecs
=== CONT  TestAccAWSCloudWatchEventTarget_ecs
--- FAIL: TestAccAWSCloudWatchEventTarget_ecs (157.06s)
    testing.go:629: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: ClusterContainsTasksException: The Cluster cannot be deleted while Tasks are active.
        	status code: 400, request id: bc6f1319-d58c-4c86-81cd-21588689410c

        State: aws_ecs_cluster.test:
          ID = arn:aws:ecs:us-west-2:655123516369:cluster/tf_ecs_target-7311645963352831750
          provider = provider.aws
          arn = arn:aws:ecs:us-west-2:655123516369:cluster/tf_ecs_target-7311645963352831750
          name = tf_ecs_target-7311645963352831750
          tags.% = 0
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	157.117s
make: *** [testacc] Error 1

@chaspy chaspy force-pushed the chaspy/import_cloudwatch_event_target branch from e5b0716 to d69b5e1 Compare July 23, 2019 17:19
Copy link
Contributor

@ryndaniels ryndaniels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding in the additional tests, @chaspy! 👍

--- PASS: TestAccAWSCloudWatchEventTarget_sqs (9.64s)
--- PASS: TestAccAWSCloudWatchEventTarget_missingTargetId (11.21s)
--- PASS: TestAccAWSCloudWatchEventTarget_ssmDocument (13.62s)
--- PASS: TestAccAWSCloudWatchEventTarget_ecs (13.89s)
--- PASS: TestAccAWSCloudWatchEventTarget_basic (15.58s)
--- PASS: TestAccAWSCloudWatchEventTarget_input_transformer (28.17s)
--- PASS: TestAccAWSCloudWatchEventTarget_kinesis (78.65s)
--- PASS: TestAccAWSCloudWatchEventTarget_full (79.37s)
--- PASS: TestAccAWSCloudWatchEventTarget_batch (80.64s)

🚀

@ryndaniels ryndaniels added this to the v2.21.0 milestone Jul 24, 2019
@ryndaniels ryndaniels merged commit b3cc187 into hashicorp:master Jul 24, 2019
@chaspy chaspy deleted the chaspy/import_cloudwatch_event_target branch July 25, 2019 02:33
@bflad
Copy link
Contributor

bflad commented Jul 26, 2019

This has been released in version 2.21.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests, documentation updates, or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 2, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import cloudwatch_event_target
3 participants