AWS Grafana via terraform error

0

Hi

trying to create a aws grafana in a non root account using terraform

I have the below code to get started:

resource "aws_grafana_workspace" "org" {
  account_access_type      = "ORGANIZATION"
  organizational_units     = ["xxxxxxxx"]
  authentication_providers = ["AWS_SSO"]
  permission_type          = "CUSTOMER_MANAGED"
  data_sources             = ["AMAZON_OPENSEARCH_SERVICE", "ATHENA", "CLOUDWATCH", "PROMETHEUS", "REDSHIFT", "SITEWISE", "TIMESTREAM", "XRAY"]
  role_arn                 = aws_iam_role.grafana.arn
  configuration = jsonencode({
    "name" : "organizational-grafana",
    "grafana_version" : 9.4,
    "vpc_configuration" : {
      "security_group_ids" : [aws_security_group.grafana.id],
      "subnet_ids" : data.aws_subnets.private.ids
    }
  })
}

but get the error:

 Error: creating Grafana Workspace: ValidationException: The JSON provided in the configuration property {} is invalid for the grafanaVersion {}.
│ {
│   RespMetadata: {
│     StatusCode: 400,
│     RequestID: "f6a931c7-5386-4f3e-a4d3-e441cca0d44c"
│   },
│   Message_: "The JSON provided in the configuration property {} is invalid for the grafanaVersion {}."
│ }

Ive tried putting the 9.4 as "9.4" using grafanaVersion instead of grafana_verison, and removing it all together. I still always get the same error.

any ideas how to get it this deploying?

  • Corrected your TF below

質問済み 10ヶ月前465ビュー
3回答
1

Resolved!

Error was a fake news.. it was actualy the data call to the subnets was wrong. now deployed! thanks for the help

回答済み 10ヶ月前
  • Awesome great news.... Didnt need an equals after vpc_configuration

0
承認された回答

As Per DOCS, this is not possible...

In both the Amazon Managed Grafana API and the AWS CLI, the configuration is a JSON string The only configuration that you can set is the unifiedAlerting, enabled setting. Setting this to true turns on the Grafana alerting feature, setting it to false turns it off.

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

Simple fix, your Terraform is slightly incorrect..

Use this

resource "aws_grafana_workspace" "org" {
  account_access_type      = "ORGANIZATION"
  organizational_units     = ["xxxxxxxx"]
  authentication_providers = ["AWS_SSO"]
  permission_type          = "CUSTOMER_MANAGED"
  data_sources             = ["AMAZON_OPENSEARCH_SERVICE", "ATHENA", "CLOUDWATCH", "PROMETHEUS", "REDSHIFT", "SITEWISE", "TIMESTREAM", "XRAY"]
  role_arn                 = aws_iam_role.grafana.arn
  grafana_version          = 9.4
  name                     = "organizational-grafana"

  vpc_configuration  {
    security_group_ids = [aws_security_group.grafana.id]
    subnet_ids = data.aws_subnets.private.ids
  }
}
profile picture
エキスパート
回答済み 10ヶ月前
profile picture
エキスパート
レビュー済み 10ヶ月前
0

Hi yes! no idea how i got all that confused.. but now im scratching my head even more... as

resource "aws_grafana_workspace" "org" {
  name                     = "organizational-grafana"
  description              = "Organizational Grafana workspace via SSO"
  grafana_version          = "9.4"
  account_access_type      = "ORGANIZATION"
  organizational_units     = ["zxcasdasdas"]
  authentication_providers = ["AWS_SSO"]
  permission_type          = "CUSTOMER_MANAGED"
  data_sources             = ["AMAZON_OPENSEARCH_SERVICE", "ATHENA", "CLOUDWATCH", "PROMETHEUS", "REDSHIFT", "SITEWISE", "TIMESTREAM", "XRAY"]
  role_arn                 = aws_iam_role.grafana.arn

  vpc_configuration = {
    security_group_ids = aws_security_group.grafana.id
    subnet_ids         = data.aws_subnets.private.ids
  }
}

is getting the error:

Error: Unsupported argument
│ 
│   on grafana.tf line 12, in resource "aws_grafana_workspace" "org":
│   12:   vpc_configuration = {
│ 
│ An argument named "vpc_configuration" is not expected here. Did you mean to define a block of type "vpc_configuration"?
回答済み 10ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ