Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Push infra changes for irsa argocd (#5)
Browse files Browse the repository at this point in the history
Co-authored-by: aikpah <aikpah@revacomm.com>
  • Loading branch information
UncleGedd and aikpah authored Oct 31, 2022
1 parent 75050e2 commit 352c889
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
44 changes: 44 additions & 0 deletions policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,47 @@ resource "aws_iam_role_policy_attachment" "gitlab_runner" {
role = aws_iam_role.this[0].name
policy_arn = aws_iam_policy.gitlab_runner[0].arn
}

################################################################################
# ArgoCD Policy
################################################################################
data "aws_iam_policy_document" "argocd" {
count = var.create_role && var.attach_argocd_policy ? 1 : 0

statement {
sid = "kmslist"
actions = [
"kms:List*",
"kms:Describe*"
]
resources = ["*"]
}

statement {
sid = "K8sNodes"
actions = [
"kms:Decrypt",
]
resources = [
data.aws_kms_alias.sops.arn,
data.aws_kms_alias.sops.target_key_arn,
]
}
}

resource "aws_iam_policy" "argocd" {
count = var.create_role && var.attach_argocd_policy ? 1 : 0

name_prefix = "${var.policy_name_prefix}Argocd_Policy-"
path = var.role_path
description = "Provides ArgoCD permissions to view and decrypt KMS keys"
policy = data.aws_iam_policy_document.argocd[0].json
tags = var.tags
}

resource "aws_iam_role_policy_attachment" "argocd" {
count = var.create_role && var.attach_argocd_policy ? 1 : 0

role = aws_iam_role.this[0].name
policy_arn = aws_iam_policy.argocd[0].arn
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,10 @@ variable "gitlab_runner_s3_bucket_arns" {
description = "List of S3 Bucket ARNs that Gitlab Runner needs for caching"
type = list(string)
default = ["*"]
}
# ArgoCD
variable "attach_argocd_policy" {
description = "Determines whether to attach the ArgoCD IAM policy to the role"
type = bool
default = false
}

0 comments on commit 352c889

Please sign in to comment.