Skip to content

Add Managed Grafana workspace to dev - #2267

Closed
theseanything wants to merge 2 commits into
mainfrom
add-managed-grafana-dev
Closed

Add Managed Grafana workspace to dev#2267
theseanything wants to merge 2 commits into
mainfrom
add-managed-grafana-dev

Conversation

@theseanything

Copy link
Copy Markdown
Contributor

Adds an AWS Managed Grafana workspace to the forms/health root, gated by a new environmental_settings.enable_managed_grafana flag that is only true in dev.

  • Workspace: AWS_SSO auth, SERVICE_MANAGED, data sources ATHENA/CLOUDWATCH/XRAY, Grafana 12.4
  • IAM role <env>-grafana-workspace with the AWS managed Grafana CloudWatch/Athena and X-Ray read-only policies
  • Deployer role gains the grafana:/sso: actions and the new role in its allowlist

Athena is permissions-only for now (no workgroup or results bucket). Users are assigned to the workspace via Identity Center in the console.

Apply forms/account in dev before the pipeline reaches forms/health.

Adds an AWS Managed Grafana workspace (AWS_SSO, service-managed, CloudWatch/X-Ray/Athena data sources, Grafana 12.4) to the health root behind an environmental_settings flag enabled only in dev, plus the deployer permissions needed to create it.
Copilot AI lite review requested due to automatic review settings September 3, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The current output and deployer permissions are likely to break non-dev applies and/or Terraform refresh due to an unsafe one([]) output and missing Grafana Describe/ListTags IAM actions.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces an optional AWS Managed Grafana workspace under the forms/health Terraform deployment, controlled by a new environmental_settings.enable_managed_grafana flag (enabled in dev). It also updates the deployer IAM policy to allow provisioning and managing the workspace and its associated IAM role.

Changes:

  • Add enable_managed_grafana to environmental_settings inputs and enable it in dev tfvars.
  • Provision an IAM role plus an AWS Managed Grafana workspace (AWS SSO auth, service-managed permissions, Athena/CloudWatch/X-Ray data sources) in forms/health when enabled.
  • Extend the deployer policy with Grafana/Sso/Organizations permissions and allowlisting for the new workspace role.
File summaries
File Description
infra/modules/deployer-access/policy.tf Adds Grafana and SSO/Organizations permissions and allowlists the new Grafana workspace IAM role for IAM management/passrole.
infra/deployments/forms/tfvars/dev.tfvars Enables the managed Grafana feature flag in dev.
infra/deployments/forms/inputs.tf Adds enable_managed_grafana as an optional environmental setting input.
infra/deployments/forms/health/outputs.tf Exposes the Grafana workspace endpoint as an output.
infra/deployments/forms/health/grafana.tf Adds conditional creation of the Grafana IAM role, managed policy attachments, and workspace resource.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1 to +3
output "grafana_workspace_endpoint" {
value = one(aws_grafana_workspace.this[*].endpoint)
}
Comment on lines +471 to +477
actions = [
"grafana:DeleteWorkspace",
"grafana:UpdateWorkspace",
"grafana:UpdateWorkspaceConfiguration",
"grafana:TagResource",
"grafana:UntagResource"
]
Copilot AI review requested due to automatic review settings September 3, 2026 10:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The current Grafana output expression will fail in non-dev envs when Grafana is disabled, and the Glue catalog resource uses an invalid boolean value type that is likely to break Terraform plan/apply.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

infra/deployments/forms/health/outputs.tf:3

  • This output will fail to plan/apply in environments where Managed Grafana is disabled (the default): when the workspace resource count is 0, one([]) raises an error. Make the output conditional (or use try) so non-dev environments can still apply.
output "grafana_workspace_endpoint" {
  value = one(aws_grafana_workspace.this[*].endpoint)
}

infra/modules/submission-events/glue-catalog.tf:30

  • allow_full_table_external_data_access is set to the string "True"; Terraform arguments here are typed, and this should be a boolean literal. As written, this is likely to fail type checking during plan/apply.
  }

  allow_full_table_external_data_access = "True"
}
  • Files reviewed: 21/21 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment on lines +1 to +13
# Integrates S3 Tables with AWS analytics services (Athena, Firehose, etc.) by
# federating all S3 table buckets in the account into the Glue Data Catalog.
# This is an account+region singleton: the name must be "s3tablescatalog" and
# it covers every table bucket in the account, not just the one in this module.
# Access control is IAM-based (IAM_ALLOWED_PRINCIPALS), so consumers need IAM
# permissions only, no Lake Formation grants.
resource "aws_glue_catalog" "s3tablescatalog" {
name = "s3tablescatalog"

federated_catalog {
connection_name = "aws:s3tables"
identifier = "arn:aws:s3tables:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:bucket/*"
}
Comment on lines +1 to +5
module "submission_events" {
count = var.forms_runner_settings.enable_submission_events_analytics ? 1 : 0
source = "../../../modules/submission-events"
env_name = var.environment_name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants