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

fix: use unique name to avoid issues when running in the CI #530

Merged
merged 5 commits into from
Aug 7, 2024

Conversation

v1v
Copy link
Member

@v1v v1v commented Aug 7, 2024

tear-down does not cleanup the aws_cloudwatch_log_group, I'd assume is because the retention policy is honoured.

Therefore, it's required to use an unique name, otherwise it will fail with:

Error: creating CloudWatch Logs Log Group (/aws/lambda/github-actions-smoke-testing-test): operation error CloudWatch Logs: CreateLogGroup, https response error StatusCode: 400, RequestID: 4161b73e-8b5b-4fef-8a17-64aa29c2cdd4, ResourceAlreadyExistsException: The specified log group already exists

  with aws_cloudwatch_log_group.example,
  on main.tf line 105, in resource "aws_cloudwatch_log_group" "example":
 105: resource "aws_cloudwatch_log_group" "example" {


Error: creating IAM Policy (smoketest_extension_lambda_logging): operation error IAM: CreatePolicy, https response error StatusCode: 409, RequestID: 7560b89b-1e26-4c58-a6c1-1ca0e5eeca30, EntityAlreadyExists: A policy called smoketest_extension_lambda_logging already exists. Duplicate names are not allowed.

  with aws_iam_policy.lambda_logging,
  on main.tf line 124, in resource "aws_iam_policy" "lambda_logging":
 124: resource "aws_iam_policy" "lambda_logging" {

It creates a new resource:

image

closes #526

@github-actions github-actions bot added the aws-λ-extension AWS Lambda Extension label Aug 7, 2024
reakaleek
reakaleek previously approved these changes Aug 7, 2024
kruskall
kruskall previously approved these changes Aug 7, 2024
@v1v
Copy link
Member Author

v1v commented Aug 7, 2024

I think I need something else... I'm testing it out

@v1v
Copy link
Member Author

v1v commented Aug 7, 2024

I think I need something else... I'm testing it out

The IAM policies were also causing issues; I've just created a test branch to test these changes in isolation and avoid spamming. I'm gonna run a few more workflows to validate things works as expected.

So far:

-> Calling the lambda function...
{
    "StatusCode": 200,
    "ExecutedVersion": "$LATEST"
}
{
    "StatusCode": 200,
    "ExecutedVersion": "$LATEST"
}
-> Waiting for the agent documents to be indexed in Elasticsearch...
-> Smoke tests passed!

@v1v v1v dismissed stale reviews from kruskall and reakaleek via af8909d August 7, 2024 14:04
@v1v v1v requested review from reakaleek and kruskall August 7, 2024 14:04
@v1v v1v self-assigned this Aug 7, 2024
@v1v v1v enabled auto-merge (squash) August 7, 2024 14:15
@v1v v1v merged commit 9cda2be into main Aug 7, 2024
11 checks passed
@v1v v1v deleted the fix/unique-name branch August 7, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws-λ-extension AWS Lambda Extension
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

smoketest fails (not authorized to create CloudWatch Logs Log Group)
3 participants