|
1 | 1 | provider "aws" { |
2 | 2 | region = local.region |
3 | 3 | } |
| 4 | +data "aws_caller_identity" "current" {} |
4 | 5 | data "aws_availability_zones" "available" {} |
5 | 6 |
|
6 | | - |
7 | 7 | provider "helm" { |
8 | 8 | kubernetes { |
9 | 9 | host = module.eks.cluster_endpoint |
@@ -43,9 +43,13 @@ provider "kubernetes" { |
43 | 43 | } |
44 | 44 |
|
45 | 45 | locals { |
46 | | - name = "ex-${replace(basename(path.cwd), "_", "-")}" |
47 | | - environment = "control-plane" |
48 | | - region = "us-west-2" |
| 46 | + name = "ex-${replace(basename(path.cwd), "_", "-")}" |
| 47 | + environment = "control-plane" |
| 48 | + region = "us-west-2" |
| 49 | + cluster_version = "1.27" |
| 50 | + gitops_url = var.gitops_url |
| 51 | + gitops_revision = var.gitops_revision |
| 52 | + gitops_path = var.gitops_path |
49 | 53 |
|
50 | 54 | aws_addons = { |
51 | 55 | enable_cert_manager = true |
@@ -87,20 +91,32 @@ locals { |
87 | 91 | #enable_vpa = true |
88 | 92 | #enable_foo = true # you can add any addon here, make sure to update the gitops repo with the corresponding application set |
89 | 93 | } |
90 | | - addons = merge(local.aws_addons, local.oss_addons) |
| 94 | + addons = merge(local.aws_addons, local.oss_addons, { kubernetes_version = local.cluster_version }) |
91 | 95 |
|
92 | | - addons_metadata = merge({ |
93 | | - aws_vpc_id = module.vpc.vpc_id # Only required when enabling the aws_gateway_api_controller addon |
94 | | - }, |
| 96 | + addons_metadata = merge( |
95 | 97 | module.eks_blueprints_addons.gitops_metadata, |
| 98 | + { |
| 99 | + aws_cluster_name = module.eks.cluster_name |
| 100 | + aws_region = local.region |
| 101 | + aws_account_id = data.aws_caller_identity.current.account_id |
| 102 | + aws_vpc_id = module.vpc.vpc_id |
| 103 | + }, |
96 | 104 | { |
97 | 105 | aws_crossplane_iam_role_arn = module.crossplane_irsa_aws.iam_role_arn |
98 | 106 | aws_upbound_crossplane_iam_role_arn = module.crossplane_irsa_aws.iam_role_arn |
| 107 | + }, |
| 108 | + { |
| 109 | + gitops_bridge_repo_url = local.gitops_url |
| 110 | + gitops_bridge_repo_revision = local.gitops_revision |
99 | 111 | } |
100 | 112 | ) |
101 | 113 |
|
102 | 114 | argocd_bootstrap_app_of_apps = { |
103 | | - addons = file("${path.module}/bootstrap/addons.yaml") |
| 115 | + addons = templatefile("${path.module}/bootstrap/addons.yaml", { |
| 116 | + repoURL = local.gitops_url |
| 117 | + targetRevision = local.gitops_revision |
| 118 | + path = local.gitops_path |
| 119 | + }) |
104 | 120 | workloads = file("${path.module}/bootstrap/workloads.yaml") |
105 | 121 | } |
106 | 122 |
|
@@ -209,7 +225,7 @@ module "eks" { |
209 | 225 | version = "~> 19.13" |
210 | 226 |
|
211 | 227 | cluster_name = local.name |
212 | | - cluster_version = "1.27" |
| 228 | + cluster_version = local.cluster_version |
213 | 229 | cluster_endpoint_public_access = true |
214 | 230 |
|
215 | 231 |
|
|
0 commit comments