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

fix: update validation for image builder workflow type #39810

Conversation

stefanfreitag
Copy link
Contributor

Description

The documentation of the resource ami_imagebuilder_workflow mentions for the argument type

Valid values: BUILD, TEST, DISTRIBUTION.

Image Builder handles the workflow type DISTRIBUTION, it cannot be configured by users.
When trying to do so, for example using the code snippet provided as part of #39785

resource aws_imagebuilder_workflow codebuild-projects {
  name = "CodeBuildProjectsDistributionWorkflow"
  version = "1.0.0"
  type = "DISTRIBUTION"
  data = file("${path.module}/codebuild-projects-distribution.workflow.yaml")
}

the API returns the error The value supplied for parameter 'type' is not valid. Custom distribution workflows are not supported.

This pull request is to update the documentation for the resource as well as the validation for the argument.
Two points from my side:

  • For the validation I was not sure on the correct approach: I changed ValidateDiagFunc to ValidateFunc, typically it should be the other, right? Feedback is appreciated.
  • How would I test the change in the validation? At the moment we do not have a test for attribute type, but adding one would also not cover the change.

Relations

Closes #39785

References

Here I explained the current situation.

Output from Acceptance Testing

make testacc TESTS=TestAccImageBuilderWorkflow PKG=imagebuilder
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/imagebuilder/... -v -count 1 -parallel 20 -run='TestAccImageBuilderWorkflow'  -timeout 360m
2024/10/20 21:04:19 Initializing Terraform AWS Provider...
=== RUN   TestAccImageBuilderWorkflow_basic
=== PAUSE TestAccImageBuilderWorkflow_basic
=== RUN   TestAccImageBuilderWorkflow_disappears
=== PAUSE TestAccImageBuilderWorkflow_disappears
=== RUN   TestAccImageBuilderWorkflow_changeDescription
=== PAUSE TestAccImageBuilderWorkflow_changeDescription
=== RUN   TestAccImageBuilderWorkflow_description
=== PAUSE TestAccImageBuilderWorkflow_description
=== RUN   TestAccImageBuilderWorkflow_kmsKeyID
=== PAUSE TestAccImageBuilderWorkflow_kmsKeyID
=== RUN   TestAccImageBuilderWorkflow_tags
=== PAUSE TestAccImageBuilderWorkflow_tags
=== RUN   TestAccImageBuilderWorkflow_uri
=== PAUSE TestAccImageBuilderWorkflow_uri
=== CONT  TestAccImageBuilderWorkflow_basic
=== CONT  TestAccImageBuilderWorkflow_kmsKeyID
=== CONT  TestAccImageBuilderWorkflow_uri
=== CONT  TestAccImageBuilderWorkflow_tags
=== CONT  TestAccImageBuilderWorkflow_changeDescription
=== CONT  TestAccImageBuilderWorkflow_description
=== CONT  TestAccImageBuilderWorkflow_disappears
--- PASS: TestAccImageBuilderWorkflow_disappears (42.21s)
--- PASS: TestAccImageBuilderWorkflow_basic (47.48s)
--- PASS: TestAccImageBuilderWorkflow_changeDescription (47.56s)
--- PASS: TestAccImageBuilderWorkflow_description (47.66s)
--- PASS: TestAccImageBuilderWorkflow_kmsKeyID (49.77s)
--- PASS: TestAccImageBuilderWorkflow_uri (55.30s)
--- PASS: TestAccImageBuilderWorkflow_tags (85.21s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/imagebuilder       85.434s
...

Image Builder handles the  workflow type DISTRIBUTION, it cannot be configured by users.
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. service/imagebuilder Issues and PRs that pertain to the imagebuilder service. needs-triage Waiting for first response or review from a maintainer. labels Oct 20, 2024
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 21, 2024
@stefanfreitag stefanfreitag deleted the f-aws_imagebuilder_workflow-fix-workflow-type-validation branch October 23, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/imagebuilder Issues and PRs that pertain to the imagebuilder service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: aws_imagebuilder_workflow allows invalid value "DISTRIBUTION" for 'type' argument
3 participants