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

feat: Add required suffix when specifying log group ARN #35941

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

djsd123
Copy link
Contributor

@djsd123 djsd123 commented Feb 22, 2024

Description

Specifying a cloudwatch log-group ARN on an aws_fis_experiment_template like so:

  log_configuration {
    log_schema_version = 2

    cloudwatch_logs_configuration {
      log_group_arn = aws_cloudwatch_log_group.example.arn
    }
  }

results in:

╷
│ Error: creating AWS FIS (Fault Injection Simulator) Experiment Template (Test dev provider): operation error fis: CreateExperimentTemplate, https response error StatusCode: 400,
| RequestID: a84b03ea-b1ff-49f5-9be6-b0ad450666cf, ValidationException: The logGroupArn "arn:aws:logs:eu-west-1:${accountId}:log-group:/aws/fis" in cloudWatchLogsLogConfiguration is not valid.
│
│   with aws_fis_experiment_template.fis,
│   on fis.tf line 1, in resource "aws_fis_experiment_template" "fis":
│    1: resource "aws_fis_experiment_template" "fis" {
│
╵

This is because AWS expects this suffix :* on the log-group ARN like so:

  log_configuration {
    log_schema_version = 2

    cloudwatch_logs_configuration {
      log_group_arn = "${aws_cloudwatch_log_group.example.arn}:*"
    }
  }

As far as I can tell, the requirement for the suffix is not well documented. Also, the ambiguous Api error from AWS is not helpful. Propose the required suffix is added if not present. Specifying log_group_arn = aws_cloudwatch_log_group.example.arn is more intuitive imho.

Output from Acceptance Testing

Acceptance

terraform-provider-aws git:(f-add-suffix-to-log-group-arn) ✗ make testacc TESTS=TestAccFISExperimentTemplate_loggingConfiguration PKG=fis
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/fis/... -v -count 1 -parallel 20 -run='TestAccFISExperimentTemplate_loggingConfiguration'  -timeout 360m
=== RUN   TestAccFISExperimentTemplate_loggingConfiguration
=== PAUSE TestAccFISExperimentTemplate_loggingConfiguration
=== CONT  TestAccFISExperimentTemplate_loggingConfiguration
--- PASS: TestAccFISExperimentTemplate_loggingConfiguration (74.06s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/fis        76.509s

Unit

➜  terraform-provider-aws git:(f-add-suffix-to-log-group-arn) ✗ make test PKG=fis
==> Checking that code complies with gofmt requirements...
go test ./internal/service/fis/...  -timeout=5m
ok      github.com/hashicorp/terraform-provider-aws/internal/service/fis        2.911s

Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/fis Issues and PRs that pertain to the fis service. and removed size/M Managed by automation to categorize the size of a PR. labels Feb 22, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 22, 2024
Copy link

Thank you for your contribution! 🚀

Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the go.mod or go.sum files and commit them into this pull request.

Additional details:

  • Check open pull requests with the dependencies label to view other dependency updates.
  • If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed.
  • If this pull request is for supporting a new AWS service:
    • Ensure the new AWS service changes are following the Contributing Guide section on new services, in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split.
    • If this pull request is already a separate pull request from the above item, you can ignore this message.

@djsd123 djsd123 force-pushed the f-add-suffix-to-log-group-arn branch from 90bc163 to b8891f0 Compare February 22, 2024 18:09
…ment template

Specifying a cloudwatch log-group ARN on a `aws_fis_experiment_template` like so:
```
  log_configuration {
    log_schema_version = 2

    cloudwatch_logs_configuration {
      log_group_arn = aws_cloudwatch_log_group.example.arn
    }
  }
```
results in:
```
╷
│ Error: creating AWS FIS (Fault Injection Simulator) Experiment Template (Test dev provider): operation error fis: CreateExperimentTemplate, https response error StatusCode: 400,
| RequestID: a84b03ea-b1ff-49f5-9be6-b0ad450666cf, ValidationException: The logGroupArn "arn:aws:logs:eu-west-1:${accountId}:log-group:/aws/fis" in cloudWatchLogsLogConfiguration is not valid.
│
│   with aws_fis_experiment_template.fis,
│   on fis.tf line 1, in resource "aws_fis_experiment_template" "fis":
│    1: resource "aws_fis_experiment_template" "fis" {
│
╵
```
This is because AWS expects this suffix `:*` on the log-group ARN like so:
```
  log_configuration {
    log_schema_version = 2

    cloudwatch_logs_configuration {
      log_group_arn = "${aws_cloudwatch_log_group.example.arn}:*"
    }
  }
```

As far as I could tell, the requirement for the suffix is not well documented. Also the ambiguous Api error from AWS is not helpful.
Propose the required suffix is added if not present. Specifying `log_group_arn = aws_cloudwatch_log_group.example.arn` is more
intuitive imho.
@djsd123 djsd123 force-pushed the f-add-suffix-to-log-group-arn branch from b8891f0 to 4e972b7 Compare February 23, 2024 11:44
@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 27, 2024
@djsd123 djsd123 requested a review from a team as a code owner February 11, 2025 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/fis Issues and PRs that pertain to the fis service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants