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_device_fleet - new resource #20058

Merged
merged 11 commits into from
Aug 17, 2021

Conversation

DrFaust92
Copy link
Collaborator

@DrFaust92 DrFaust92 commented Jul 2, 2021

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

Relates OR Closes #0000

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSSagemakerDeviceFleet_'
--- PASS: TestAccAWSSagemakerDeviceFleet_disappears (66.25s)
--- PASS: TestAccAWSSagemakerDeviceFleet_basic (73.51s)
--- PASS: TestAccAWSSagemakerDeviceFleet_description (139.28s)
--- PASS: TestAccAWSSagemakerDeviceFleet_tags (219.07s)

@DrFaust92 DrFaust92 marked this pull request as draft July 2, 2021 14:44
@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. 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 Jul 2, 2021
@DrFaust92 DrFaust92 added the new-resource Introduces a new resource. label Jul 2, 2021
@github-actions github-actions bot added the size/XL Managed by automation to categorize the size of a PR. label Jul 2, 2021
@DrFaust92 DrFaust92 marked this pull request as ready for review July 3, 2021 21:53
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

I have a few comments so far

DeviceFleetName: aws.String(id),
}

output, err := conn.DescribeDeviceFleet(input)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeDeviceFleet.html, it looks like the API can return ResourceNotFound if the Device Fleet doesn't exist

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wasnt able to produce this error from tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved error check to finder


deviceFleet, err := finder.DeviceFleetByName(conn, d.Id())
if err != nil {
if isAWSErr(err, "ValidationException", "No devicefleet with name") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the ValidationException have a nested error that has a specific code? We'd like to reduce the number of places we check the error message, since AWS recommends not relying on it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

anyway i can verify this? (some common function the provider supports to check it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

from a few tests, doesnt seem like it.

aws/resource_aws_sagemaker_device_fleet.go Outdated Show resolved Hide resolved
website/docs/r/sagemaker_device_fleet.html.markdown Outdated Show resolved Hide resolved
@ewbankkit ewbankkit self-assigned this Aug 17, 2021
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 🚀.

Commercial
 % make testacc TESTARGS='-run=TestAccAWSSagemakerDeviceFleet_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSagemakerDeviceFleet_ -timeout 180m
=== RUN   TestAccAWSSagemakerDeviceFleet_basic
=== PAUSE TestAccAWSSagemakerDeviceFleet_basic
=== RUN   TestAccAWSSagemakerDeviceFleet_description
=== PAUSE TestAccAWSSagemakerDeviceFleet_description
=== RUN   TestAccAWSSagemakerDeviceFleet_tags
=== PAUSE TestAccAWSSagemakerDeviceFleet_tags
=== RUN   TestAccAWSSagemakerDeviceFleet_disappears
=== PAUSE TestAccAWSSagemakerDeviceFleet_disappears
=== CONT  TestAccAWSSagemakerDeviceFleet_basic
=== CONT  TestAccAWSSagemakerDeviceFleet_disappears
=== CONT  TestAccAWSSagemakerDeviceFleet_description
=== CONT  TestAccAWSSagemakerDeviceFleet_tags
--- PASS: TestAccAWSSagemakerDeviceFleet_basic (38.30s)
--- PASS: TestAccAWSSagemakerDeviceFleet_description (69.04s)
--- PASS: TestAccAWSSagemakerDeviceFleet_disappears (77.98s)
--- PASS: TestAccAWSSagemakerDeviceFleet_tags (171.97s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       176.062s
GovCloud
% make testacc TESTARGS='-run=TestAccAWSSagemakerDeviceFleet_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSSagemakerDeviceFleet_ -timeout 180m
=== RUN   TestAccAWSSagemakerDeviceFleet_basic
=== PAUSE TestAccAWSSagemakerDeviceFleet_basic
=== RUN   TestAccAWSSagemakerDeviceFleet_description
=== PAUSE TestAccAWSSagemakerDeviceFleet_description
=== RUN   TestAccAWSSagemakerDeviceFleet_tags
=== PAUSE TestAccAWSSagemakerDeviceFleet_tags
=== RUN   TestAccAWSSagemakerDeviceFleet_disappears
=== PAUSE TestAccAWSSagemakerDeviceFleet_disappears
=== CONT  TestAccAWSSagemakerDeviceFleet_basic
=== CONT  TestAccAWSSagemakerDeviceFleet_disappears
=== CONT  TestAccAWSSagemakerDeviceFleet_description
=== CONT  TestAccAWSSagemakerDeviceFleet_tags
=== CONT  TestAccAWSSagemakerDeviceFleet_basic
    provider_test.go:1166: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
        
        Error: Error attaching policy arn:aws-us-gov:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy to IAM Role tf-acc-test-2090968910314501706: NoSuchEntity: Policy arn:aws-us-gov:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy does not exist or is not attachable.
        	status code: 404, request id: e6327bde-ff83-4406-9993-c26085edc747
        
          with aws_iam_role_policy_attachment.test,
          on terraform_plugin_test.tf line 57, in resource "aws_iam_role_policy_attachment" "test":
          57: resource "aws_iam_role_policy_attachment" "test" {
        
        
        Error: error creating SageMaker Device Fleet tf-acc-test-2090968910314501706: UnknownOperationException: The requested operation is not supported in the called region.
        	status code: 400, request id: 815bca17-94f9-4cce-9f02-25d5fc140db5
        
          with aws_sagemaker_device_fleet.test,
          on terraform_plugin_test.tf line 62, in resource "aws_sagemaker_device_fleet" "test":
          62: resource "aws_sagemaker_device_fleet" "test" {
        
=== CONT  TestAccAWSSagemakerDeviceFleet_disappears
    provider_test.go:1166: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
        
        Error: Error attaching policy arn:aws-us-gov:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy to IAM Role tf-acc-test-62678035077255900: NoSuchEntity: Policy arn:aws-us-gov:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy does not exist or is not attachable.
        	status code: 404, request id: 953788f7-fd80-4fce-8baa-2f6613d19df7
        
          with aws_iam_role_policy_attachment.test,
          on terraform_plugin_test.tf line 57, in resource "aws_iam_role_policy_attachment" "test":
          57: resource "aws_iam_role_policy_attachment" "test" {
        
        
        Error: error creating SageMaker Device Fleet tf-acc-test-62678035077255900: UnknownOperationException: The requested operation is not supported in the called region.
        	status code: 400, request id: 8c8295f1-cbeb-4ca1-a805-da9ce148462a
        
          with aws_sagemaker_device_fleet.test,
          on terraform_plugin_test.tf line 62, in resource "aws_sagemaker_device_fleet" "test":
          62: resource "aws_sagemaker_device_fleet" "test" {
        
=== CONT  TestAccAWSSagemakerDeviceFleet_tags
    provider_test.go:1166: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
        
        Error: Error attaching policy arn:aws-us-gov:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy to IAM Role tf-acc-test-3903314069976798545: NoSuchEntity: Policy arn:aws-us-gov:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy does not exist or is not attachable.
        	status code: 404, request id: 47b7ec0d-87ad-4d90-abac-6d1c6a390079
        
          with aws_iam_role_policy_attachment.test,
          on terraform_plugin_test.tf line 57, in resource "aws_iam_role_policy_attachment" "test":
          57: resource "aws_iam_role_policy_attachment" "test" {
        
        
        Error: error creating SageMaker Device Fleet tf-acc-test-3903314069976798545: UnknownOperationException: The requested operation is not supported in the called region.
        	status code: 400, request id: 000e30fd-de9d-4ce1-b9de-4e95efc69d50
        
          with aws_sagemaker_device_fleet.test,
          on terraform_plugin_test.tf line 62, in resource "aws_sagemaker_device_fleet" "test":
          62: resource "aws_sagemaker_device_fleet" "test" {
        
--- SKIP: TestAccAWSSagemakerDeviceFleet_basic (19.51s)
--- SKIP: TestAccAWSSagemakerDeviceFleet_tags (19.52s)
--- SKIP: TestAccAWSSagemakerDeviceFleet_disappears (19.54s)
=== CONT  TestAccAWSSagemakerDeviceFleet_description
    provider_test.go:1166: skipping test for aws-us-gov/us-gov-west-1: Error running apply: exit status 1
        
        Error: Error attaching policy arn:aws-us-gov:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy to IAM Role tf-acc-test-6807235469790963240: NoSuchEntity: Policy arn:aws-us-gov:iam::aws:policy/service-role/AmazonSageMakerEdgeDeviceFleetPolicy does not exist or is not attachable.
        	status code: 404, request id: 39dd7028-c851-457e-bae4-13824e016587
        
          with aws_iam_role_policy_attachment.test,
          on terraform_plugin_test.tf line 57, in resource "aws_iam_role_policy_attachment" "test":
          57: resource "aws_iam_role_policy_attachment" "test" {
        
        
        Error: error creating SageMaker Device Fleet tf-acc-test-6807235469790963240: UnknownOperationException: The requested operation is not supported in the called region.
        	status code: 400, request id: 231cf23d-bd35-4462-be8e-408cad8fc9f5
        
          with aws_sagemaker_device_fleet.test,
          on terraform_plugin_test.tf line 62, in resource "aws_sagemaker_device_fleet" "test":
          62: resource "aws_sagemaker_device_fleet" "test" {
        
--- SKIP: TestAccAWSSagemakerDeviceFleet_description (25.27s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	28.316s

@ewbankkit
Copy link
Contributor

@DrFaust92 Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit removed their assignment Aug 17, 2021
@ewbankkit ewbankkit merged commit 1c69c66 into hashicorp:main Aug 17, 2021
@github-actions github-actions bot added this to the v3.55.0 milestone Aug 17, 2021
@DrFaust92 DrFaust92 deleted the r/sagemaker_device_fleet branch August 17, 2021 16:44
@github-actions
Copy link

This functionality has been released in v3.55.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. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2021
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