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

r/imagebuilder_image_recipe: Fix regression with Windows base images #23580

Merged

Conversation

mattburgess
Copy link
Collaborator

@mattburgess mattburgess commented Mar 8, 2022

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 #23568.
Relates #23293.
Relates #22159.

Output from acceptance testing:

The new regression test correctly catches the bug I introduced:

$ make testacc TESTS=TestAccImageBuilderImageRecipe_WindowsBaseImage PKG=imagebuilder
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/imagebuilder/... -v -count 1 -parallel 20 -run='TestAccImageBuilderImageRecipe_WindowsBaseImage'  -timeout 180m
=== RUN   TestAccImageBuilderImageRecipe_WindowsBaseImage
=== PAUSE TestAccImageBuilderImageRecipe_WindowsBaseImage
=== CONT  TestAccImageBuilderImageRecipe_WindowsBaseImage
    image_recipe_test.go:629: Step 1/2 error: Error running apply: exit status 1
        
        Error: error creating Image Builder Image Recipe: InvalidParameterCombinationException: The value supplied for parameter 'parentImage' and 'systemsManagerAgent' is not valid. Image Builder does not support configuring the SSM Agent on Windows.
        
          with aws_imagebuilder_image_recipe.test,
          on terraform_plugin_test.tf line 26, in resource "aws_imagebuilder_image_recipe" "test":
          26: resource "aws_imagebuilder_image_recipe" "test" {
        
--- FAIL: TestAccImageBuilderImageRecipe_WindowsBaseImage (18.68s)

And after my fix:

$ make testacc TESTS=TestAccImageBuilderImageRecipe_WindowsBaseImage PKG=imagebuilder
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/imagebuilder/... -v -count 1 -parallel 20 -run='TestAccImageBuilderImageRecipe_WindowsBaseImage'  -timeout 180m
=== RUN   TestAccImageBuilderImageRecipe_WindowsBaseImage
=== PAUSE TestAccImageBuilderImageRecipe_WindowsBaseImage
=== CONT  TestAccImageBuilderImageRecipe_WindowsBaseImage
--- PASS: TestAccImageBuilderImageRecipe_WindowsBaseImage (36.22s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/imagebuilder	36.265s

And finally, the full suite still passes:

$ make testacc TESTS=TestAccImageBuilderImageRecipe_ PKG=imagebuilder
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/imagebuilder/... -v -count 1 -parallel 20 -run='TestAccImageBuilderImageRecipe_'  -timeout 180m
=== RUN   TestAccImageBuilderImageRecipe_basic
=== PAUSE TestAccImageBuilderImageRecipe_basic
=== RUN   TestAccImageBuilderImageRecipe_disappears
=== PAUSE TestAccImageBuilderImageRecipe_disappears
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_deleteOnTermination
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_deleteOnTermination
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_encrypted
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_encrypted
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_iops
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_iops
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_kmsKeyID
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_kmsKeyID
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_snapshotID
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_snapshotID
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeSize
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeSize
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP2
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP2
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP3
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP3
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMapping_noDevice
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMapping_noDevice
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMapping_virtualName
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMapping_virtualName
=== RUN   TestAccImageBuilderImageRecipe_component
=== PAUSE TestAccImageBuilderImageRecipe_component
=== RUN   TestAccImageBuilderImageRecipe_componentParameter
=== PAUSE TestAccImageBuilderImageRecipe_componentParameter
=== RUN   TestAccImageBuilderImageRecipe_description
=== PAUSE TestAccImageBuilderImageRecipe_description
=== RUN   TestAccImageBuilderImageRecipe_tags
=== PAUSE TestAccImageBuilderImageRecipe_tags
=== RUN   TestAccImageBuilderImageRecipe_workingDirectory
=== PAUSE TestAccImageBuilderImageRecipe_workingDirectory
=== RUN   TestAccImageBuilderImageRecipe_pipelineUpdateDependency
=== PAUSE TestAccImageBuilderImageRecipe_pipelineUpdateDependency
=== RUN   TestAccImageBuilderImageRecipe_systemsManagerAgent
=== PAUSE TestAccImageBuilderImageRecipe_systemsManagerAgent
=== RUN   TestAccImageBuilderImageRecipe_userDataBase64
=== PAUSE TestAccImageBuilderImageRecipe_userDataBase64
=== RUN   TestAccImageBuilderImageRecipe_WindowsBaseImage
=== PAUSE TestAccImageBuilderImageRecipe_WindowsBaseImage
=== CONT  TestAccImageBuilderImageRecipe_basic
=== CONT  TestAccImageBuilderImageRecipe_tags
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeSize
=== CONT  TestAccImageBuilderImageRecipe_systemsManagerAgent
=== CONT  TestAccImageBuilderImageRecipe_WindowsBaseImage
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP2
=== CONT  TestAccImageBuilderImageRecipe_workingDirectory
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMapping_virtualName
=== CONT  TestAccImageBuilderImageRecipe_componentParameter
=== CONT  TestAccImageBuilderImageRecipe_component
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_snapshotID
=== CONT  TestAccImageBuilderImageRecipe_userDataBase64
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMapping_noDevice
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP3
=== CONT  TestAccImageBuilderImageRecipe_description
=== CONT  TestAccImageBuilderImageRecipe_pipelineUpdateDependency
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_kmsKeyID
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_encrypted
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_iops
--- PASS: TestAccImageBuilderImageRecipe_componentParameter (62.07s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_deleteOnTermination
--- PASS: TestAccImageBuilderImageRecipe_workingDirectory (76.30s)
=== CONT  TestAccImageBuilderImageRecipe_disappears
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMapping_virtualName (79.44s)
--- PASS: TestAccImageBuilderImageRecipe_WindowsBaseImage (82.92s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP2 (85.09s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_iops (86.07s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP3 (86.13s)
--- PASS: TestAccImageBuilderImageRecipe_userDataBase64 (89.15s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName (89.16s)
--- PASS: TestAccImageBuilderImageRecipe_description (89.36s)
--- PASS: TestAccImageBuilderImageRecipe_systemsManagerAgent (90.38s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMapping_noDevice (92.54s)
--- PASS: TestAccImageBuilderImageRecipe_basic (92.58s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeSize (92.70s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_kmsKeyID (92.79s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_encrypted (92.80s)
--- PASS: TestAccImageBuilderImageRecipe_component (93.80s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_snapshotID (100.09s)
--- PASS: TestAccImageBuilderImageRecipe_disappears (40.68s)
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_deleteOnTermination (55.62s)
--- PASS: TestAccImageBuilderImageRecipe_pipelineUpdateDependency (134.54s)
--- PASS: TestAccImageBuilderImageRecipe_tags (143.31s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/imagebuilder	143.360s

@github-actions github-actions bot added service/imagebuilder Issues and PRs that pertain to the imagebuilder service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Mar 8, 2022
@mattburgess mattburgess force-pushed the imagebuilder-fix-windows-recipes branch from a9b4aa7 to 9656fd9 Compare March 8, 2022 20:54
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 9, 2022
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 TESTS=TestAccImageBuilderImageRecipe_ PKG=imagebuilder ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/imagebuilder/... -v -count 1 -parallel 3 -run='TestAccImageBuilderImageRecipe_'  -timeout 180m
=== RUN   TestAccImageBuilderImageRecipe_basic
=== PAUSE TestAccImageBuilderImageRecipe_basic
=== RUN   TestAccImageBuilderImageRecipe_disappears
=== PAUSE TestAccImageBuilderImageRecipe_disappears
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_deleteOnTermination
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_deleteOnTermination
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_encrypted
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_encrypted
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_iops
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_iops
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_kmsKeyID
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_kmsKeyID
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_snapshotID
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_snapshotID
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeSize
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeSize
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP2
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP2
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP3
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP3
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMapping_noDevice
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMapping_noDevice
=== RUN   TestAccImageBuilderImageRecipe_BlockDeviceMapping_virtualName
=== PAUSE TestAccImageBuilderImageRecipe_BlockDeviceMapping_virtualName
=== RUN   TestAccImageBuilderImageRecipe_component
=== PAUSE TestAccImageBuilderImageRecipe_component
=== RUN   TestAccImageBuilderImageRecipe_componentParameter
=== PAUSE TestAccImageBuilderImageRecipe_componentParameter
=== RUN   TestAccImageBuilderImageRecipe_description
=== PAUSE TestAccImageBuilderImageRecipe_description
=== RUN   TestAccImageBuilderImageRecipe_tags
=== PAUSE TestAccImageBuilderImageRecipe_tags
=== RUN   TestAccImageBuilderImageRecipe_workingDirectory
=== PAUSE TestAccImageBuilderImageRecipe_workingDirectory
=== RUN   TestAccImageBuilderImageRecipe_pipelineUpdateDependency
=== PAUSE TestAccImageBuilderImageRecipe_pipelineUpdateDependency
=== RUN   TestAccImageBuilderImageRecipe_systemsManagerAgent
=== PAUSE TestAccImageBuilderImageRecipe_systemsManagerAgent
=== RUN   TestAccImageBuilderImageRecipe_userDataBase64
=== PAUSE TestAccImageBuilderImageRecipe_userDataBase64
=== RUN   TestAccImageBuilderImageRecipe_WindowsBaseImage
=== PAUSE TestAccImageBuilderImageRecipe_WindowsBaseImage
=== CONT  TestAccImageBuilderImageRecipe_basic
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMapping_noDevice
=== CONT  TestAccImageBuilderImageRecipe_workingDirectory
--- PASS: TestAccImageBuilderImageRecipe_workingDirectory (24.69s)
=== CONT  TestAccImageBuilderImageRecipe_WindowsBaseImage
--- PASS: TestAccImageBuilderImageRecipe_basic (24.82s)
=== CONT  TestAccImageBuilderImageRecipe_userDataBase64
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMapping_noDevice (25.33s)
=== CONT  TestAccImageBuilderImageRecipe_systemsManagerAgent
--- PASS: TestAccImageBuilderImageRecipe_userDataBase64 (21.34s)
=== CONT  TestAccImageBuilderImageRecipe_pipelineUpdateDependency
--- PASS: TestAccImageBuilderImageRecipe_WindowsBaseImage (21.55s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_kmsKeyID
--- PASS: TestAccImageBuilderImageRecipe_systemsManagerAgent (21.20s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeSize
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_kmsKeyID (22.61s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_snapshotID
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeSize (22.92s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_deleteOnTermination
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_deleteOnTermination (22.08s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_iops
--- PASS: TestAccImageBuilderImageRecipe_pipelineUpdateDependency (65.52s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_encrypted
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_iops (21.33s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP2
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_snapshotID (47.01s)
=== CONT  TestAccImageBuilderImageRecipe_componentParameter
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_encrypted (23.98s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP3
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP2 (23.34s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName
--- PASS: TestAccImageBuilderImageRecipe_componentParameter (21.63s)
=== CONT  TestAccImageBuilderImageRecipe_component
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMapping_deviceName (20.58s)
=== CONT  TestAccImageBuilderImageRecipe_disappears
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMappingEBS_volumeTypeGP3 (21.97s)
=== CONT  TestAccImageBuilderImageRecipe_BlockDeviceMapping_virtualName
--- PASS: TestAccImageBuilderImageRecipe_component (27.04s)
=== CONT  TestAccImageBuilderImageRecipe_tags
--- PASS: TestAccImageBuilderImageRecipe_disappears (19.41s)
=== CONT  TestAccImageBuilderImageRecipe_description
--- PASS: TestAccImageBuilderImageRecipe_BlockDeviceMapping_virtualName (22.63s)
--- PASS: TestAccImageBuilderImageRecipe_description (21.22s)
--- PASS: TestAccImageBuilderImageRecipe_tags (49.11s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/imagebuilder	217.064s

@ewbankkit
Copy link
Contributor

@mattburgess Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit a400664 into hashicorp:main Mar 10, 2022
@github-actions github-actions bot added this to the v4.5.0 milestone Mar 10, 2022
@github-actions
Copy link

This functionality has been released in v4.5.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 May 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/imagebuilder Issues and PRs that pertain to the imagebuilder service. size/M 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.

Can't create aws_imagebuilder_image_recipe resources with Windows images
3 participants