-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
r/sagemaker_device_fleet - new resource #20058
Conversation
There was a problem hiding this 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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
c6d939e
to
d883267
Compare
d883267
to
5266ccb
Compare
There was a problem hiding this 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
@DrFaust92 Thanks for the contribution 🎉 👏. |
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! |
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. |
Community Note
Relates OR Closes #0000
Output from acceptance testing: