Skip to content

Commit

Permalink
refactor(aws-eks-byovpc): remove duplicate local (#13)
Browse files Browse the repository at this point in the history
local.vars.id was the same as nuon_id, and made updating naming the
install kind of a pain.
  • Loading branch information
jordan-acosta authored Dec 7, 2023
1 parent d1ab436 commit e5d773a
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion aws-eks-byovpc/alb-ingress.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module "alb_controller_irsa" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "~> 5.0"

role_name = "alb-controller-${local.vars.id}"
role_name = "alb-controller-${local.install_name}"

create_role = true
attach_load_balancer_controller_policy = true
Expand Down
4 changes: 2 additions & 2 deletions aws-eks-byovpc/cert-manager.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module "cert_manager_irsa" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "~> 5.0"

role_name = "cert-manager-${local.vars.id}"
role_name = "cert-manager-${local.install_name}"

attach_cert_manager_policy = true
attach_cert_manager_policy = true
cert_manager_hosted_zone_arns = [
aws_route53_zone.internal.arn,
aws_route53_zone.public.arn,
Expand Down
2 changes: 1 addition & 1 deletion aws-eks-byovpc/ebs-csi.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "ebs_csi_irsa" {
source = "terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks"
version = "~> 5.0"

role_name = "ebs-csi-${local.vars.id}"
role_name = "ebs-csi-${local.install_name}"
attach_ebs_csi_policy = true

oidc_providers = {
Expand Down
2 changes: 1 addition & 1 deletion aws-eks-byovpc/ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "ecr" {
create_lifecycle_policy = false
create_registry_replication_configuration = false

repository_name = local.vars.id
repository_name = local.install_name
repository_image_tag_mutability = "MUTABLE"
repository_encryption_type = "KMS"
repository_image_scan_on_push = false
Expand Down
4 changes: 2 additions & 2 deletions aws-eks-byovpc/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ resource "aws_kms_key" "eks" {

# TODO: Looks like we're not using this?
# resource "aws_kms_alias" "eks" {
# name = "alias/nuon/eks-${local.vars.id}"
# name = "alias/nuon/eks-${local.install_name}"
# target_key_id = aws_kms_key.eks.id
# }

Expand Down Expand Up @@ -101,7 +101,7 @@ module "eks" {

# HACK: https://github.com/terraform-aws-modules/terraform-aws-eks/issues/1986
node_security_group_tags = {
"kubernetes.io/cluster/${local.vars.id}" = null
"kubernetes.io/cluster/${local.install_name}" = null
}

# this can't rely on default_tags.
Expand Down
6 changes: 3 additions & 3 deletions aws-eks-byovpc/odr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data "aws_iam_policy_document" "odr" {
}

resource "aws_iam_policy" "odr" {
name = "odr-${local.vars.id}"
name = "odr-${local.install_name}"
policy = data.aws_iam_policy_document.odr.json
}

Expand All @@ -20,11 +20,11 @@ module "odr_iam_role" {
version = ">= 5.1.0"
create_role = true

role_name = "odr-${local.vars.id}"
role_name = "odr-${local.install_name}"
role_path = "/nuon/"

cluster_service_accounts = {
(local.vars.id) = ["${var.waypoint_odr_namespace}:${var.waypoint_odr_service_account_name}"]
(local.install_name) = ["${var.waypoint_odr_namespace}:${var.waypoint_odr_service_account_name}"]
}

role_policy_arns = {
Expand Down
2 changes: 1 addition & 1 deletion aws-eks-byovpc/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ output "ecr" {
value = {
repository_url = module.ecr.repository_url
repository_arn = module.ecr.repository_arn
repository_name = local.vars.id
repository_name = local.install_name
registry_id = module.ecr.repository_registry_id
registry_url = "${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.region}.amazonaws.com"
}
Expand Down
1 change: 0 additions & 1 deletion aws-eks-byovpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ locals {
/* } */

vars = {
id = local.install_name
region = var.region
}
}
Expand Down

0 comments on commit e5d773a

Please sign in to comment.