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

New resource/aws_account_alternate_contact #21789

Merged
merged 7 commits into from
Nov 19, 2021

Conversation

shedimon
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" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #21118

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@github-actions github-actions bot added size/L Managed by automation to categorize the size of a PR. client-connections Pertains to the AWS Client and service connections. provider Pertains to the provider itself, rather than any interaction with AWS. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. labels Nov 16, 2021
@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. size/XL Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Nov 16, 2021
@shedimon
Copy link
Contributor Author

@ewbankkit @gdavison for some reason my tests are failing locally with a circular dependency I'm struggling to find:

$ make testacc TESTARGS='-run=TestAccAccountAlternateContact'                                                                                                                         
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/... -v -count 1 -parallel 20 -run=TestAccAccountAlternateContact -timeout 180m
# github.com/hashicorp/terraform-provider-aws/internal/service/account
package github.com/hashicorp/terraform-provider-aws/internal/service/account
	imports github.com/hashicorp/terraform-provider-aws/internal/provider
	imports github.com/hashicorp/terraform-provider-aws/internal/acctest: import cycle not allowed in test
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/account [setup failed]

It seems that I'm using the same approach for testing as other services I've checked. Any help appreciated!

@shedimon shedimon changed the title [WIP] New resource/aws_account_alternate_contact New resource/aws_account_alternate_contact Nov 18, 2021
@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 18, 2021
Acceptance test output:

% make testacc PKG_NAME=internal/service/account TESTARGS='-run=TestAccAccountAlternateContact_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/account/... -v -count 1 -parallel 20 -run=TestAccAccountAlternateContact_ -timeout 180m
=== RUN   TestAccAccountAlternateContact_basic
--- PASS: TestAccAccountAlternateContact_basic (27.04s)
=== RUN   TestAccAccountAlternateContact_disappears
--- PASS: TestAccAccountAlternateContact_disappears (11.69s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/account	42.243s
@github-actions github-actions bot added repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. and removed repository Repository modifications; GitHub Actions, developer docs, issue templates, codeowners, changelog. labels Nov 19, 2021
@ewbankkit
Copy link
Contributor

ewbankkit commented Nov 19, 2021

@shedimon Thanks for the contribution.
The problem with the circular dependency is resolved by changing the acceptance test files' package to account_test.

To get this merged quickly I went ahead and made that change plus renamed the type argument to alternate_contact_type to match the AWS API.

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

Commercial
% make testacc PKG_NAME=internal/service/account TESTARGS='-run=TestAccAccountAlternateContact_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/account/... -v -count 1 -parallel 20 -run=TestAccAccountAlternateContact_ -timeout 180m
=== RUN   TestAccAccountAlternateContact_basic
--- PASS: TestAccAccountAlternateContact_basic (27.04s)
=== RUN   TestAccAccountAlternateContact_disappears
--- PASS: TestAccAccountAlternateContact_disappears (11.69s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/account	42.243s
GovCloud
% make testacc PKG_NAME=internal/service/account TESTARGS='-run=TestAccAccountAlternateContact_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/account/... -v -count 1 -parallel 20 -run=TestAccAccountAlternateContact_ -timeout 180m
=== RUN   TestAccAccountAlternateContact_basic
    alternate_contact_test.go:157: skipping acceptance testing: RequestError: send request failed
        caused by: Post "https://account.us-gov-west-1.amazonaws.com/getAlternateContact": dial tcp: lookup account.us-gov-west-1.amazonaws.com: no such host
--- SKIP: TestAccAccountAlternateContact_basic (27.30s)
=== RUN   TestAccAccountAlternateContact_disappears
    alternate_contact_test.go:157: skipping acceptance testing: RequestError: send request failed
        caused by: Post "https://account.us-gov-west-1.amazonaws.com/getAlternateContact": dial tcp: lookup account.us-gov-west-1.amazonaws.com: no such host
--- SKIP: TestAccAccountAlternateContact_disappears (22.19s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/account	52.909s

@ewbankkit ewbankkit merged commit 87f33a2 into hashicorp:main Nov 19, 2021
@github-actions github-actions bot added this to the v3.67.0 milestone Nov 19, 2021
@shedimon shedimon deleted the account-alternate-contacts branch November 20, 2021 06:40
@mforutan
Copy link
Contributor

@shedimon @ewbankkit How about the optional account-id parameter which is needed to use this in an organization account?

@shedimon
Copy link
Contributor Author

shedimon commented Nov 22, 2021

@mforutan To me it looks like two different resources - one to manage alternate contacts in the account it is created in, the other one - via the org main AWS account. That's why I've added only one and left the decision on adding the additional optional parameter/additional resource to the AWS Provider team for further addition following their judgement.

@mforutan
Copy link
Contributor

mforutan commented Nov 24, 2021

@shedimon I am not sure what would be the best implementation but following the aws-sdk, I think we should be able to support for both scenarios in this new resource, so I created a new PR: #21888

@github-actions
Copy link

github-actions bot commented Dec 1, 2021

This functionality has been released in v3.67.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. Thank you!

@github-actions
Copy link

github-actions bot commented Jun 7, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
client-connections Pertains to the AWS Client and service connections. documentation Introduces or discusses updates to documentation. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. size/XL 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.

Handling of alternate contacts for the account
4 participants