[Bug]: aws_sns_sms_preferences.monthly_spend_limit perpetual diff when set to 0 #31525
Open
Description
Terraform Core Version
1.4.5
AWS Provider Version
4.64.0
Affected Resource(s)
- aws_sns_sms_preferences
Expected Behavior
Monthly spend limit set to 0 and no perpetual diff
Actual Behavior
When monthly spend limit is set to 0, it appears correctly in AWS console and CLI, but perpetually diffs back to 1 in the terraform resource
Relevant Error/Panic Output Snippet
... [REDACTED FOR BREVITY]
Terraform will perform the following actions:
# module.account.module.sns_sms_preferences.aws_sns_sms_preferences.this will be updated in-place
~ resource "aws_sns_sms_preferences" "this" {
id = "aws_sns_sms_id"
~ monthly_spend_limit = 1 -> 0
# (2 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.account.module.sns_sms_preferences.aws_sns_sms_preferences.this: Modifying... [id=aws_sns_sms_id]
module.account.module.sns_sms_preferences.aws_sns_sms_preferences.this: Modifications complete after 0s [id=aws_sns_sms_id]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
(.venv) Eimantas@Eimantas-Gecass-MacBook-Pro infrastructure % aws --profile staging/sandbox-oak/admin sns get-sms-attributes --region eu-west-2
{
"attributes": {
"DeliveryStatusSuccessSamplingRate": "0",
"DeliveryStatusIAMRole": "arn:aws:iam::616164340215:role/SNSSuccessFeedback",
"DefaultSMSType": "Promotional",
"MonthlySpendLimit": "0"
}
}
(.venv) Eimantas@Eimantas-Gecass-MacBook-Pro infrastructure % terraform -chdir=stacks/staging/aws/management/account-sandbox-oak plan
... [REDACTED FOR BREVITY]
Note: Objects have changed outside of Terraform
Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan:
# module.account.module.sns_sms_preferences.aws_sns_sms_preferences.this has changed
~ resource "aws_sns_sms_preferences" "this" {
id = "aws_sns_sms_id"
~ monthly_spend_limit = 0 -> 1
# (2 unchanged attributes hidden)
}
Unless you have made equivalent changes to your configuration, or ignored the
relevant attributes using ignore_changes, the following plan may include
actions to undo or respond to these changes.
─────────────────────────────────────────────────────────────────────────────
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# module.account.module.sns_sms_preferences.aws_sns_sms_preferences.this will be updated in-place
~ resource "aws_sns_sms_preferences" "this" {
id = "aws_sns_sms_id"
~ monthly_spend_limit = 1 -> 0
# (2 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Terraform Configuration Files
resource "aws_sns_sms_preferences" "this" { monthly_spend_limit = 0 }
Steps to Reproduce
terraform init
terraform apply
terraform plan
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None