hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.61k stars 9k forks source link

[Enhancement]: AWS Grafana Alerting #32608

Open izazahamed-babji opened 11 months ago

izazahamed-babji commented 11 months ago

Description

There is a terraform resource for creating an AWS Grafana workspace 'aws_grafana_workspace', but there is no option to enable Grafana Alerting. Can you include that as a part of the resource options?

Affected Resource(s) and/or Data Source(s)

aws_grafana_workspace

Potential Terraform Configuration

resource "aws_grafana_workspace" "example" {
  account_access_type      = "CURRENT_ACCOUNT"
  authentication_providers = ["SAML"]
  permission_type          = "SERVICE_MANAGED"
  role_arn                 = aws_iam_role.assume.arn
alerts_enabled             = true
}

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 11 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

maneshmohan124 commented 4 weeks ago

We can write a script for Alerting with AWS cli commands and pass the script with the Local-exec provisoner with null resource in Terraform.

example:

resource "null_resource" "run_script" { provisioner "local-exec" { command = "sh ./awscli.sh" # Adjust path based on script location } }

inside the awscli.sh script file pass the below aws cli commands

aws grafana update-workspace-configuration \ --region (type the name) \ --workspace-id (type the worksspace-id) \ --configuration '{"unifiedAlerting": { "enabled": true }}'

Ref for Cli commands: https://docs.aws.amazon.com/grafana/latest/userguide/AMG-configure-workspace.html