-
Notifications
You must be signed in to change notification settings - Fork 9k
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
[Bug]: panic in aws_iam_policy_document data source #33060
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Relates #33026 Reproduced with a minimal config: data "aws_iam_policy_document" "test" {
statement {
actions = [
"s3:ListBucket",
]
resources = [
"arn:aws:s3:::my-bucket",
]
condition {
test = "StringLike"
variable = "s3:prefix"
values = ["one/"]
}
condition {
test = "StringLike"
variable = "s3:prefix"
values = ["two/", "three/"]
}
}
} % terraform plan
data.aws_iam_policy_document.test: Reading...
Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: Plugin did not respond
│
│ with data.aws_iam_policy_document.test,
│ on main.tf line 13, in data "aws_iam_policy_document" "test":
│ 13: data "aws_iam_policy_document" "test" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain more details.
╵
Stack trace from the terraform-provider-aws_v5.12.0_x5 plugin:
panic: interface conversion: interface {} is string, not []string [recovered]
panic: interface conversion: interface {} is string, not []string
goroutine 295 [running]:
encoding/json.(*encodeState).marshal.func1()
encoding/json/encode.go:326 +0x80
panic({0x10cb19e80, 0x14001657740})
runtime/panic.go:884 +0x204
github.com/hashicorp/terraform-provider-aws/internal/service/iam.IAMPolicyStatementConditionSet.MarshalJSON({0x1400068d860, 0x2, 0x100?})
github.com/hashicorp/terraform-provider-aws/internal/service/iam/policy_model.go:186 +0x4bc
encoding/json.addrMarshalerEncoder(0x1400411b500, {0x10c642760?, 0x1400517b690?, 0x1400411b500?}, {0x20?, 0xfd?})
encoding/json/encode.go:494 +0xe8
encoding/json.condAddrEncoder.encode({0x10dfacd48?, 0x10dfacd98?}, 0x140032242b8?, {0x10c642760?, 0x1400517b690?, 0x101244fcc?}, {0x1?, 0x0?})
encoding/json/encode.go:958 +0x50
encoding/json.structEncoder.encode({{{0x14001698900?, 0x101246900?, 0x0?}, 0x14001657620?}}, 0x1400411b500, {0x10dc8c0e0?, 0x1400517b600?, 0x14003f530c0?}, {0x0?, 0x0?})
encoding/json/encode.go:759 +0x178
encoding/json.ptrEncoder.encode({0x140032244d8?}, 0x1400411b500, {0x10b9fdb20?, 0x14003f530c0?, 0x0?}, {0x0?, 0x0?})
encoding/json/encode.go:943 +0x1c4
encoding/json.arrayEncoder.encode({0x14003224618?}, 0x1400411b500, {0x10ba78020?, 0x140017d7a60?, 0x14003224598?}, {0xd0?, 0x5?})
encoding/json/encode.go:914 +0xc0
encoding/json.sliceEncoder.encode({0x140032246e8?}, 0x1400411b500, {0x10ba78020?, 0x140017d7a60?, 0x14003224718?}, {0xc?, 0x0?})
encoding/json/encode.go:887 +0x260
encoding/json.structEncoder.encode({{{0x1400168e480?, 0x101246900?, 0x13f1b5c98?}, 0x14001657680?}}, 0x1400411b500, {0x10d28ffe0?, 0x140017d7a40?, 0x140017d7a40?}, {0x18?, 0x48?})
encoding/json/encode.go:759 +0x178
encoding/json.ptrEncoder.encode({0x14003224908?}, 0x1400411b500, {0x10c6141c0?, 0x140017d7a40?, 0x1400134b540?}, {0xa0?, 0x34?})
encoding/json/encode.go:943 +0x1c4
encoding/json.(*encodeState).reflectValue(0x140032249b8?, {0x10c6141c0?, 0x140017d7a40?, 0x140036d08b8?}, {0x0?, 0x0?})
encoding/json/encode.go:358 +0x70
encoding/json.(*encodeState).marshal(0x800014003224a01?, {0x10c6141c0?, 0x140017d7a40?}, {0xb8?, 0x8?})
encoding/json/encode.go:330 +0x120
encoding/json.Marshal({0x10c6141c0, 0x140017d7a40})
encoding/json/encode.go:161 +0x94
encoding/json.MarshalIndent({0x10c6141c0?, 0x140017d7a40?}, {0x0, 0x0}, {0x10a149302, 0x2})
encoding/json/encode.go:174 +0x34
github.com/hashicorp/terraform-provider-aws/internal/service/iam.dataSourcePolicyDocumentRead({0x114192380?, 0x1400160d0b0?}, 0x10df4af40?, {0x140031491e0?, 0x0?})
github.com/hashicorp/terraform-provider-aws/internal/service/iam/policy_document_data_source.go:264 +0x260
github.com/hashicorp/terraform-provider-aws/internal/provider.interceptedHandler[...].func1(0x0?, {0x10df4af40?, 0x140031491e0?})
github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:111 +0x28c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x10e0e4560?, {0x10e0e4560?, 0x1400160d0b0?}, 0xd?, {0x10df4af40?, 0x140031491e0?})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:745 +0x64
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0x140013437a0, {0x10e0e4560, 0x1400160d0b0}, 0x14003121180, {0x10df4af40, 0x140031491e0})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/resource.go:970 +0x130
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0x140022e35f0, {0x10e0e4560?, 0x1400160cf90?}, 0x140014a95a0)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.27.0/helper/schema/grpc_provider.go:1198 +0x304
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.muxServer.ReadDataSource({0x14003133aa0, 0x14004eef500, 0x14003133ad0, 0x14003133b00, {0x1400315a460, 0x2, 0x2}}, {0x10e0e4560?, 0x1400160cc60?}, 0x140014a95a0)
github.com/hashicorp/terraform-plugin-mux@v0.11.2/tf5muxserver/mux_server_ReadDataSource.go:30 +0x100
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0x140031425a0, {0x10e0e4560?, 0x1400160c2d0?}, 0x14004125220)
github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov5/tf5server/server.go:661 +0x368
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x10dcce7a0?, 0x140031425a0}, {0x10e0e4560, 0x1400160c2d0}, 0x140013b8000, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:458 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x140004e0960, {0x10e0f1500, 0x140032089c0}, 0x1400157d440, 0x140032038f0, 0x11413d650, 0x0)
google.golang.org/grpc@v1.56.1/server.go:1337 +0xc90
google.golang.org/grpc.(*Server).handleStream(0x140004e0960, {0x10e0f1500, 0x140032089c0}, 0x1400157d440, 0x0)
google.golang.org/grpc@v1.56.1/server.go:1714 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.1()
google.golang.org/grpc@v1.56.1/server.go:959 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.56.1/server.go:957 +0x16c
Error: The terraform-provider-aws_v5.12.0_x5 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue |
This functionality has been released in v5.14.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
Terraform Core Version
1.3.7
AWS Provider Version
5.12.0
Affected Resource(s)
Expected Behavior
Should not panic and instead handle the error.
Actual Behavior
Panic (output below)
Relevant Error/Panic Output Snippet
Terraform Configuration Files
I'm happy to help reproduce, but would like to keep the configuration we are working with private.
Steps to Reproduce
I'm happy to help reproduce, but would like to keep the configuration we are working with private.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
No
The text was updated successfully, but these errors were encountered: