-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
resource/aws_ecs_service: Add public_assign_ip attribute and fix InvalidParameterException handling #3240
Conversation
…vider-aws into feature/fargate_support_v2
…orton/terraform-provider-aws into f-aws_ecs_service-assign_public_ip
… acceptance test assign_public_ip state and updates
…catching incorrect InvalidParameterException
Pulled in #3242 commits:
|
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.
If I'm not mistaken, we lose retry support on a possible eventually consistent part of a Service not yet being available via the API. Please confirm that's the intent and a little as to why, if possible.
Other than that, a documentation nit and 👍
log.Printf("[DEBUG] Trying to update ECS service again: %#v", err) | ||
return resource.RetryableError(err) | ||
} | ||
if ok && awsErr.Code() == "ServiceNotFoundException" { |
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.
Here we're losing the retry on ServiceNotFoundException
, is that intentional?
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.
@catsby Interestingly enough, I had just assumed it was some sort of typo that it was included and that retrying on a missing service would be undesirable during an update, but turns out we are currently always calling resourceAwsEcsServiceUpdate
at the end of resourceAwsEcsServiceCreate
. So that explains why it was in there.
Looking through the parameters set during resourceAwsEcsServiceUpdate
to ecs.UpdateServiceInput
, I don't see anything not already handled by resourceAwsEcsServiceCreate
so I think we should instead return resourceAwsEcsServiceRead
at the end of resourceAwsEcsServiceCreate
and keep the ecs.ErrCodeServiceNotFoundException
retry logic out of resourceAwsEcsServiceUpdate
.
Does that sound reasonable?
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.
@bflad that sounds like a good idea - as long as all ECS tests still pass 🤷♂️
@@ -102,6 +102,7 @@ Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query | |||
|
|||
* `subnets` - (Required) The subnets associated with the task or service. | |||
* `security_groups` - (Optional) The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. | |||
* `assign_public_ip` - (Optional) Only valid for `FARGATE` launch type and valid values are `true` or `false`. Will assign a public IP address to the ENI. Default value is `false`. |
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.
Suggest reword to "Assign a public IP address to the ENI (Fargate
launch type only). Valid values are true
or false
. Default false
." or similar
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.
Done! 👍
if awsErr.Code() == "ClusterNotFoundException" { | ||
log.Printf("[DEBUG] Trying to create ECS service again: %q", | ||
awsErr.Message()) | ||
if isAWSErr(err, ecs.ErrCodeInvalidParameterException, "Please verify that the ECS service role being passed has the proper permissions.") { |
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 trust you that you ran all ECS related acceptance tests a couple of times to verify that we're not missing any other message/format here. 😃
log.Printf("[DEBUG] Trying to update ECS service again: %#v", err) | ||
return resource.RetryableError(err) | ||
} | ||
if ok && awsErr.Code() == "ServiceNotFoundException" { |
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.
@bflad that sounds like a good idea - as long as all ECS tests still pass 🤷♂️
@@ -9,7 +9,6 @@ import ( | |||
"time" | |||
|
|||
"github.com/aws/aws-sdk-go/aws" | |||
"github.com/aws/aws-sdk-go/aws/awserr" |
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.
❤️
sg1Name, sg2Name, clusterName, tdName, svcName, | ||
`"${aws_security_group.allow_all_a.id}"`, | ||
) | ||
} |
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.
Passing parts of HCL is a little bit confusing at first I have to say... sometimes duplication is just better than abstraction, IMO.
…otFound for new resources
@radeksimko sorry for the delayed response, all tests are passing. I'll run them a few more times to be certain. 🎉
|
This has been released in terraform-provider-aws version 1.9.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
* commit '5293a0e3b1366ee16d8742b9b2354781a79bfbd9': (224 commits) v1.9.0 Update CHANGELOG for hashicorp#1101 and hashicorp#3283 docs/resource/aws_sns_platform_application: Add note about platform_credential and platform_principal hashing resource/aws_sns_platform_application: Refactor ID parsing to its own function, use testing.T in testAccAwsSnsPlatformApplicationPlatformFromEnv Add lambda example (hashicorp#3168) Update CHANGELOG for hashicorp#3157 docs/data-source/aws_region: Remove now deprecated current argument data-source/aws_region: Refactor logic into findRegionByEc2Endpoint and findRegionByName functions Update CHANGELOG for hashicorp#3301 Update CHANGELOG for hashicorp#2559 and hashicorp#3240 Update CHANGELOG.md resource/aws_kinesis_stream: Retry deletion on LimitExceededException (hashicorp#3108) Update CHANGELOG.md resource/aws_dynamodb_table_item: Cleanup + add missing bits Added dynamodb_table_item resource hashicorp#517 Update CHANGELOG.md New Resource: aws_cloud9_environment_ec2 Update CHANGELOG.md Fixed markdown typo in docs resource/aws_kinesis_firehose_delivery_stream: Prevent crashes on empty CloudWatchLoggingOptions and fix extended_s3_configuration kms_key_arn ... # Conflicts: # aws/validators.go
…parameters-features * commit '5293a0e3b1366ee16d8742b9b2354781a79bfbd9': (752 commits) v1.9.0 Update CHANGELOG for hashicorp#1101 and hashicorp#3283 docs/resource/aws_sns_platform_application: Add note about platform_credential and platform_principal hashing resource/aws_sns_platform_application: Refactor ID parsing to its own function, use testing.T in testAccAwsSnsPlatformApplicationPlatformFromEnv Add lambda example (hashicorp#3168) Update CHANGELOG for hashicorp#3157 docs/data-source/aws_region: Remove now deprecated current argument data-source/aws_region: Refactor logic into findRegionByEc2Endpoint and findRegionByName functions Update CHANGELOG for hashicorp#3301 Update CHANGELOG for hashicorp#2559 and hashicorp#3240 Update CHANGELOG.md resource/aws_kinesis_stream: Retry deletion on LimitExceededException (hashicorp#3108) Update CHANGELOG.md resource/aws_dynamodb_table_item: Cleanup + add missing bits Added dynamodb_table_item resource hashicorp#517 Update CHANGELOG.md New Resource: aws_cloud9_environment_ec2 Update CHANGELOG.md Fixed markdown typo in docs resource/aws_kinesis_firehose_delivery_stream: Prevent crashes on empty CloudWatchLoggingOptions and fix extended_s3_configuration kms_key_arn ... # Conflicts: # aws/resource_aws_ssm_parameter_test.go
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! |
Fixes #85
Closes #2873
Closes #3098
This PR is a continuation of #2559, including crash prevention for
nil
AssignPublicIp
and testing fixes for that PR. While trying to run and fix the acceptance testing, I was having major trouble with the incorrect retry logic that was noted in #85 so fixed that as well on top of the original PR.