-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create component for quicksight policy in development
- Loading branch information
1 parent
bc0be2e
commit aac7859
Showing
7 changed files
with
154 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
terraform/aws/analytical-platform-development/tooling-iam/.terraform.lock.hcl
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
terraform/aws/analytical-platform-development/tooling-iam/terraform.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
terraform/aws/analytical-platform-development/tooling-iam/terraform.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
47 changes: 47 additions & 0 deletions
47
...aform/aws/analytical-platform-development/tooling-iam/tooling-integration-iam-policies.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#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 | ||
|
||
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 | ||
} |
13 changes: 13 additions & 0 deletions
13
terraform/aws/analytical-platform-development/tooling-iam/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |