Skip to content

r/aws_sagemaker_image_version: read correct version after create #42536

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

Merged
merged 1 commit into from
May 12, 2025

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented May 8, 2025

Description

Previously the read operation would always retrieve the latest image version matching the image_name argument, rather than tracking the version created by a given resource instance. This change updates the id attribute to a comma-delimited string concatenating image_name and version, enabling subsequent read operations to correctly match the version created by this resource, and supporting import of existing versions which are not the most recently created. It also fixes issues observed when managing multiple image versions of the same name in a single workspace.

Relations

Closes #40597
Relates #41101

Output from Acceptance Testing

% SAGEMAKER_IMAGE_VERSION_BASE_IMAGE="<redacted>" make testacc PKG=sagemaker TESTS=TestAccSageMakerImageVersion_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.8 test ./internal/service/sagemaker/... -v -count 1 -parallel 20 -run='TestAccSageMakerImageVersion_'  -timeout 360m -vet=off
2025/05/08 10:39:43 Initializing Terraform AWS Provider...

--- PASS: TestAccSageMakerImageVersion_Disappears_image (80.09s)
--- PASS: TestAccSageMakerImageVersion_basic (82.82s)
--- PASS: TestAccSageMakerImageVersion_disappears (84.49s)
--- PASS: TestAccSageMakerImageVersion_multiple (88.17s)
--- PASS: TestAccSageMakerImageVersion_update (91.47s)
--- PASS: TestAccSageMakerImageVersion_upgrade_V5_98_0 (102.47s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sagemaker  108.081s

Copy link

github-actions bot commented May 8, 2025

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

Copy link

github-actions bot commented May 8, 2025

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@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/sagemaker Issues and PRs that pertain to the sagemaker service. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. size/XL Managed by automation to categorize the size of a PR. and removed prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels May 8, 2025
@jar-b jar-b force-pushed the b-sagemaker_image_version-id-v6 branch from 068bbdf to b371036 Compare May 8, 2025 17:39
Previously the read operation would always retrieve the latest image version matching the `image_name` argument, rather than tracking the version created by a given resource instance. This change updates the `id` attribute to a comma-delimited string concatenating `image_name` and `version`, enabling subsequent read operations to correctly match the version created by this resource, and supporting import of existing versions which are not the most recently created. It also fixes issues observed when managing multiple image versions of the same name in a single workspace.

```console
% SAGEMAKER_IMAGE_VERSION_BASE_IMAGE="<redacted>" make testacc PKG=sagemaker TESTS=TestAccSageMakerImageVersion_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.8 test ./internal/service/sagemaker/... -v -count 1 -parallel 20 -run='TestAccSageMakerImageVersion_'  -timeout 360m -vet=off
2025/05/08 10:39:43 Initializing Terraform AWS Provider...

--- PASS: TestAccSageMakerImageVersion_Disappears_image (80.09s)
--- PASS: TestAccSageMakerImageVersion_basic (82.82s)
--- PASS: TestAccSageMakerImageVersion_disappears (84.49s)
--- PASS: TestAccSageMakerImageVersion_multiple (88.17s)
--- PASS: TestAccSageMakerImageVersion_update (91.47s)
--- PASS: TestAccSageMakerImageVersion_upgrade_V5_98_0 (102.47s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sagemaker  108.081s
```
@jar-b jar-b force-pushed the b-sagemaker_image_version-id-v6 branch from b371036 to 7b86ead Compare May 8, 2025 17:57
@jar-b jar-b added bug Addresses a defect in current functionality. breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. labels May 8, 2025
@jar-b jar-b marked this pull request as ready for review May 8, 2025 18:39
@jar-b jar-b requested a review from a team as a code owner May 8, 2025 18:39
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 🚀.

% SAGEMAKER_IMAGE_VERSION_BASE_IMAGE=... make testacc TESTARGS='-run=TestAccSageMakerImageVersion_' PKG=sagemaker ACCTEST_PARALLELISM=3 
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.2 test ./internal/service/sagemaker/... -v -count 1 -parallel 3  -run=TestAccSageMakerImageVersion_ -timeout 360m -vet=off
2025/05/12 11:59:41 Creating Terraform AWS Provider (SDKv2-style)...
2025/05/12 11:59:41 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccSageMakerImageVersion_basic
=== PAUSE TestAccSageMakerImageVersion_basic
=== RUN   TestAccSageMakerImageVersion_update
=== PAUSE TestAccSageMakerImageVersion_update
=== RUN   TestAccSageMakerImageVersion_disappears
=== PAUSE TestAccSageMakerImageVersion_disappears
=== RUN   TestAccSageMakerImageVersion_Disappears_image
=== PAUSE TestAccSageMakerImageVersion_Disappears_image
=== RUN   TestAccSageMakerImageVersion_multiple
=== PAUSE TestAccSageMakerImageVersion_multiple
=== RUN   TestAccSageMakerImageVersion_upgrade_V5_98_0
=== PAUSE TestAccSageMakerImageVersion_upgrade_V5_98_0
=== CONT  TestAccSageMakerImageVersion_basic
=== CONT  TestAccSageMakerImageVersion_Disappears_image
=== CONT  TestAccSageMakerImageVersion_disappears
--- PASS: TestAccSageMakerImageVersion_disappears (77.47s)
=== CONT  TestAccSageMakerImageVersion_update
--- PASS: TestAccSageMakerImageVersion_basic (79.39s)
=== CONT  TestAccSageMakerImageVersion_upgrade_V5_98_0
--- PASS: TestAccSageMakerImageVersion_Disappears_image (79.95s)
=== CONT  TestAccSageMakerImageVersion_multiple
--- PASS: TestAccSageMakerImageVersion_multiple (81.79s)
--- PASS: TestAccSageMakerImageVersion_update (88.92s)
--- PASS: TestAccSageMakerImageVersion_upgrade_V5_98_0 (111.13s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/sagemaker	195.041s

@jar-b jar-b merged commit 2fb203b into release/6.0.0-beta May 12, 2025
51 checks passed
@jar-b jar-b deleted the b-sagemaker_image_version-id-v6 branch May 12, 2025 17:18
Copy link

Warning

This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@psantus
Copy link
Contributor

psantus commented May 14, 2025

@jar-b any way you could backport this to a 5.x version? I need it fast for a customer project !

@jar-b
Copy link
Member Author

jar-b commented May 14, 2025

Unfortunately not. In this case we explicitly opted to make this change in a major version given the breakage in the format of the id attribute. Backporting would result in that breakage being present across a V5 minor version.

Depending on how quickly this fix is required you could use the next V6 beta (v6.0.0-beta2, currently slated for release on 5/22), or build directly from source using the release/6.0.0-beta branch and set up provider development overrides until a formal release is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. bug Addresses a defect in current functionality. documentation Introduces or discusses updates to documentation. service/sagemaker Issues and PRs that pertain to the sagemaker service. size/XL 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.

3 participants