From 6042440c0387c86c0bd11b2e12a26306dfc5010d Mon Sep 17 00:00:00 2001 From: Christina Andonov Date: Wed, 20 Sep 2023 16:27:18 -0700 Subject: [PATCH] adding variables --- bootstrap/terraform/README.md | 5 +++- bootstrap/terraform/main.tf | 16 +++++----- bootstrap/terraform/variables.tf | 30 +++++++++++++++++++ .../databases/dynamo-irsa/README.md | 2 +- 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/bootstrap/terraform/README.md b/bootstrap/terraform/README.md index f0bb83e0..87dd42ff 100644 --- a/bootstrap/terraform/README.md +++ b/bootstrap/terraform/README.md @@ -150,7 +150,10 @@ echo "$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{. ## Clean up 1. Delete resources created by Crossplane such as first Claims, then XRDs and Compositions. -1. Remove crossplane providers by setting `enable = false` in main.tf for each provider and running `terraform apply` +1. Remove crossplane providers by running +```bash +terraform apply --var enable_upbound_aws_provider=false --var enable_aws_provider=false --var enable_kubernetes_provider=false --var enable_helm_provider=false +``` 1. Run `kubectl get providers` to validate all providers were removed. If any left, remove using `kubectl delete providers ` diff --git a/bootstrap/terraform/main.tf b/bootstrap/terraform/main.tf index 56e87f92..b3b3bdc5 100644 --- a/bootstrap/terraform/main.tf +++ b/bootstrap/terraform/main.tf @@ -110,7 +110,7 @@ module "eks" { eks_managed_node_groups = { initial = { instance_types = ["m6i.large", "m5.large", "m5n.large", "m5zn.large"] - capacity_type = "SPOT" + capacity_type = var.capacity_type # defaults to SPOT min_size = 1 max_size = 5 desired_size = 3 @@ -127,7 +127,7 @@ module "eks" { module "eks_blueprints_addons" { source = "aws-ia/eks-blueprints-addons/aws" - version = "0.2.0" + version = "1.8.0" cluster_name = module.eks.cluster_name cluster_endpoint = module.eks.cluster_endpoint @@ -144,7 +144,7 @@ module "eks_blueprints_addons" { crossplane_kubernetes_provider_enable = local.kubernetes_provider.enable })] } - enable_karpenter = true + enable_gatekeeper = true enable_metrics_server = true enable_kube_prometheus_stack = true kube_prometheus_stack = { @@ -164,7 +164,7 @@ module "eks_blueprints_addons" { # Crossplane #--------------------------------------------------------------- module "crossplane" { - source = "./addon/" + source = "github.com/awslabs/crossplane-on-eks/bootstrap/terraform/addon/" enable_crossplane = true crossplane = { values = [yamlencode({ @@ -215,7 +215,7 @@ locals { crossplane_namespace = "crossplane-system" upbound_aws_provider = { - enable = true #NOTE: if you only use one aws provider, only enable one + enable = var.enable_upbound_aws_provider # defaults to true version = "v0.40.0" controller_config = "upbound-aws-controller-config" provider_config_name = "aws-provider-config" #this is the providerConfigName used in all the examples in this repo @@ -234,7 +234,7 @@ locals { } aws_provider = { - enable = false #NOTE: if you only use one aws provider, only enable one + enable = var.enable_aws_provider # defaults to false version = "v0.43.1" name = "aws-provider" controller_config = "aws-controller-config" @@ -242,7 +242,7 @@ locals { } kubernetes_provider = { - enable = true + enable = var.enable_kubernetes_provider # defaults to true version = "v0.9.0" service_account = "kubernetes-provider" name = "kubernetes-provider" @@ -252,7 +252,7 @@ locals { } helm_provider = { - enable = true + enable = var.enable_helm_provider # defaults to true version = "v0.15.0" service_account = "helm-provider" name = "helm-provider" diff --git a/bootstrap/terraform/variables.tf b/bootstrap/terraform/variables.tf index 8d8212a4..c358d10c 100644 --- a/bootstrap/terraform/variables.tf +++ b/bootstrap/terraform/variables.tf @@ -18,3 +18,33 @@ variable "cluster_version" { description = "Kubernetes Version" default = "1.27" } + +variable "capacity_type" { + type = string + description = "Capacity SPOT or ON_DEMAND" + default = "SPOT" +} + +variable "enable_upbound_aws_provider" { + type = bool + description = "Installs the upbound aws provider" + default = true +} + +variable "enable_aws_provider" { + type = bool + description = "Installs the contrib aws provider" + default = false +} + +variable "enable_kubernetes_provider" { + type = bool + description = "Installs the kubernetes provider" + default = true +} + +variable "enable_helm_provider" { + type = bool + description = "Installs the helm provider" + default = true +} diff --git a/examples/upbound-aws-provider/composite-resources/databases/dynamo-irsa/README.md b/examples/upbound-aws-provider/composite-resources/databases/dynamo-irsa/README.md index 3c4b8161..0726148f 100644 --- a/examples/upbound-aws-provider/composite-resources/databases/dynamo-irsa/README.md +++ b/examples/upbound-aws-provider/composite-resources/databases/dynamo-irsa/README.md @@ -63,7 +63,7 @@ kubectl apply -f claim/dynamo-irsa.yaml ``` Wait for the resources to come up and the claim to be ready ``` -kubect get dynamoirsa +kubectl get dynamoirsa ``` Expected output ```