generated from opsd-io/terraform-module-template
-
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.
- Loading branch information
Showing
14 changed files
with
273 additions
and
36 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
module "network" { | ||
source = "github.com/opsd-io/terraform-module-aws-network" | ||
|
||
vpc_name = "k8s-test-vpc" | ||
cidr_block = "10.100.0.0/16" | ||
|
||
public_subnet_groups = { | ||
"public1" = { | ||
availability_zones = { | ||
"a" = { cidr_block = "10.100.1.0/24", nat_gateway = true } | ||
"b" = { cidr_block = "10.100.2.0/24" } | ||
"c" = { cidr_block = "10.100.3.0/24" } | ||
} | ||
} | ||
} | ||
private_subnet_groups = { | ||
"nodes1" = { | ||
nat_group_name = "public1" | ||
availability_zones = { | ||
"a" = { cidr_block = "10.100.101.0/24" } | ||
"b" = { cidr_block = "10.100.102.0/24" } | ||
"c" = { cidr_block = "10.100.103.0/24" } | ||
} | ||
} | ||
"fargate1" = { | ||
nat_group_name = "public1" | ||
availability_zones = { | ||
"a" = { cidr_block = "10.100.201.0/24" } | ||
"b" = { cidr_block = "10.100.202.0/24" } | ||
"c" = { cidr_block = "10.100.203.0/24" } | ||
} | ||
} | ||
} | ||
} | ||
|
||
module "kubernetes" { | ||
source = "github.com/opsd-io/terraform-module-aws-kubernetes" | ||
name = "basic-k8s-example" | ||
|
||
subnet_ids = [ | ||
for subnet in module.network.public_subnet_groups["public1"] : subnet.id | ||
] | ||
|
||
node_group_subnet_ids = [ | ||
for subnet in module.network.private_subnet_groups["nodes1"] : subnet.id | ||
] | ||
node_groups = { | ||
main = { | ||
max_size = 9 | ||
desired_size = 1 | ||
disk_size = 8 | ||
} | ||
} | ||
|
||
fargate_subnet_ids = [ | ||
for subnet in module.network.private_subnet_groups["fargate1"] : subnet.id | ||
] | ||
fargate_profiles = { | ||
"default-namespace" = { # default is bad, better put it "far" | ||
namespace = "default" | ||
} | ||
"amazonaws-components" = { # this should put CoreDNS on fargate | ||
namespace = "*" | ||
labels = { "eks.amazonaws.com/component" = "*" } | ||
} | ||
} | ||
} | ||
|
||
module "autoscaler" { | ||
source = "github.com/opsd-io/terraform-module-eks-autoscaler" | ||
cluster_region = module.kubernetes.region | ||
cluster_name = module.kubernetes.name | ||
openid_arn = module.kubernetes.openid_arn | ||
openid_sub = module.kubernetes.openid_sub | ||
} |
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,9 @@ | ||
# output "network" { | ||
# description = "The network module outputs." | ||
# value = module.network | ||
# } | ||
|
||
output "kubernetes" { | ||
description = "The kubernetes module outputs." | ||
value = module.kubernetes | ||
} |
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,5 @@ | ||
# Make sure we're using working version (from local directory, not git). | ||
|
||
module "kubernetes" { | ||
source = "./../.." | ||
} |
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,32 @@ | ||
terraform { | ||
required_version = ">= 1.5.5" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.0" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = "eu-central-1" | ||
} | ||
|
||
data "aws_eks_cluster_auth" "this" { | ||
name = module.kubernetes.name | ||
} | ||
|
||
provider "kubernetes" { | ||
host = module.kubernetes.endpoint | ||
cluster_ca_certificate = module.kubernetes.cluster_ca | ||
token = data.aws_eks_cluster_auth.this.token | ||
} | ||
|
||
provider "helm" { | ||
kubernetes { | ||
host = module.kubernetes.endpoint | ||
cluster_ca_certificate = module.kubernetes.cluster_ca | ||
token = data.aws_eks_cluster_auth.this.token | ||
} | ||
} |
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,12 @@ | ||
#!/bin/sh -eux | ||
|
||
aws sts get-caller-identity | ||
|
||
aws eks update-kubeconfig \ | ||
--region "eu-central-1" \ | ||
--name "basic-k8s-example" \ | ||
--alias "k8s-example" | ||
|
||
kubectl version | ||
|
||
kubectl auth whoami |
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
Oops, something went wrong.