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 Import for aws_sns_topic_policy resource #10163

Conversation

teraken0509
Copy link
Contributor

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

Closes #9578

Release note for CHANGELOG:

r/aws_sns_topic_policy: add support import

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSSNSTopicPolicy_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSSNSTopicPolicy_basic -timeout 120m
=== RUN   TestAccAWSSNSTopicPolicy_basic
=== PAUSE TestAccAWSSNSTopicPolicy_basic
=== CONT  TestAccAWSSNSTopicPolicy_basic
--- PASS: TestAccAWSSNSTopicPolicy_basic (33.26s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	33.389s

@teraken0509 teraken0509 requested a review from a team September 19, 2019 12:10
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/sns Issues and PRs that pertain to the sns service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. labels Sep 19, 2019
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Sep 24, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Hi @kterada0509 👋 Thanks for submitting this. Please see the below item and let us know if you have any questions. Should be good to merge after that. 👍


## Import

SNS Topics Policy can be imported using the `topic arn`, e.g.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit:

Suggested change
SNS Topics Policy can be imported using the `topic arn`, e.g.
SNS Topic Policy can be imported using the topic ARN, e.g.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed.

arn, ok := attrmap["TopicArn"]
if !ok {
log.Printf("[WARN] SNS Topic (%q) topic arn not found in attributes", d.Id())
d.SetId("")
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of removing the resource from the Terraform state due to a potentially different API response (possible with tooling such as SAM CLI or LocalStack, we should just allow the attribute value to be conditionally set, e.g.

d.Set("arn", attrmap["TopicArn"])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed.

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Sep 24, 2019
@teraken0509 teraken0509 force-pushed the feature/add-support-import-for-aws_sns_topic_policy-resource branch from 78794bf to eaa676f Compare September 24, 2019 15:24
@teraken0509
Copy link
Contributor Author

Re-run acctest.

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSSNSTopicPolicy_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSSNSTopicPolicy_basic -timeout 120m
=== RUN   TestAccAWSSNSTopicPolicy_basic
=== PAUSE TestAccAWSSNSTopicPolicy_basic
Add support Import for aws_sns_topic_policy resource
=== CONT  TestAccAWSSNSTopicPolicy_basic
--- PASS: TestAccAWSSNSTopicPolicy_basic (30.52s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	30.597s

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 24, 2019
@bflad bflad added this to the v2.30.0 milestone Sep 24, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! 🚀

Output from acceptance testing in AWS Commercial:

--- PASS: TestAccAWSSNSTopicPolicy_basic (16.22s)

Output from acceptance testing in AWS GovCloud (US):

--- PASS: TestAccAWSSNSTopicPolicy_basic (20.12s)

@bflad bflad merged commit 2913113 into hashicorp:master Sep 24, 2019
bflad added a commit that referenced this pull request Sep 24, 2019
@ghost
Copy link

ghost commented Sep 26, 2019

This has been released in version 2.30.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 or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 1, 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 1, 2019
@teraken0509 teraken0509 deleted the feature/add-support-import-for-aws_sns_topic_policy-resource branch March 5, 2020 14:03
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. service/sns Issues and PRs that pertain to the sns service. size/XS 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.

resource aws_sns_topic_policy doesn't support import
2 participants