sourcegraph / terraform-aws-executors

https://registry.terraform.io/modules/sourcegraph/executors/aws/latest
Other
1 stars 6 forks source link

creating CloudWatch Logs Log Group (executors): ResourceAlreadyExistsException: The specified log group already exists #81

Open hutson opened 1 year ago

hutson commented 1 year ago

When:

randomize_resource_names = false

The following error is seen in Terraform:

│ Error: creating CloudWatch Logs Log Group (executors): ResourceAlreadyExistsException: The specified log group already exists
│
│   with module.sourcegraph-stg.module.executors-codeintel.aws_cloudwatch_log_group.syslogs,
│   on .terraform/modules/sourcegraph-stg.executors-codeintel/modules/executors/main.tf line 133, in resource "aws_cloudwatch_log_group" "syslogs":
│  133: resource "aws_cloudwatch_log_group" "syslogs" {

I am not entirely sure how to fix this issue as the name value is intentionally hard-coded - https://github.com/sourcegraph/terraform-aws-executors/blob/e979d49da0a978a5d69a0a756200a5b66da0b6d8/modules/executors/main.tf#L135. It's possible to not provide a name value and allow Terraform to create a random name, but then the log group might not work for executors - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group#argument-reference

hutson commented 1 year ago

Were multiple executor clusters meant to share a single CloudWatch log group? Actually, do the executors care about the CloudWatch name? According to the diagram, executors never interact with CloudWatch - https://sourcegraph.com/github.com/sourcegraph/terraform-aws-executors/-/blob/README.md

Therefore, can we, or should we, make the name dynamic?

Oh... this module is using CloudWatch as a syslog drain. Can the name of the syslog drain be passed to the executor startup script - https://github.com/sourcegraph/terraform-aws-executors/blob/e979d49da0a978a5d69a0a756200a5b66da0b6d8/modules/executors/main.tf#L217