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_cloudfront_monitoring_subscription failing on refresh #26422

Open
mattrobinsonsre opened this issue Aug 22, 2022 · 4 comments · May be fixed by #26827
Open

aws_cloudfront_monitoring_subscription failing on refresh #26422

mattrobinsonsre opened this issue Aug 22, 2022 · 4 comments · May be fixed by #26827
Labels
bug Addresses a defect in current functionality. service/cloudfront Issues and PRs that pertain to the cloudfront service.

Comments

@mattrobinsonsre
Copy link
Contributor

mattrobinsonsre commented Aug 22, 2022

All resources of type aws_cloudfront_monitoring_subscription are failing on refresh

resource "aws_cloudfront_distribution" "this" {
...
}

resource "aws_cloudfront_monitoring_subscription" "this" {
  distribution_id = aws_cloudfront_distribution.this.id

  monitoring_subscription {
    realtime_metrics_subscription_config {
      realtime_metrics_subscription_status = var.realtime_metrics ? "Enabled" : "Disabled"
    }
  }
}

My best guess is that it's failing on internal/service/cloudfront/find.go:FindMonitoringSubscriptionByDistributionID

Errors along the lines of

Error: error reading CloudFront Monitoring Subscription (ABCD1EF2345GH): NoSuchMonitoringSubscription: The monitoring subscription does not exist.
│ 	status code: 404, request id: 43b80257-d749-4229-87bf-ea892ad921fd

I've attached a log.
log.txt

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/cloudfront Issues and PRs that pertain to the cloudfront service. labels Aug 22, 2022
@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Aug 22, 2022
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Aug 22, 2022
@dbourcet
Copy link

dbourcet commented Sep 5, 2022

Has the investigation started? We have several workspaces which are stucked because no plan can be done, this blocks us to improve other resources in those workspaces.

@MahmoudAlyy
Copy link

@dbourcet We temp fixed this by having the condition in the count and removing aws_cloudfront_monitoring_subscription from state where realtime_metrics_subscription_status is disabled.

resource "aws_cloudfront_monitoring_subscription" "this" {
  count    =  var.realtime_metrics ? 1 : 0

  distribution_id = aws_cloudfront_distribution.this.id

  monitoring_subscription {
    realtime_metrics_subscription_config {
      realtime_metrics_subscription_status = "Enabled"
    }
  }
}

@dbourcet
Copy link

dbourcet commented Sep 5, 2022

@MahmoudAlyy That does the trick to circumvent the issue. Thanks a lot!

@ewbankkit
Copy link
Contributor

Relates #33058.

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/cloudfront Issues and PRs that pertain to the cloudfront service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants