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

added tags to irsa module #27842

Merged
merged 6 commits into from
Nov 15, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

module "irsa" {
source = "github.com/ministryofjustice/cloud-platform-terraform-irsa?ref=2.0.0"
eks_cluster_name = var.eks_cluster_name
service_account_name = "${var.namespace}-athena-service-account"
namespace = var.namespace
role_policy_arns = {
athena = aws_iam_policy.athena_access.arn
}

# Tags
business_unit = var.business_unit
application = var.application
is_production = var.is_production
team_name = var.team_name
environment_name = var.environment
infrastructure_support = var.infrastructure_support
}

data "aws_iam_policy_document" "document" {
# Provide list of permissions and target AWS account resources to allow access to
# statement {
# actions = [
# "sts:AssumeRole"
# ]
# # This is a placeholder resource - waiting on real values before merging~
# resources = [
# "arn:aws:iam::321388111150:role/BedrockAccessforCP",
# ]
# }
statement {
actions = [
"s3:*",
]
resources = [
"arn:aws:s3:::*",
]
}
}

resource "aws_iam_policy" "athena_access" {
name = "${var.namespace}-athena-policy-general"
policy = data.aws_iam_policy_document.document.json

tags = {
business-unit = var.business_unit
application = var.application
is-production = var.is_production
environment-name = var.environment
owner = var.team_name
infrastructure-support = var.infrastructure_support
}
}
resource "kubernetes_secret" "irsa" {
metadata {
name = "${var.namespace}-irsa-output"
namespace = var.namespace
}
data = {
role = module.irsa.role_name
serviceaccount = module.irsa.service_account.name
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ variable "application" {
default = "Electronic Monitoring Datastore"
}

variable "eks_cluster_name" {
description = "The name of the eks cluster to retrieve the OIDC information"
}

variable "namespace" {
description = "Name of the namespace these resources are part of"
type = string
Expand Down
Loading