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/sagemaker_image - new resource #16082

Merged
merged 14 commits into from
Jan 4, 2021

Conversation

DrFaust92
Copy link
Collaborator

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

Release note for CHANGELOG:

resource_aws_sagemaker_image - new resource

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSSagemakerImage_'
--- PASS: TestAccAWSSagemakerImage_disappears (49.65s)
--- PASS: TestAccAWSSagemakerImage_basic (51.46s)
--- PASS: TestAccAWSSagemakerImage_displayName (109.36s)
--- PASS: TestAccAWSSagemakerImage_description (109.65s)
--- PASS: TestAccAWSSagemakerImage_tags (115.33s)

@DrFaust92 DrFaust92 requested a review from a team as a code owner November 8, 2020 17:37
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. service/sagemaker Issues and PRs that pertain to the sagemaker service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 8, 2020
@DrFaust92 DrFaust92 added the new-resource Introduces a new resource. label Nov 8, 2020
@ewbankkit
Copy link
Contributor

ewbankkit commented Nov 10, 2020

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSSagemakerImage_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSagemakerImage_ -timeout 120m
=== RUN   TestAccAWSSagemakerImage_basic
=== PAUSE TestAccAWSSagemakerImage_basic
=== RUN   TestAccAWSSagemakerImage_description
=== PAUSE TestAccAWSSagemakerImage_description
=== RUN   TestAccAWSSagemakerImage_displayName
=== PAUSE TestAccAWSSagemakerImage_displayName
=== RUN   TestAccAWSSagemakerImage_tags
=== PAUSE TestAccAWSSagemakerImage_tags
=== RUN   TestAccAWSSagemakerImage_disappears
=== PAUSE TestAccAWSSagemakerImage_disappears
=== CONT  TestAccAWSSagemakerImage_basic
=== CONT  TestAccAWSSagemakerImage_disappears
=== CONT  TestAccAWSSagemakerImage_tags
=== CONT  TestAccAWSSagemakerImage_displayName
=== CONT  TestAccAWSSagemakerImage_description
    resource_aws_sagemaker_image_test.go:94: Step 1/4 error: Error running apply: 2020/11/10 13:03:45 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.10.0
        
        Error: error waiting for SageMaker Image (tf-acc-test-6701078467973104332) to create: unexpected state 'CREATE_FAILED', wanted target 'CREATED'. last error: %!s(<nil>)
        
        
=== CONT  TestAccAWSSagemakerImage_basic
    resource_aws_sagemaker_image_test.go:65: Step 1/2 error: Error running apply: 2020/11/10 13:03:46 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.10.0
        
        Error: error waiting for SageMaker Image (tf-acc-test-633219264484407602) to create: unexpected state 'CREATE_FAILED', wanted target 'CREATED'. last error: %!s(<nil>)
        
        
=== CONT  TestAccAWSSagemakerImage_tags
    resource_aws_sagemaker_image_test.go:174: Step 1/4 error: Error running apply: 2020/11/10 13:03:46 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.10.0
        
        Error: error waiting for SageMaker Image (tf-acc-test-1768421131957399270) to create: unexpected state 'CREATE_FAILED', wanted target 'CREATED'. last error: %!s(<nil>)
        
        
=== CONT  TestAccAWSSagemakerImage_displayName
    resource_aws_sagemaker_image_test.go:134: Step 1/4 error: Error running apply: 2020/11/10 13:03:45 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.10.0
        
        Error: error waiting for SageMaker Image (tf-acc-test-3019142710389142362) to create: unexpected state 'CREATE_FAILED', wanted target 'CREATED'. last error: %!s(<nil>)
        
        
=== CONT  TestAccAWSSagemakerImage_disappears
    resource_aws_sagemaker_image_test.go:218: Step 1/1 error: Error running apply: 2020/11/10 13:03:46 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.10.0
        
        Error: error waiting for SageMaker Image (tf-acc-test-8203763318322771741) to create: unexpected state 'CREATE_FAILED', wanted target 'CREATED'. last error: %!s(<nil>)
        
        
--- FAIL: TestAccAWSSagemakerImage_basic (12.83s)
--- FAIL: TestAccAWSSagemakerImage_disappears (12.83s)
--- FAIL: TestAccAWSSagemakerImage_description (13.25s)
--- FAIL: TestAccAWSSagemakerImage_tags (13.33s)
--- FAIL: TestAccAWSSagemakerImage_displayName (13.40s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	13.461s
FAIL
GNUmakefile:27: recipe for target 'testacc' failed
make: *** [testacc] Error 1

I assume some pre-requisite is missing.

At the API level the error is:

2020/11/11 12:18:48 [DEBUG] [aws-sdk-go] {"CreationTime":1.605115128947E9,"FailureReason":"Unable to assume role with RoleArn arn:aws:iam::123456789012:role/tf-acc-test-2210669117225200885","ImageArn":"arn:aws:sagemaker:us-west-2:123456789012:image/tf-acc-test-2210669117225200885","ImageName":"tf-acc-test-2210669117225200885","ImageStatus":"CREATE_FAILED","LastModifiedTime":1.605115129187E9,"RoleArn":"arn:aws:iam::123456789012:role/tf-acc-test-2210669117225200885"}

It's an IAM eventual consistency error. If I create the role, wait a few seconds and then create the SageMaker image, all is good.
Maybe in the waiter, retry if you get that IAM error?

@DrFaust92
Copy link
Collaborator Author

Didn't get this before. now getting this constantly. I tried to retry but same result. will take a look again

@DrFaust92
Copy link
Collaborator Author

So this is not as much as eventual consistency but having the right policy, ill leave a retry logic in place in any case and update docs on what is needed. AWS docs are not super clear but if you create a role via the Sagemaker console it adds a custom policy to read from some sagemaker buckets

@DrFaust92
Copy link
Collaborator Author

Ok, so this is even more annoying, sleeping before create solve it. simply retrying create (even for 10 mins) returns the same error (like its caching it on the backend?) and role can technically be passed as an update arguement but it never really updates it.

tests from latest changes

--- PASS: TestAccAWSSagemakerImage_disappears (98.66s)
--- PASS: TestAccAWSSagemakerImage_basic (117.88s)
--- PASS: TestAccAWSSagemakerImage_tags (164.56s)
--- PASS: TestAccAWSSagemakerImage_displayName (171.01s)
--- PASS: TestAccAWSSagemakerImage_description (173.37s)

DrFaust92 and others added 11 commits December 6, 2020 21:07
@ghost ghost added the documentation Introduces or discusses updates to documentation. label Dec 6, 2020
@DrFaust92
Copy link
Collaborator Author

--- PASS: TestAccAWSSagemakerImage_disappears (100.42s)
--- PASS: TestAccAWSSagemakerImage_basic (118.25s)
--- PASS: TestAccAWSSagemakerImage_description (168.05s)
--- PASS: TestAccAWSSagemakerImage_displayName (168.89s)
--- PASS: TestAccAWSSagemakerImage_tags (172.61s)

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 TEST=./aws/ TESTARGS='-run=TestAccAWSSagemakerImage_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSagemakerImage_ -timeout 120m
=== RUN   TestAccAWSSagemakerImage_basic
=== PAUSE TestAccAWSSagemakerImage_basic
=== RUN   TestAccAWSSagemakerImage_description
=== PAUSE TestAccAWSSagemakerImage_description
=== RUN   TestAccAWSSagemakerImage_displayName
=== PAUSE TestAccAWSSagemakerImage_displayName
=== RUN   TestAccAWSSagemakerImage_tags
=== PAUSE TestAccAWSSagemakerImage_tags
=== RUN   TestAccAWSSagemakerImage_disappears
=== PAUSE TestAccAWSSagemakerImage_disappears
=== CONT  TestAccAWSSagemakerImage_basic
=== CONT  TestAccAWSSagemakerImage_tags
=== CONT  TestAccAWSSagemakerImage_disappears
=== CONT  TestAccAWSSagemakerImage_displayName
=== CONT  TestAccAWSSagemakerImage_description
--- PASS: TestAccAWSSagemakerImage_disappears (80.67s)
--- PASS: TestAccAWSSagemakerImage_basic (81.45s)
--- PASS: TestAccAWSSagemakerImage_description (103.85s)
--- PASS: TestAccAWSSagemakerImage_tags (108.45s)
--- PASS: TestAccAWSSagemakerImage_displayName (110.23s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	110.319s

@breathingdust
Copy link
Member

LGTM 🚀 Thanks @DrFaust92

Verified Acceptance Tests in Commercial (us-west-2)

make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSSagemakerImage_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSagemakerImage_ -timeout 120m
=== RUN   TestAccAWSSagemakerImage_basic
=== PAUSE TestAccAWSSagemakerImage_basic
=== RUN   TestAccAWSSagemakerImage_description
=== PAUSE TestAccAWSSagemakerImage_description
=== RUN   TestAccAWSSagemakerImage_displayName
=== PAUSE TestAccAWSSagemakerImage_displayName
=== RUN   TestAccAWSSagemakerImage_tags
=== PAUSE TestAccAWSSagemakerImage_tags
=== RUN   TestAccAWSSagemakerImage_disappears
=== PAUSE TestAccAWSSagemakerImage_disappears
=== CONT  TestAccAWSSagemakerImage_basic
=== CONT  TestAccAWSSagemakerImage_tags
=== CONT  TestAccAWSSagemakerImage_disappears
=== CONT  TestAccAWSSagemakerImage_displayName
=== CONT  TestAccAWSSagemakerImage_description
--- PASS: TestAccAWSSagemakerImage_disappears (76.16s)
--- PASS: TestAccAWSSagemakerImage_basic (78.60s)
--- PASS: TestAccAWSSagemakerImage_description (98.61s)
--- PASS: TestAccAWSSagemakerImage_tags (99.68s)
--- PASS: TestAccAWSSagemakerImage_displayName (101.98s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	103.869s

Note that this resource is part of SageMaker Studio which is not available in GovCloud. This will require work to skip these tests when run in that region. This is tracked here: #16968

@breathingdust breathingdust merged commit 93e900c into hashicorp:master Jan 4, 2021
breathingdust added a commit that referenced this pull request Jan 5, 2021
@breathingdust breathingdust added this to the v3.23.0 milestone Jan 7, 2021
@ghost
Copy link

ghost commented Jan 8, 2021

This has been released in version 3.23.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!

@ghost
Copy link

ghost commented Feb 4, 2021

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!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 4, 2021
@DrFaust92 DrFaust92 deleted the r/sagemaker_image branch April 15, 2021 10:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. 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