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

[Bug]: Can't enable logging configuration for existing AWS Prometheus workspace #27472

Closed
romich opened this issue Oct 25, 2022 · 6 comments · Fixed by #29237
Closed

[Bug]: Can't enable logging configuration for existing AWS Prometheus workspace #27472

romich opened this issue Oct 25, 2022 · 6 comments · Fixed by #29237
Labels
bug Addresses a defect in current functionality. service/amp Issues and PRs that pertain to the amp service.

Comments

@romich
Copy link

romich commented Oct 25, 2022

Terraform Core Version

1.3.2

AWS Provider Version

4.36.1

Affected Resource(s)

aws_prometheus_workspace

Expected Behavior

Logging is enabled for existing workspace

Actual Behavior

Error is produced:

Error: updating Prometheus Workspace (ws-...) logging configuration: ResourceNotFoundException: Workspace logging configuration not found.

Relevant Error/Panic Output Snippet

╷
│ Error: updating Prometheus Workspace (ws-...) logging configuration: ResourceNotFoundException: Workspace logging configuration not found.
│ {
│   RespMetadata: {
│     StatusCode: 404,
│     RequestID: "..."
│   },
│   Message_: "Workspace logging configuration not found.",
│   ResourceId: "ws-.../logging",
│   ResourceType: "AWS::APS::LoggingConfiguration"
│ }
│
│   with aws_prometheus_workspace.amp,
│   on amp.tf line 5, in resource "aws_prometheus_workspace" "amp":
│    5: resource "aws_prometheus_workspace" "amp" {
│
╵

Terraform Configuration Files

Step 1:

resource "aws_prometheus_workspace" "amp" {}

Step 2:

resource "aws_cloudwatch_log_group" "amp" {
  name = "/aws/vendedlogs/prometheus"
}

resource "aws_prometheus_workspace" "amp" {
  logging_configuration {
    log_group_arn = "${aws_cloudwatch_log_group.amp.arn}:*"
  }
}

Steps to Reproduce

  1. Apply terraform config from Step 1.
  2. Apply terraform config from Step 2, observe error.

Debug Output

No response

Panic Output

No response

Important Factoids

Enabling logs with aws cli works fine with resources created at step 2, and after this terraform plan reports that there are no changes.

❯ aws amp create-logging-configuration --workspace-id ws-... --log-group-arn 'arn:aws:logs:us-east-1:...:log-group:/aws/vendedlogs/prometheus:*'
{
    "status": {
        "statusCode": "CREATING"
    }
}

References

No response

Would you like to implement a fix?

No

@romich romich added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Oct 25, 2022
@github-actions
Copy link

Community Note

Voting for Prioritization

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

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/amp Issues and PRs that pertain to the amp service. service/logs Issues and PRs that pertain to the logs service. labels Oct 25, 2022
@ewbankkit ewbankkit removed needs-triage Waiting for first response or review from a maintainer. service/logs Issues and PRs that pertain to the logs service. labels Oct 26, 2022
@TheJacobWalters
Copy link

I would like to fix this bug. It has effected me and I have tracked down the cause. This will be my first contribution.

@TheJacobWalters
Copy link

This area of code shows that when a workspace is getting updated, if there has been a change to "logging_configuration", the code will do one of two things.

  1. call UpdateWorkspaceAliasWithContext
  2. call DeleteLoggingConfigurationWithContext

https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/amp/workspace.go#L192

In order to address this bug, we need to add a call to CreateLoggingConfigurationWithContext

@TheJacobWalters
Copy link

@ewbankkit I think this is ready to go

@TheJacobWalters
Copy link

@ewbankkit would you run the tests again ?

@github-actions
Copy link

github-actions bot commented Mar 6, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/amp Issues and PRs that pertain to the amp service.
Projects
None yet
3 participants