-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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_imagebuilder_image #16710
Conversation
Reference: #16375 Reference: #16377 Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAwsImageBuilderImage_basic (1596.87s) --- PASS: TestAccAwsImageBuilderImage_disappears (1593.54s) --- PASS: TestAccAwsImageBuilderImage_DistributionConfigurationArn (1844.49s) --- PASS: TestAccAwsImageBuilderImage_EnhancedImageMetadataEnabled (2636.68s) --- PASS: TestAccAwsImageBuilderImage_ImageTestsConfiguration_ImageTestsEnabled (2616.36s) --- PASS: TestAccAwsImageBuilderImage_ImageTestsConfiguration_TimeoutMinutes (3026.17s) --- PASS: TestAccAwsImageBuilderImage_Tags (1514.62s) --- PASS: TestAccAwsImageBuilderImageDataSource_Arn_Aws (12.69s) --- PASS: TestAccAwsImageBuilderImageDataSource_Arn_Self (1458.04s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAwsImageBuilderImage_basic (1463.62s) --- PASS: TestAccAwsImageBuilderImage_disappears (1460.27s) --- PASS: TestAccAwsImageBuilderImage_DistributionConfigurationArn (1850.90s) --- PASS: TestAccAwsImageBuilderImage_EnhancedImageMetadataEnabled (2648.38s) --- PASS: TestAccAwsImageBuilderImage_ImageTestsConfiguration_ImageTestsEnabled (2648.21s) --- PASS: TestAccAwsImageBuilderImage_ImageTestsConfiguration_TimeoutMinutes (2914.17s) --- PASS: TestAccAwsImageBuilderImage_Tags (1643.87s) --- PASS: TestAccAwsImageBuilderImageDataSource_Arn_Aws (19.19s) --- PASS: TestAccAwsImageBuilderImageDataSource_Arn_Self (1462.29s) ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few optional nits but otherwise LGTM! 🎉
GovCloud:
--- PASS: TestAccAwsImageBuilderImage_basic (1330.88s)
--- PASS: TestAccAwsImageBuilderImage_disappears (1455.57s)
--- PASS: TestAccAwsImageBuilderImage_DistributionConfigurationArn (1586.72s)
--- PASS: TestAccAwsImageBuilderImage_EnhancedImageMetadataEnabled (1201.09s)
--- PASS: TestAccAwsImageBuilderImage_ImageTestsConfiguration_ImageTestsEnabled (946.34s)
--- PASS: TestAccAwsImageBuilderImage_ImageTestsConfiguration_TimeoutMinutes (1329.30s)
--- PASS: TestAccAwsImageBuilderImage_Tags (1509.61s)
--- PASS: TestAccAwsImageBuilderImageDataSource_Arn_Aws (15.71s)
--- PASS: TestAccAwsImageBuilderImageDataSource_Arn_Self (1454.09s)
us-west-2
:
--- PASS: TestAccAwsImageBuilderImage_basic (1332.55s)
--- PASS: TestAccAwsImageBuilderImage_disappears (1326.32s)
--- PASS: TestAccAwsImageBuilderImage_DistributionConfigurationArn (1708.79s)
--- PASS: TestAccAwsImageBuilderImage_EnhancedImageMetadataEnabled (1201.35s)
--- PASS: TestAccAwsImageBuilderImage_ImageTestsConfiguration_ImageTestsEnabled (1075.90s)
--- PASS: TestAccAwsImageBuilderImage_ImageTestsConfiguration_TimeoutMinutes (1328.98s)
--- PASS: TestAccAwsImageBuilderImage_Tags (1246.17s)
--- PASS: TestAccAwsImageBuilderImageDataSource_Arn_Aws (12.57s)
--- PASS: TestAccAwsImageBuilderImageDataSource_Arn_Self (1459.51s)
// To prevent Terraform errors, only reset arn if not configured. | ||
// The configured ARN may contain x.x.x wildcards while the API returns | ||
// the full build version #.#.#/# suffix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccAwsImageBuilderImageDataSource_Arn_Aws(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func TestAccAwsImageBuilderImageDataSource_Arn_Aws(t *testing.T) { | |
func TestAccAwsImageBuilderImageDataSource_basic(t *testing.T) { |
I like the consistency of the data source having a "basic" test, but, it's up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To help understand the naming rationale here, I'll use a generic example. Data sources tend to have varying argument requirements that change over time, so defining what a "basic" test might be over time could be challenging. 😄
Say a data source currently requires an ARN argument. Later it is updated to make ARN optional and add an optional name argument. Which is "basic" now? Is there a "basic" test? It would feel odd to me to not update the original test name to differentiate what its trying to test and potentially hard to catch that during reviews. Rather than have this problem later on, seems like we can solve for it upfront by naming tests based on data source arguments. I think the only guaranteed "basic" case for a data source is when it can accept no arguments and it might be odd to name the test "_NoArguments" or something. Maybe it would not be odd though since its more explicit.
To be fair, we also have this problem for resources and "basic" tests being for "all required arguments", it is just much less likely to happen over time. I'll leave myself a note to update the acceptance testing documentation in some fashion for this topic, since its not defined well. Relatedly, at some point we need to make decisions on #13128, which may or may not be defined by the documentation update we can collaborate on. 😉
If you feel strongly that this should be defined in a specific manner, let's discuss further in a new issue or in the change request for the documentation. There is also #8223 floating around out there, which wouldn't necessarily cover these naming situations completely, but could materially change the problem.
} | ||
|
||
if err != nil { | ||
return fmt.Errorf("error getting Image Builder Image (%s): %w", rs.Primary.ID, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error getting Image Builder Image (%s): %w", rs.Primary.ID, err) | |
return fmt.Errorf("unable to get Image Builder Image (%s): %w", rs.Primary.ID, err) |
Nit. This would show up as Error: error getting...
which seems redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for raising this. Rather than leaving a lengthy comment that could be lost about the history of this, I have created #17314 with all the information. What is important right now is that fmt.Errorf("error creating/reading/updating/deleting Service Thing (ID): Error")
is the (finally now 😖 ) documented practice for consistency that's been the goal last few years, which is showing its age in Terraform 0.12 and later. I would rather continue the existing practice for later find/replace-ability until we can decide as a team on any potential new standards.
Please feel free to check that out issue and contribute!
_, err := conn.GetImage(input) | ||
|
||
if err != nil { | ||
return fmt.Errorf("error getting Image Builder Image (%s): %w", rs.Primary.ID, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error getting Image Builder Image (%s): %w", rs.Primary.ID, err) | |
return fmt.Errorf("unable to get Image Builder Image (%s): %w", rs.Primary.ID, err) |
output, err := conn.GetImage(input) | ||
|
||
if err != nil { | ||
return fmt.Errorf("error getting Image Builder Image: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error getting Image Builder Image: %w", err) | |
return fmt.Errorf("getting Image Builder Image: %w", err) |
Nit. error
doesn't add anything since Errorf()
adds Error:
. I think either drop error
or add more more description.
o, n := d.GetChange("tags") | ||
|
||
if err := keyvaluetags.ImagebuilderUpdateTags(conn, d.Id(), o, n); err != nil { | ||
return fmt.Errorf("error updating tags for Image Builder Image (%s): %w", d.Id(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error updating tags for Image Builder Image (%s): %w", d.Id(), err) | |
return fmt.Errorf("updating tags for Image Builder Image (%s): %w", d.Id(), err) |
} | ||
|
||
if err != nil { | ||
return fmt.Errorf("error deleting Image Builder Image (%s): %w", d.Id(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error deleting Image Builder Image (%s): %w", d.Id(), err) | |
return fmt.Errorf("deleting Image Builder Image (%s): %w", d.Id(), err) |
func testSweepImageBuilderImages(region string) error { | ||
client, err := sharedClientForRegion(region) | ||
if err != nil { | ||
return fmt.Errorf("error getting client: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("error getting client: %w", err) | |
return fmt.Errorf("getting client: %w", err) |
err := r.Delete(d, client) | ||
|
||
if err != nil { | ||
sweeperErr := fmt.Errorf("error deleting Image Builder Image (%s): %w", arn, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweeperErr := fmt.Errorf("error deleting Image Builder Image (%s): %w", arn, err) | |
sweeperErr := fmt.Errorf("deleting Image Builder Image (%s): %w", arn, err) |
} | ||
|
||
if err != nil { | ||
sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Image Builder Images: %w", err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing Image Builder Images: %w", err)) | |
sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("listing Image Builder Images: %w", err)) |
This has been released in version 3.26.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 for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Closes #16375
Closes #16377
Release note for CHANGELOG:
Output from acceptance testing in AWS Commercial:
Output from acceptance testing in AWS GovCloud (US):