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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. generators Relates to code generators. needs-triage Waiting for first response or review from a maintainer. 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
1 participant