hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.86k stars 9.21k forks source link

[Bug]: Reverting to Sagemaker Studio Classic requires additional parameter #35504

Open greyes-trc opened 10 months ago

greyes-trc commented 10 months ago

Terraform Core Version

1.7.0

AWS Provider Version

5.30

Affected Resource(s)

*aws_sagemaker_domain

Expected Behavior

According to the AWS documentation all that is required to revert back to Sagemaker Studio Classic after updating to the new Sagemaker Studio is to set the parameter StudioWebPortal to 'DISABLED'. Setting this in terraform should revert back to the classic experience

Actual Behavior

Setting the StudioWebPortal parameter to 'DISABLED' causes the tf apply to fail with the error: Error: updating SageMaker Domain: ValidationException: StudioWebPortal is disabled for this domain/user.

Relevant Error/Panic Output Snippet

Plan: 0 to add, 1 to change, 0 to destroy.
Automatically approving plan
module.studio[0].aws_sagemaker_domain.sagemaker-domain: Modifying... [id=d-3yrlojp73d8j]

Error: updating SageMaker Domain: ValidationException: StudioWebPortal is disabled for this domain/user.
    status code: 400, request id: e4962ba1-c160-4780-a8c4-77cb43afd453

  with module.studio[0].aws_sagemaker_domain.sagemaker-domain,
  on modules/studio/domain.tf line 20, in resource "aws_sagemaker_domain" "sagemaker-domain":
  20: resource "aws_sagemaker_domain" "sagemaker-domain" {

Terraform Configuration Files

 resource "aws_sagemaker_domain" "this" {
   domain_name = "sagemaker-domain-test"
   auth_mode   = "IAM"
   vpc_id      = aws_vpc.test.id

   default_user_settings {
     execution_role = aws_iam_role.sagemaker-studio-role.arn     
     studio_web_portal = "DISABLED"  
   }
 }

Steps to Reproduce

  1. Deploy Studio Domain in classic mode (studio_web_portal disabled)
  2. Update studio domain to the new experience (set studio_web_portal 'ENABLED')
  3. Revert back to sagemaker studio classic (set studio_web_portal 'DISABLED')

Debug Output

No response

Panic Output

No response

Important Factoids

Providing the default_landing_uri to the correct parameter while disabling the studio_web_portal results in the expected behavior: default_landing_uri = "app:JupyterServer:"

References

https://docs.aws.amazon.com/sagemaker/latest/dg/studio-updated-migrate.html https://awscli.amazonaws.com/v2/documentation/api/latest/reference/sagemaker/update-domain.html

Would you like to implement a fix?

None

github-actions[bot] commented 10 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

brakf commented 10 months ago

Created the test case already #35505