-
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
New Resource: aws_sns_sms_preferences #3858
Conversation
Hello, I was wondering if anyone has had a chance to look at this PR? Any blocker or changes to be made? Any potential of it being merged soon? Thanks! |
Hello @lbrucher apologies for the delay. We are looking into several PR's and requests atm. Let me work on where we are and get back to you with something concrete. I'm the new PM for the project so I believe the slow down is my fault. |
|
||
const resourceId = "aws_sns_sms_id" | ||
|
||
var SMSAttributeMap = map[string]string{ |
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.
no need to export this I don't think? (same with the var below as well)
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.
Indeed, corrected
defaultSmsType := d.Get("default_sms_type").(string) | ||
usageReportS3Bucket := d.Get("usage_report_s3_bucket").(string) | ||
|
||
// Validation |
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.
Please move validation in to ValidateFunc
in the schema above like this: https://github.com/terraform-providers/terraform-provider-aws/blob/3f9a830038f20f819ba947e90770c50d470d164b/aws/resource_aws_s3_bucket.go#L249
(for these other validations as well, more validations available in the validation
package, int ranges, string in slice, etc)
|
||
Schema: map[string]*schema.Schema{ | ||
"monthly_spend_limit": { | ||
Type: schema.TypeString, |
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.
This probably should be a TypeInt
string so TF can do the proper type validation
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.
This is tricky because the AWS API treats all those attributes as Strings, including monthly spend limit and delivery sampling rate, and an empty string "" (not defined) is not the same as a "0" (explicit 0).
Using int values in TF won't allow us to distinguish between the 2 cases and will always set those values as "0" when retrieved as "", which would be incorrect.
}, | ||
|
||
"delivery_status_success_sampling_rate": { | ||
Type: schema.TypeString, |
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.
This probably should be a TypeInt
string so TF can do the proper type validation
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.
See above comment
@lbrucher appreciate this PR, this is pretty close, just some minor Terraform specific stuff to clean up I think. |
@paultyng thanks for the feedback, please see my comments above, thanks. |
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, thanks!
I'm seeing a bunch of test failures but they are likely from our testing being parallelized:
This will need to be adjusted on merge |
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.
Testing serialized and the destroy check function fixed in 0cbaba3
Passes acceptance testing now:
make testacc TEST=./aws TESTARGS='-run=TestAccAWSSNSSMSPreferences'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSSNSSMSPreferences -timeout 120m
=== RUN TestAccAWSSNSSMSPreferences
=== RUN TestAccAWSSNSSMSPreferences/almostAll
=== RUN TestAccAWSSNSSMSPreferences/defaultSMSType
=== RUN TestAccAWSSNSSMSPreferences/deliveryRole
=== RUN TestAccAWSSNSSMSPreferences/empty
--- PASS: TestAccAWSSNSSMSPreferences (40.16s)
--- PASS: TestAccAWSSNSSMSPreferences/almostAll (10.71s)
--- PASS: TestAccAWSSNSSMSPreferences/defaultSMSType (9.13s)
--- PASS: TestAccAWSSNSSMSPreferences/deliveryRole (10.78s)
--- PASS: TestAccAWSSNSSMSPreferences/empty (9.55s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 40.211s
This has been released in version 1.19.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
There is currently no way to set the SMS preferences in SNS from Terraform.
This PR is an attempt at providing this feature.