Skip to content
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]: terraform-provider-aws_v5.40.0_x5 plugin crash. caused by empty aws_ecs_cluster configuration block #36330

Closed
gdelisle opened this issue Mar 12, 2024 · 4 comments · Fixed by #36341
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ecs Issues and PRs that pertain to the ecs service.
Milestone

Comments

@gdelisle
Copy link

Terraform Core Version

1.5.7,1.7.4

AWS Provider Version

v5.40.0_x5

Affected Resource(s)

aws_v5.40.0_x5

Expected Behavior

Terraform plan passed successfully and terraform apply validation step passed, terraform apply create step should have completed.

Actual Behavior

Error: The terraform-provider-aws_v5.40.0_x5 plugin crashed!

Relevant Error/Panic Output Snippet

Stack trace from the terraform-provider-aws_v5.40.0_x5 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 47 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/ecs.expandClusterConfigurationExecuteCommandLogConfiguration({0x14003f88690?, 0x1400273e8a0?, 0x111442af4?})
	github.com/hashicorp/terraform-provider-aws/internal/service/ecs/cluster.go:618 +0x368
github.com/hashicorp/terraform-provider-aws/internal/service/ecs.expandClusterConfigurationExecuteCommandConfiguration({0x14003f88670?, 0x1400273e000?, 0x111500d91?})
	github.com/hashicorp/terraform-provider-aws/internal/service/ecs/cluster.go:600 +0xb4
github.com/hashicorp/terraform-provider-aws/internal/service/ecs.expandClusterConfiguration({0x14003f88640?, 0x1114117a3?, 0x140026c9b30?})
	github.com/hashicorp/terraform-provider-aws/internal/service/ecs/cluster.go:586 +0xb4
github.com/hashicorp/terraform-provider-aws/internal/service/ecs.resourceClusterCreate({0x1161f5788, 0x140026c9b30}, 0x1400380ea80, {0x115fd17c0?, 0x14002ef5180})
	github.com/hashicorp/terraform-provider-aws/internal/service/ecs/cluster.go:171 +0x194
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).Create.interceptedHandler[...].func8(0x0?, {0x115fd17c0?, 0x14002ef5180?})
	github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:112 +0x1d4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x1161f5788?, {0x1161f5788?, 0x14002681560?}, 0xd?, {0x115fd17c0?, 0x14002ef5180?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:773 +0x64
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14000d50d20, {0x1161f5788, 0x14002681560}, 0x14003cda680, 0x1400380e900, {0x115fd17c0, 0x14002ef5180})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0x86c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14002f06138, {0x1161f5788?, 0x140026813e0?}, 0x14003d5ce10)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1078 +0xb08
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x1161f57c0?, {0x1161f5788?, 0x14002680a20?}, 0x14003d5ce10)
	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140008f2000, {0x1161f5788?, 0x14002680120?}, 0x140008f0850)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:846 +0x2b0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x115d7d1a0?, 0x140008f2000}, {0x1161f5788, 0x14002680120}, 0x1400380e500, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x164
google.golang.org/grpc.(*Server).processUnaryRPC(0x140016b0000, {0x1161f5788, 0x14002680000}, {0x11622b3f8, 0x140030c29c0}, 0x1400366ea20, 0x140013642d0, 0x11e079a58, 0x0)
	google.golang.org/[email protected]/server.go:1383 +0xb8c
google.golang.org/grpc.(*Server).handleStream(0x140016b0000, {0x11622b3f8, 0x140030c29c0}, 0x1400366ea20)
	google.golang.org/[email protected]/server.go:1794 +0xc70
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1027 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 41
	google.golang.org/[email protected]/server.go:1038 +0x150

Error: The terraform-provider-aws_v5.40.0_x5 plugin crashed!

Terraform Configuration Files

This configuration triggered the crash:
resource "aws_ecs_cluster" "cluster_prod" {
name = "my-cluster-name"
configuration {
execute_command_configuration {
log_configuration {
}
}
}
setting {
name = "containerInsights"
value = "enabled"
}
}
Note that the log_configuration is empty.

Steps to Reproduce

Running this configuration passes validation but crashes when applied. Removing this block allows the cluster to be created:
configuration {
execute_command_configuration {
log_configuration {
}
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@gdelisle gdelisle added the bug Addresses a defect in current functionality. label Mar 12, 2024
@github-actions github-actions bot added crash Results from or addresses a Terraform crash or kernel panic. service/ecs Issues and PRs that pertain to the ecs service. labels Mar 12, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 12, 2024
@acwwat
Copy link
Contributor

acwwat commented Mar 13, 2024

FYI once the crash is fixed, the configuration provided in the issue description will still cause AWS API to throw validation errors.

The logging_configuration block requires either cloud_watch_log_group_name or s3_bucket_name at a minimum, and the logging argument must be set to OVERRIDE. Here is an example configuration that works:

resource "aws_ecs_cluster" "cluster_prod" {
  name = "my-cluster-name"
  configuration {
    execute_command_configuration {
      log_configuration {
        cloud_watch_log_group_name = "ecs/my-cluster-name"
      }
      logging = "OVERRIDE"
    }
  }
}

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Mar 13, 2024
@github-actions github-actions bot added this to the v5.41.0 milestone Mar 13, 2024
Copy link

This functionality has been released in v5.41.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!

Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ecs Issues and PRs that pertain to the ecs service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants