-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Open
Labels
bugAddresses a defect in current functionality.Addresses a defect in current functionality.service/iamIssues and PRs that pertain to the iam service.Issues and PRs that pertain to the iam service.service/snsIssues and PRs that pertain to the sns service.Issues and PRs that pertain to the sns service.
Description
Terraform Core Version
1.5.7
AWS Provider Version
5.10.0
Affected Resource(s)
- aws_sns_topic
Expected Behavior
A broken policy should have been retrieved from AWS without causing the plan to fail
Actual Behavior
The Terraform run failed with an error when preparing the plan
Relevant Error/Panic Output Snippet
Error: reading SNS Topic (arn:...): contains invalid principals
Terraform Configuration Files
# This has been hand-copied from a restricted environment I can't copy & paste from
# It might have a few silly errors but hopefully is still useful
resource "aws_iam_role" "role" {
name = "role"
}
resource "aws_sns_topic" "topic" {
name = "mytopic"
display_name = "mytopic"
}
resource "aws_sns_topic_policy" "policy" {
arn = aws_sns_topic.topic.arn
policy = jsonencode({
Id = "topic-policy"
Statement = [{
Sid = "sid"
Action = "sns:Subscribe"
Effect = "Allow"
Principal = {
AWS = aws_iam_role.role.arn
}
Resource = aws_sns_topic.topic.arn
]})
}
Steps to Reproduce
This is an approximation of what I was doing to trigger the issue
terraform apply
terraform -target aws_sns_topic.topic plan # Expect to succeed
terraform -target aws_iam_role.role destroy
terraform -target aws_sns_topic.topic plan # Expect to fail when reading the existing topic policy
terraform -target aws_iam_role.role apply
terraform -target aws_sns_topic.topic plan # Expect to fail when reading the existing topic policy
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None
kumarpmd, evankellogg and ekoerner
Metadata
Metadata
Assignees
Labels
bugAddresses a defect in current functionality.Addresses a defect in current functionality.service/iamIssues and PRs that pertain to the iam service.Issues and PRs that pertain to the iam service.service/snsIssues and PRs that pertain to the sns service.Issues and PRs that pertain to the sns service.