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

Add policy to allow quicksight author access #4437

Merged
merged 8 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ updates:
- "terraform/aws/analytical-platform-development/cluster"
- "terraform/aws/analytical-platform-development/control-panel-message-broker"
- "terraform/aws/analytical-platform-development/sagemaker"
- "terraform/aws/analytical-platform-development/tooling-iam"
- "terraform/aws/analytical-platform-management-production/cluster"
- "terraform/aws/analytical-platform-production/cluster"
- "terraform/aws/analytical-platform-production/route53"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,58 @@ data "aws_iam_policy_document" "bedrock_integration" {
}
}
}

resource "aws_iam_policy" "bedrock_integration" {
name = "analytical-platform-bedrock-integration"
description = "Permissions needed to allow access to Bedrock in Frankfurt from tooling."
policy = data.aws_iam_policy_document.bedrock_integration.json
}

#trivy:ignore:aws-iam-no-policy-wildcards
data "aws_iam_policy_document" "quicksight_author" {
#checkov:skip=CKV_AWS_111: This is a service policy
#checkov:skip=CKV_AWS_356: Needs to access multiple resources
#checkov:skip=CKV_AWS_109: Needs to access multiple resources

statement {
sid = "CreateAuthor"
effect = "Allow"
actions = ["quicksight:CreateUser"]
resources = ["arn:aws:quicksight::${var.account_ids["analytical-platform-data-production"]}:user/$${aws:userid}"]
}

statement {
sid = "QuicksightAuthor"
effect = "Allow"

actions = [
"quicksight:UpdateTemplate",
"quicksight:ListUsers",
"quicksight:UpdateDashboard",
"quicksight:CreateTemplate",
"quicksight:ListTemplates",
"quicksight:DescribeTemplate",
"quicksight:DescribeDataSource",
"quicksight:DescribeDataSourcePermissions",
"quicksight:PassDataSource",
"quicksight:UpdateDataSource",
"quicksight:UpdateDataSetPermissions",
"quicksight:DescribeDataSet",
"quicksight:DescribeDataSetPermissions",
"quicksight:PassDataSet",
"quicksight:DescribeIngestion",
"quicksight:ListIngestions",
"quicksight:UpdateDataSet",
"quicksight:DeleteDataSet",
"quicksight:CreateIngestion",
"quicksight:CancelIngestion"
]

resources = ["*"]
}
}

resource "aws_iam_policy" "quicksight_author" {
name = "alpha-quicksight-author-access"
policy = data.aws_iam_policy_document.quicksight_author.json
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ data "aws_iam_policy_document" "bedrock_integration" {
}
}
}

resource "aws_iam_policy" "bedrock_integration" {
name = "analytical-platform-bedrock-integration"
description = "Permissions needed to allow access to Bedrock in Frankfurt from tooling."
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
terraform {
backend "s3" {
acl = "private"
bucket = "global-tf-state-aqsvzyd5u9"
encrypt = true
key = "aws/analytical-platform-development/tooling-iam/terraform.tfstate"
region = "eu-west-2"
dynamodb_table = "global-tf-state-aqsvzyd5u9-locks"
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.52.0"
}
}
required_version = "~> 1.5"
}

provider "aws" {
region = "eu-west-1"
assume_role {
role_arn = "arn:aws:iam::${var.account_ids["analytical-platform-development"]}:role/GlobalGitHubActionAdmin"
}
default_tags {
tags = var.tags
}
}

provider "aws" {
alias = "analytical-platform-management-production"
region = "eu-west-1"
assume_role {
role_arn = can(regex("AdministratorAccess", data.aws_iam_session_context.session.issuer_arn)) ? null : "arn:aws:iam::${var.account_ids["analytical-platform-management-production"]}:role/GlobalGitHubActionAdmin"
}
default_tags {
tags = var.tags
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
##################################################
# General
##################################################

account_ids = {
analytical-platform-development = "525294151996"
analytical-platform-management-production = "042130406152"
}

tags = {
business-unit = "Platforms"
application = "Analytical Platform"
component = "Tooling IAM"
environment = "development"
is-production = "false"
owner = "analytical-platform:analytics-platform-tech@digital.justice.gov.uk"
infrastructure-support = "analytical-platform:analytics-platform-tech@digital.justice.gov.uk"
source-code = "github.com/ministryofjustice/analytical-platform/terraform/aws/analytical-platform-development/tooling-iam"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#trivy:ignore:aws-iam-no-policy-wildcards
data "aws_iam_policy_document" "quicksight_author" {
#checkov:skip=CKV_AWS_111: This is a service policy
#checkov:skip=CKV_AWS_356: Needs to access multiple resources
#checkov:skip=CKV_AWS_109: Needs to access multiple resources

statement {
sid = "CreateAuthor"
effect = "Allow"
actions = ["quicksight:CreateUser"]
resources = ["arn:aws:quicksight::${var.account_ids["analytical-platform-development"]}:user/$${aws:userid}"]
}

statement {
sid = "QuicksightAuthor"
effect = "Allow"

actions = [
"quicksight:UpdateTemplate",
"quicksight:ListUsers",
"quicksight:UpdateDashboard",
"quicksight:CreateTemplate",
"quicksight:ListTemplates",
"quicksight:DescribeTemplate",
"quicksight:DescribeDataSource",
"quicksight:DescribeDataSourcePermissions",
"quicksight:PassDataSource",
"quicksight:UpdateDataSource",
"quicksight:UpdateDataSetPermissions",
"quicksight:DescribeDataSet",
"quicksight:DescribeDataSetPermissions",
"quicksight:PassDataSet",
"quicksight:DescribeIngestion",
"quicksight:ListIngestions",
"quicksight:UpdateDataSet",
"quicksight:DeleteDataSet",
"quicksight:CreateIngestion",
"quicksight:CancelIngestion"
]

resources = ["*"]
}
}

resource "aws_iam_policy" "quicksight_author" {
name = "alpha-quicksight-author-access"
policy = data.aws_iam_policy_document.quicksight_author.json
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
##################################################
# General
##################################################

variable "account_ids" {
type = map(string)
description = "Map of account names to account IDs"
}

variable "tags" {
type = map(string)
description = "Map of tags to apply to resources"
}
Loading