terraform-provider-awscc icon indicating copy to clipboard operation
terraform-provider-awscc copied to clipboard

awscc_sns_queue_inline_policy resource fails on apply with Invalid Parameter Error

Open alex-torres1980 opened this issue 1 year ago • 1 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Terraform CLI and Terraform AWS Cloud Control Provider Version

Terraform v1.5.5

Affected Resource(s)

awscc_sns_topic_inline_policy

Terraform Configuration Files

provider.tf terraform { required_providers { aws = { source = "hashicorp/aws" } awscc = { source = "hashicorp/awscc" } } }

provider "aws" { region = "us-west-2" }

provider "awscc" { region = "us-west-2" }

main.tf variable "json_input" { type = map(string) default = { Policy = <<EOT { "Version": "2008-10-17", "Id": "__default_policy_ID", "Statement": [ { "Sid": "__default_statement_ID", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": [ "SNS:GetTopicAttributes", "SNS:SetTopicAttributes", "SNS:AddPermission", "SNS:RemovePermission", "SNS:DeleteTopic", "SNS:Subscribe", "SNS:ListSubscriptionsByTopic", "SNS:Publish" ], "Resource": "arn:aws:sns:us-west-2:537827199935:myterraformtopic01", "Condition": { "StringEquals": { "AWS:SourceOwner": "537827199935" } } } ] }

EOT

} }

resource "awscc_sns_topic_inline_policy" "awspolicy" { topic_arn = "arn:aws:sns:us-west-2:537827199935:myterraformtopic01" policy_document = var.json_input }

Expected Behavior

SNS inline policy should be created and attached to the SNS

Actual Behavior

Error: AWS SDK Go Service Operation Incomplete │ │ with awscc_sns_topic_inline_policy.awspolicy, │ on main.tf line 40, in resource "awscc_sns_topic_inline_policy" "awspolicy": │ 40: resource "awscc_sns_topic_inline_policy" "awspolicy" { │ │ Waiting for Cloud Control API service CreateResource operation completion returned: waiter state transitioned to FAILED. StatusMessage: Invalid parameter: Policy Error: null │ (Service: Sns, Status Code: 400, Request ID: 220fd155-8c7c-54ef-aa01-8c2cc85bf901). ErrorCode: InvalidRequest

Steps to Reproduce

  1. terraform apply

Important Factoids

No

Possible Cause the parameter policy_document is defined as (Map of String [policy_document](https://registry.terraform.io/providers/hashicorp/awscc/latest/docs/resources/sqs_queue_inline_policy #policy_document) (Map of String) A policy document that contains permissions to add to the specified SQS queue

alex-torres1980 avatar Sep 11 '23 16:09 alex-torres1980

relates to #514

wellsiau-aws avatar Sep 11 '23 22:09 wellsiau-aws