Skip to content

Commit

Permalink
fix(iam): add permissions to generate infra plan
Browse files Browse the repository at this point in the history
Signed-off-by: Massimiliano Giovagnoli <[email protected]>
  • Loading branch information
maxgio92 committed Mar 21, 2024
1 parent f4e18fd commit 369152a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
23 changes: 22 additions & 1 deletion config/clusters/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,31 @@ module "test-infra_reader" {
name = "github_actions-test-infra-reader"
create = true
subjects = [
"falcosecurity/test-infra:ref:refs/heads/*"
"falcosecurity/test-infra:ref:*"
]
policies = {
test-infra_read_access = "arn:aws:iam::aws:policy/ReadOnlyAccess"
test-infra_state_lock = "${aws_iam_policy.test-infra_state_lock.arn}"
}
}

resource "aws_iam_policy" "test-infra_state_lock" {
name_prefix = "github_actions-test-infra-cluster"
description = "Access policy for test-infra Terraform remote state lock"
policy = data.aws_iam_policy_document.test-infra_state_lock.json
}

data "aws_iam_policy_document" "test-infra_state_lock" {
statement {
sid = "DeployTestInfraClusterAccess"
effect = "Allow"
actions = [
"dynamodb:PutItem",
"dynamodb:DeleteItem"
]
resources = [
"arn:aws:dynamodb:::table/${var.state_dynamodb_table_name}"
]
}
}

Expand Down
5 changes: 5 additions & 0 deletions config/clusters/iam_variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variable "state_dynamodb_table_name" {
type = string
description = "The name of the DynamoDB table for the Terraform state"
default = "falco-test-infra-state-lock"
}

0 comments on commit 369152a

Please sign in to comment.