-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(providers): generate providers at run
- Loading branch information
Showing
22 changed files
with
327 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| include "root" { | ||
| path = find_in_parent_folders("root.hcl") | ||
| merge_strategy = "deep" | ||
| expose = true | ||
| } | ||
|
|
||
| # Generate an AWS provider block | ||
| generate "aws_provider" { | ||
| path = "${get_original_terragrunt_dir()}/aws_provider.tf" | ||
| if_exists = "overwrite_terragrunt" | ||
| contents = <<EOF | ||
| terraform { | ||
| required_version = ">= 1.5.0" | ||
| } | ||
| provider "aws" { | ||
| region = "${include.root.inputs.aws_region}" | ||
| profile = "${include.root.inputs.aws_profile}" | ||
| default_tags { | ||
| tags = { | ||
| ProjectNumber = "${include.root.inputs.project_number}" | ||
| "Project Name" = "${include.root.inputs.project_name}" | ||
| "Project Role" = "${include.root.inputs.project_role}" | ||
| "Project Identifier" = "${include.root.inputs.project_number}:${include.root.inputs.project_name}" | ||
| Organization = "${include.root.inputs.organization}" | ||
| created_by = "${include.root.inputs.creator}" | ||
| created_for = "${include.root.inputs.creator}" | ||
| created_reason = "${include.root.inputs.created_reason}" | ||
| Terraform = "${include.root.inputs.terraform}" | ||
| Terragrunt = "${include.root.inputs.terragrunt}" | ||
| } | ||
| } | ||
| # Only these AWS Account IDs may be operated on by this template | ||
| allowed_account_ids = ["${include.root.inputs.account_id}"] | ||
| } | ||
| EOF | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # lab/_envcommon/helm-provider.hcl | ||
|
|
||
| dependency "eks" { | ||
| config_path = "${get_original_terragrunt_dir()}/../eks" | ||
| mock_outputs = { | ||
| cluster_certificate_authority_data = [{data = "THISISAVERYLONGCERTSTRINGTHATGOESHEREFORSURENODYEP"}] | ||
| cluster_endpoint = "https://12345ABCDEE42BF9C24D4C362D1DC.sk1.us-gov-east-1.eks.amazonaws.com" | ||
| cluster_name = "a-cluster-name" | ||
| eks_managed_node_groups_autoscaling_group_names = ["eks-eks-a-cluster-name-node_group-0000000000000000000000000-5ac8a5e3-14dd-c043-2cc9-f4b6ffb36d32"] | ||
| oidc_provider_arn = "arn:aws-us-gov:iam::111111111111:oidc-provider/oidc.eks.us-gov-east-1.amazonaws.com/id/0000000000000000AAAAAAAAAAAAAAAA" | ||
| security_group_all_worker_mgmt_id = "sg-00b0000000000000" | ||
| subnets = ["subnet-00000000000000001", "subnet-00000000000000002", "subnet-00000000000000003"] | ||
| token = [{token = "THISISTHETOKENTHATDOESNTEXISTTHEREAREMANYLIKEITBUTHISONEISFORACLUSTER"}] | ||
| vpc_id = "a-vpc-id" | ||
| } | ||
| } | ||
|
|
||
| # Generate a helm provider block | ||
| generate "helm_provider" { | ||
| path = "${get_original_terragrunt_dir()}/helm_provider.tf" | ||
| if_exists = "overwrite_terragrunt" | ||
| contents = <<-EOF | ||
| terraform { | ||
| required_version = ">= 1.5.0" | ||
| } | ||
| data "aws_eks_cluster" "helm" { | ||
| name = "${dependency.eks.outputs.cluster_name}" | ||
| } | ||
| data "aws_eks_cluster_auth" "helm" { | ||
| name = "${dependency.eks.outputs.cluster_name}" | ||
| } | ||
| provider "helm" { | ||
| kubernetes { | ||
| host = data.aws_eks_cluster.helm[0].endpoint | ||
| cluster_ca_certificate = base64decode(data.aws_eks_cluster.helm[0].certificate_authority[0].data) | ||
| token = data.aws_eks_cluster_auth.helm.token | ||
| } | ||
| } | ||
| EOF | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # lab/_envcommon/kubernetes-provider.hcl | ||
|
|
||
| dependency "eks" { | ||
| config_path = "${get_original_terragrunt_dir()}/../eks" | ||
| mock_outputs = { | ||
| cluster_certificate_authority_data = [{data = "THISISAVERYLONGCERTSTRINGTHATGOESHEREFORSURENODYEP"}] | ||
| cluster_endpoint = "https://12345ABCDEE42BF9C24D4C362D1DC.sk1.us-gov-east-1.eks.amazonaws.com" | ||
| cluster_name = "a-cluster-name" | ||
| eks_managed_node_groups_autoscaling_group_names = ["eks-eks-a-cluster-name-node_group-0000000000000000000000000-5ac8a5e3-14dd-c043-2cc9-f4b6ffb36d32"] | ||
| oidc_provider_arn = "arn:aws-us-gov:iam::111111111111:oidc-provider/oidc.eks.us-gov-east-1.amazonaws.com/id/0000000000000000AAAAAAAAAAAAAAAA" | ||
| security_group_all_worker_mgmt_id = "sg-00b0000000000000" | ||
| subnets = ["subnet-00000000000000001", "subnet-00000000000000002", "subnet-00000000000000003"] | ||
| token = [{token = "THISISTHETOKENTHATDOESNTEXISTTHEREAREMANYLIKEITBUTHISONEISFORACLUSTER"}] | ||
| vpc_id = "a-vpc-id" | ||
| } | ||
| } | ||
|
|
||
| # Generate a k8s provider block | ||
| generate "kube_provider" { | ||
| path = "${get_original_terragrunt_dir()}/kube_provider.tf" | ||
| if_exists = "overwrite_terragrunt" | ||
| contents = <<-EOF | ||
| terraform { | ||
| required_version = ">= 1.5.0" | ||
| } | ||
| data "aws_eks_cluster" "kube" { | ||
| name = "${dependency.eks.outputs.cluster_name}" | ||
| } | ||
| data "aws_eks_cluster_auth" "kube" { | ||
| name = "${dependency.eks.outputs.cluster_name}" | ||
| } | ||
| provider "kubernetes" { | ||
| host = data.aws_eks_cluster.kube.endpoint | ||
| cluster_ca_certificate = base64decode(data.aws_eks_cluster.kube.certificate_authority[0].data) | ||
| token = data.aws_eks_cluster_auth.kube.token | ||
| } | ||
| EOF | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
lab/development/us-gov-east-1/vpc/platform-eng-eks-mcm/cluster.hcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Set cluster specific variables. These are automatically pulled in to configure the remote state bucket in the root | ||
| # terragrunt.hcl configuration. | ||
| locals { | ||
| cluster_endpoint_public_access = true | ||
| cluster_name = "platform-eng-eks-mcm" | ||
| cluster_version = "1.30" | ||
| creator = "matthew.c.morgan@census.gov" | ||
| eks_instance_disk_size = 100 | ||
| eks_ng_desired_size = 2 | ||
| eks_ng_max_size = 10 | ||
| eks_ng_min_size = 0 | ||
| enable_cluster_creator_admin_permissions = true | ||
| environment_abbr = "dev" | ||
| terraform = true | ||
| terragrunt = true | ||
| tags = { | ||
| "Environment" = local.environment_abbr | ||
| "slim:schedule" = "8:00-17:00" | ||
| "cluster:size" = "min:${local.eks_ng_min_size}-max:${local.eks_ng_max_size}-desired:${local.eks_ng_desired_size}" | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.