Skip to content

aws_sagemaker_app_image_config: have at least one jupyterlab, codeeditor or kernel gateway config block, and push them even if empty fixes #37766 #40493 #42753

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

Open
wants to merge 4 commits into
base: release/6.0.0-beta
Choose a base branch
from

Conversation

psantus
Copy link
Contributor

@psantus psantus commented May 23, 2025

Description

It is currently possible to push an empty aws_sagemaker_app_image_config, which is meaningless and leads to spaces not starting properly.

Users trying to add an empty jupyter_lab_image_config found it was not pushed to the API, and had to uses a trick/workaround, by embedding a unrequired container_config subblock

This PR fixes both behaviours.

Relations

Closes #37766
Closes #40493

Output from Acceptance Testing

Nota : tests relying on illegal resources (aws_sagemaker_app_image_config without either jupyter_lab_image_config, code_editor_app_image_config, or `kernel_gateway_image_config) were removed.

% go test -v ./internal/service/sagemaker -run=TestAccSageMakerAppImageConfig

2025/05/24 00:51:50 Creating Terraform AWS Provider (SDKv2-style)...
2025/05/24 00:51:50 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccSageMakerAppImageConfig_KernelGatewayImage_kernelSpecs
=== PAUSE TestAccSageMakerAppImageConfig_KernelGatewayImage_kernelSpecs
=== RUN   TestAccSageMakerAppImageConfig_KernelGatewayImage_fileSystem
=== PAUSE TestAccSageMakerAppImageConfig_KernelGatewayImage_fileSystem
=== RUN   TestAccSageMakerAppImageConfig_CodeEditor
=== PAUSE TestAccSageMakerAppImageConfig_CodeEditor
=== RUN   TestAccSageMakerAppImageConfig_JupyterLab
=== PAUSE TestAccSageMakerAppImageConfig_JupyterLab
=== RUN   TestAccSageMakerAppImageConfig_tags
--- PASS: TestAccSageMakerAppImageConfig_tags (53.94s)
=== CONT  TestAccSageMakerAppImageConfig_KernelGatewayImage_kernelSpecs
=== CONT  TestAccSageMakerAppImageConfig_CodeEditor
=== CONT  TestAccSageMakerAppImageConfig_JupyterLab
=== CONT  TestAccSageMakerAppImageConfig_KernelGatewayImage_fileSystem
--- PASS: TestAccSageMakerAppImageConfig_KernelGatewayImage_fileSystem (38.86s)
--- PASS: TestAccSageMakerAppImageConfig_KernelGatewayImage_kernelSpecs (38.89s)
--- PASS: TestAccSageMakerAppImageConfig_JupyterLab (41.16s)
--- PASS: TestAccSageMakerAppImageConfig_CodeEditor (41.17s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sagemaker  99.182s

...

Copy link

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.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. 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. size/L Managed by automation to categorize the size of a PR. labels May 23, 2025
@psantus psantus marked this pull request as ready for review May 24, 2025 12:16
@psantus psantus requested a review from a team as a code owner May 24, 2025 12:16
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ConflictsWith: []string{"jupyter_lab_image_config", "kernel_gateway_image_config"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we try AtLeastOneOf instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line you commented would rather be AtMostOneOf.. (ConflictsWith is used this way for example in the Firehose data stream resource)

The AtLeastOneOf part is L41-45... but AFAIK that only applies for blocks argument, not top-level blocks. For those I saw somewhere that done out of the schema, in a validator..

In short, many options, not sure there is a definite best practice here?

@psantus psantus requested a review from DrFaust92 May 28, 2025 15:19
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 28, 2025
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/sagemaker Issues and PRs that pertain to the sagemaker service. size/L 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