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

Error with finding Enable AWS CloudWatch Logs for APIs #730

Closed
gaberamosfc opened this issue May 4, 2021 · 2 comments
Closed

Error with finding Enable AWS CloudWatch Logs for APIs #730

gaberamosfc opened this issue May 4, 2021 · 2 comments

Comments

@gaberamosfc
Copy link

gaberamosfc commented May 4, 2021

  • terrascan version: v1.5.0
  • Operating System: macOS Catalina - 10.15.5

Description

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.

I am attempting to resolve the finding:
Enable AWS CloudWatch Logs for APIs

resource "aws_api_gateway_stage" "main" {
...
  stage_name    = var.stage_name
  access_log_settings {
    destination_arn = aws_cloudwatch_log_group.apigw.arn
    format          = "..."
  }
...
}

resource "aws_cloudwatch_log_group" "apigw" {
  name              = "API-Gateway-Execution-Logs_${aws_api_gateway_rest_api.main.id}/${var.stage_name}"
...
}

What I Did

When I change terraform resource name of "aws_cloudwatch_log_group" to "main" to match the same resource name of the "aws_api_gateway_stage" "main" the error is resolved.

resource "aws_api_gateway_stage" "main" {
  stage_name    = var.stage_name
  access_log_settings {
    destination_arn = aws_cloudwatch_log_group.main.arn
    format          = "..."
  }
}

resource "aws_cloudwatch_log_group" "main" {
  name              = "API-Gateway-Execution-Logs_${aws_api_gateway_rest_api.main.id}/${var.stage_name}"
...
}

@gaberamosfc
Copy link
Author

Not sure if this is an issue, but I will close it.

@yermulnik
Copy link

Just hit this too and setting same name for both resources (not main though) didn't fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants