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_auditmanager_account_registration #28314

Merged
merged 5 commits into from
Dec 14, 2022

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Dec 12, 2022

Description

aws_auditmanager_account_registration will allow practitioners to enable AuditManager in their account via terraform.

Notable behavior of this resource:

  • By default, deletion of this resource will not disable AuditManager in the account to avoid unintended impact to other resources. Deregistration can be forced by setting the deregister_on_destroy attribute to true.
  • There is no AWS API to get the existing delegated account ID and KMS key settings. Modifications of these attributes will trigger a new call to the RegisterAccount API with the appropriate arguments set.
  • If AuditManager is deregistered outside of terraform, read will remove this resource from state, forcing re-creation (and a new call to the RegisterAccount API).

Relations

Relates #17981

Output from Acceptance Testing

$ AUDITMANAGER_DEREGISTER_ACCOUNT_ON_DESTROY=true make testacc PKG=auditmanager TESTS=TestAccAuditManagerAccountRegistration_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/auditmanager/... -v -count 1 -parallel 20 -run='TestAccAuditManagerAccountRegistration_'  -timeout 180m
=== RUN   TestAccAuditManagerAccountRegistration_serial
=== RUN   TestAccAuditManagerAccountRegistration_serial/basic
=== RUN   TestAccAuditManagerAccountRegistration_serial/disappears
=== RUN   TestAccAuditManagerAccountRegistration_serial/kms_key
--- PASS: TestAccAuditManagerAccountRegistration_serial (56.64s)
    --- PASS: TestAccAuditManagerAccountRegistration_serial/basic (13.10s)
    --- PASS: TestAccAuditManagerAccountRegistration_serial/disappears (13.32s)
    --- PASS: TestAccAuditManagerAccountRegistration_serial/kms_key (30.22s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/auditmanager       59.729s

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/auditmanager Issues and PRs that pertain to the auditmanager service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Dec 12, 2022
@jar-b jar-b force-pushed the f-aws_auditmanager_account_registration branch from e587b65 to 833f75b Compare December 12, 2022 22:04
@jar-b jar-b marked this pull request as ready for review December 12, 2022 23:41
@jar-b jar-b mentioned this pull request Dec 13, 2022
13 tasks
if !plan.KmsKey.IsNull() {
in.KmsKey = aws.String(plan.KmsKey.ValueString())
}
out, err := conn.RegisterAccount(ctx, &in)
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if RegisterAccount is called when the account is already registered?
Given the deregister_on_destroy flag there is a possibility that this will happen even if everything is managed by Terraform.

Copy link
Member Author

Choose a reason for hiding this comment

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

This functions like a typical Put* API. Calling it when the account is already active just sets the KMS key and delegated account ID values to the new input and keeps the status as ACTIVE.

@jar-b jar-b merged commit 9dc81df into main Dec 14, 2022
@jar-b jar-b deleted the f-aws_auditmanager_account_registration branch December 14, 2022 15:40
@github-actions github-actions bot added this to the v4.47.0 milestone Dec 14, 2022
github-actions bot pushed a commit that referenced this pull request Dec 14, 2022
@github-actions
Copy link

This functionality has been released in v4.47.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

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 Jan 15, 2023
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. service/auditmanager Issues and PRs that pertain to the auditmanager service. 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.

2 participants