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 resource aws_ecr_account_setting #40219

Merged
merged 10 commits into from
Dec 6, 2024

Conversation

lvthillo
Copy link
Contributor

@lvthillo lvthillo commented Nov 20, 2024

Description

To be honest, I have my doubts about this PR.
There’s no way to delete the configuration. There’s only PutAccountSetting and GetAccountSetting. It’s also possible to assign a name, but if I understand correctly, it can only have the value BASIC_SCAN_TYPE_VERSION. That’s why the test is a bit vague. I’ll set the PR to draft mode to potentially get input from others.

Relations

Closes #40140

References

Output from Acceptance Testing

$ make testacc TESTS=TestAccECRAccountSetting_serial PKG=ecr
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/ecr/... -v -count 1 -parallel 20 -run='TestAccAccountSetting_serial'  -timeout 360m
2024/11/20 21:44:35 Initializing Terraform AWS Provider...
=== RUN   TestAccAccountSetting_serial
=== PAUSE TestAccAccountSetting_serial
=== CONT  TestAccAccountSetting_serial
=== RUN   TestAccAccountSetting_serial/basic
--- PASS: TestAccAccountSetting_serial (30.28s)
    --- PASS: TestAccAccountSetting_serial/basic (30.28s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ecr        45.900s
...

Examples using local provider:

resource "aws_ecr_account_setting" "test" {
  name  = "BASIC_SCAN_TYPE_VERSION"
  value  = "AWS_NATIVE"
}

Apply:

  # aws_ecr_account_setting.test will be created
  + resource "aws_ecr_account_setting" "test" {
      + id    = (known after apply)
      + name  = "BASIC_SCAN_TYPE_VERSION"
      + value = "AWS_NATIVE"
    }

Check w CLI

$ aws ecr get-account-setting --name BASIC_SCAN_TYPE_VERSION
{
    "name": "BASIC_SCAN_TYPE_VERSION",
    "value": "AWS_NATIVE"
}

Switch to `CLAIR``

Terraform will perform the following actions:

  # aws_ecr_account_setting.test will be updated in-place
  ~ resource "aws_ecr_account_setting" "test" {
        id    = "BASIC_SCAN_TYPE_VERSION"
        name  = "BASIC_SCAN_TYPE_VERSION"
      ~ value = "AWS_NATIVE" -> "CLAIR"
    }

Plan: 0 to add, 1 to change, 0 to destroy.

CLI output

{
    "name": "BASIC_SCAN_TYPE_VERSION",
    "value": "CLAIR"
}

Destroy

Terraform will perform the following actions:

  # aws_ecr_account_setting.test will be destroyed
  - resource "aws_ecr_account_setting" "test" {
      - id    = "BASIC_SCAN_TYPE_VERSION" -> null
      - name  = "BASIC_SCAN_TYPE_VERSION" -> null
      - value = "CLAIR" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Check CLI. Setting remains on last value

{
    "name": "BASIC_SCAN_TYPE_VERSION",
    "value": "CLAIR"
}

@lvthillo lvthillo requested a review from a team as a code owner November 20, 2024 20:50
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 documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ecr Issues and PRs that pertain to the ecr service. generators Relates to code generators. needs-triage Waiting for first response or review from a maintainer. labels Nov 20, 2024
@ewbankkit ewbankkit added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 5, 2024
@ewbankkit ewbankkit self-assigned this Dec 6, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Dec 6, 2024
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 🚀.

% make testacc TESTARGS='-run=TestAccECRAccountSetting_serial' PKG=ecr
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/ecr/... -v -count 1 -parallel 20  -run=TestAccECRAccountSetting_serial -timeout 360m
2024/12/06 12:04:51 Initializing Terraform AWS Provider...
=== RUN   TestAccECRAccountSetting_serial
=== PAUSE TestAccECRAccountSetting_serial
=== CONT  TestAccECRAccountSetting_serial
=== RUN   TestAccECRAccountSetting_serial/basic
--- PASS: TestAccECRAccountSetting_serial (19.79s)
    --- PASS: TestAccECRAccountSetting_serial/basic (19.79s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ecr	25.049s

Copy link
Contributor

@johnsonaj johnsonaj left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@ewbankkit
Copy link
Contributor

@lvthillo Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 572f279 into hashicorp:main Dec 6, 2024
42 checks passed
@github-actions github-actions bot added this to the v5.81.0 milestone Dec 6, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Dec 12, 2024
Copy link

This functionality has been released in v5.81.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!

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 12, 2025
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. generators Relates to code generators. new-resource Introduces a new resource. service/ecr Issues and PRs that pertain to the ecr service. 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.

[New Resource]: aws_ecr_account_setting resource should exist
3 participants