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

aws_cloudwatch_log_group creation intermittently fails with "already exists" error #18468

Open
camlow325 opened this issue Mar 29, 2021 · 1 comment
Labels
bug Addresses a defect in current functionality. service/cloudwatch Issues and PRs that pertain to the cloudwatch service.

Comments

@camlow325
Copy link
Contributor

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

Terraform CLI and Terraform AWS Provider Version

› terraform -v
Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/aws v3.4.0

Affected Resource(s)

  • aws_cloudwatch_log_group

Terraform Configuration Files

resource "aws_cloudwatch_log_group" "test" {
  name = "/aws/lambda/test"
}

Debug Output

The debug output shows that the provider appeared to encounter an error while waiting for a response to the initial creation attempt. During an attempted retry, an "already exists" error was received. This is presumably because AWS actually did create the log group during the first try.

2021-03-29T18:34:03.922Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: 2021/03/29 18:34:03 [DEBUG] [aws-sdk-go] DEBUG: Request logs/CreateLogGroup Details:
2021-03-29T18:34:03.922Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: ---[ REQUEST POST-SIGN ]-----------------------------
2021-03-29T18:34:03.922Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: POST / HTTP/1.1
…
2021-03-29T18:34:03.922Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: {"logGroupName":"/aws/lambda/test"}
...
2021-03-29T18:34:27.108Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: 2021/03/29 18:34:27 [DEBUG] [aws-sdk-go] DEBUG: Send Request logs/CreateLogGroup failed, attempt 0/25, error RequestError: send request failed
2021-03-29T18:34:27.108Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: caused by: Post "https://logs.us-west-2.amazonaws.com/": EOF
2021-03-29T18:34:27.168Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: 2021/03/29 18:34:27 [DEBUG] [aws-sdk-go] DEBUG: Retrying Request logs/CreateLogGroup, attempt 1
2021-03-29T18:34:27.168Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: 2021/03/29 18:34:27 [DEBUG] [aws-sdk-go] DEBUG: Request logs/CreateLogGroup Details:
2021-03-29T18:34:27.168Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: ---[ REQUEST POST-SIGN ]-----------------------------
2021-03-29T18:34:27.168Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: POST / HTTP/1.1
…
2021-03-29T18:34:27.168Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: {"logGroupName":"/aws/lambda/test"}
2021-03-29T18:34:27.195Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: 2021/03/29 18:34:27 [DEBUG] [aws-sdk-go] DEBUG: Response logs/CreateLogGroup Details:
2021-03-29T18:34:27.195Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: ---[ RESPONSE ]--------------------------------------
2021-03-29T18:34:27.195Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: HTTP/1.1 400 Bad Request
...
2021-03-29T18:34:27.195Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: -----------------------------------------------------
2021-03-29T18:34:27.195Z [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: 2021/03/29 18:34:27 [DEBUG] [aws-sdk-go] {"__type":"ResourceAlreadyExistsException","message":"The specified log group already exists"}

Expected Behavior

The apply should have succeeded, with the log group having been created successfully.

Actual Behavior

Normally, the expected behavior occurs. Intermittently, though, the log group was created in AWS but the apply failed with an error:

aws_cloudwatch_log_group.test: Still creating... [20s elapsed]
...
Error: Creating CloudWatch Log Group failed: ResourceAlreadyExistsException: The specified log group already exists:  The CloudWatch Log Group '/aws/lambda/test' already exists.

Steps to Reproduce

  1. terraform apply
@ghost ghost added service/cloudwatchlogs service/cloudwatch Issues and PRs that pertain to the cloudwatch service. labels Mar 29, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 29, 2021
@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 4, 2021
@bryantbiggs
Copy link
Contributor

Relates to #17839

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/cloudwatch Issues and PRs that pertain to the cloudwatch service.
Projects
None yet
Development

No branches or pull requests

4 participants