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]: aws_grafana_license_association does not import workspace ID #34714

Closed
dms1981 opened this issue Dec 4, 2023 · 4 comments · Fixed by #35290
Closed

[Bug]: aws_grafana_license_association does not import workspace ID #34714

dms1981 opened this issue Dec 4, 2023 · 4 comments · Fixed by #35290
Labels
bug Addresses a defect in current functionality. service/grafana Issues and PRs that pertain to the grafana service.
Milestone

Comments

@dms1981
Copy link

dms1981 commented Dec 4, 2023

Terraform Core Version

1.6.5

AWS Provider Version

5.2.9

Affected Resource(s)

Using the terraform-aws-managed-service-grafana module to import a grafana_license_association results in an incomplete import, where the workspace_id is not included, leading to Terraform attempting to replace the license association.

Expected Behavior

After running something like this:

terraform import 'module.managed_grafana.aws_grafana_license_association.this[0]' g-0000000000

The workspace_id should be populated in the Terraform statefile.

Actual Behavior

After importing the resource, the statefile contains a NULL value for the workspace_id:

  # module.managed_grafana.aws_grafana_license_association.this[0] must be replaced
-/+ resource "aws_grafana_license_association" "this" {
      + free_trial_expiration = (known after apply)
      ~ id                    = "g-0000000000" -> (known after apply)
      ~ license_expiration    = "2024-01-04T11:19:06Z" -> (known after apply)
      + workspace_id          = "g-000000000000" # forces replacement
        # (1 unchanged attribute hidden)
    }

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

module "managed_grafana" {
  #checkov:skip=CKV_TF_1:Module registry does not support commit hashes for versions

  source  = "terraform-aws-modules/managed-service-grafana/aws"
  version = "~> 2.0"

  name = local.application_name

  license_type = "ENTERPRISE"

  account_access_type       = "CURRENT_ACCOUNT"
  authentication_providers  = ["AWS_SSO"]
  permission_type           = "SERVICE_MANAGED"
  data_sources              = ["CLOUDWATCH", "PROMETHEUS"]
  notification_destinations = ["SNS"]

  iam_role_policy_arns = [module.amazon_managed_grafana_remote_cloudwatch_iam_policy.arn]

  configuration = jsonencode({
    unifiedAlerting = {
      enabled = true
    }
    plugins = {
      pluginAdminEnabled = true
    }
  })

  role_associations = {
    "ADMIN" = {
      "group_ids" = ["x"] # observability-platform
    }
  }

  tags = local.tags
}

Steps to Reproduce

Use Terraform CLI to import the grafana_license_association resource
Run terraform plan and observe that the workspace_id has not been populated in the state file as part of the import.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@dms1981 dms1981 added the bug Addresses a defect in current functionality. label Dec 4, 2023
Copy link

github-actions bot commented Dec 4, 2023

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 the service/grafana Issues and PRs that pertain to the grafana service. label Dec 4, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 4, 2023
@acwwat
Copy link
Contributor

acwwat commented Jan 13, 2024

To strictly fix the reported issue, I submitted a PR to add the missing workspace_id. However, I am not able to test the changes because the AWS API to enable a trial license keeps failing with a 400 error response with the message "Active marketplace agreement not found".

I am able to produce the problem using the aws grafana associate-license CLI command and using the sample configuration in the aws_grafana_license_association resource documentation.

I observed the behavior from enabling the trial license in the AWS Management Console, and it seems to be calling different APIs (seemingly the Marketplace API) during the license enablement process. So I am suspecting that the API might not be working properly with free trial license.

Unfortunately I don't have the resources to open AWS support ticket to investigate the error further. This is the first time I am dealing with a provider issue that is seemingly caused by AWS-side issues, so I will defer to the regular maintainers to see how it should be best addressed.

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Jan 16, 2024
@github-actions github-actions bot added this to the v5.34.0 milestone Jan 24, 2024
Copy link

This functionality has been released in v5.34.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

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 Feb 26, 2024
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/grafana Issues and PRs that pertain to the grafana service.
Projects
None yet
3 participants