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

feat: moving some tf locals to variables #151

Merged
merged 1 commit into from
Sep 21, 2023
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
5 changes: 4 additions & 1 deletion bootstrap/terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <provider>`

Expand Down
16 changes: 8 additions & 8 deletions bootstrap/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 = {
Expand All @@ -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({
Expand Down Expand Up @@ -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
Expand All @@ -234,15 +234,15 @@ 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"
provider_config_name = "aws-provider-config" #this is the providerConfigName used in all the examples in this repo
}

kubernetes_provider = {
enable = true
enable = var.enable_kubernetes_provider # defaults to true
version = "v0.9.0"
service_account = "kubernetes-provider"
name = "kubernetes-provider"
Expand All @@ -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"
Expand Down
30 changes: 30 additions & 0 deletions bootstrap/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
Loading