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(vpc): removed default vpc fallback config #132

Merged
merged 11 commits into from
Feb 24, 2022
6 changes: 4 additions & 2 deletions examples/addon/default.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name = "eks-addon"
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
use_default_vpc = true
name = "eks-addon"
tags = {
env = "dev"
}
aws_region = "ap-northeast-2"
enable_ssm = true
kubernetes_version = "1.21"
managed_node_groups = [
Expand Down
17 changes: 16 additions & 1 deletion examples/addon/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ provider "aws" {
region = var.aws_region
}

### eks
# vpc
module "vpc" {
source = "Young-ook/sagemaker/aws//modules/vpc"
version = "> 0.0.6"
name = var.name
tags = var.tags
vpc_config = var.use_default_vpc ? null : {
azs = var.azs
cidr = "10.10.0.0/16"
subnet_type = "private"
single_ngw = true
}
}

# eks
module "eks" {
source = "../../"
name = var.name
tags = var.tags
subnets = slice(values(module.vpc.subnets[var.use_default_vpc ? "public" : "private"]), 0, 3)
kubernetes_version = var.kubernetes_version
managed_node_groups = var.managed_node_groups
enable_ssm = var.enable_ssm
Expand Down
5 changes: 5 additions & 0 deletions examples/addon/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "vpc" {
description = "The attributes of Amazon VPC"
value = module.vpc.vpc
}

output "kubeconfig" {
description = "Bash script to update kubeconfig file"
value = module.eks.kubeconfig
Expand Down
11 changes: 10 additions & 1 deletion examples/addon/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
variable "aws_region" {
description = "The aws region to deploy"
type = string
default = "us-east-1"
}

variable "use_default_vpc" {
description = "A feature flag for whether to use default vpc"
type = bool
}

variable "azs" {
description = "A list of availability zones for the vpc to deploy resources"
type = list(string)
}

### kubernetes cluster
Expand Down
7 changes: 4 additions & 3 deletions examples/app-mesh/default.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2c", "ap-northeast-2d"]
name = "eks-appmesh"
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2c", "ap-northeast-2d"]
use_default_vpc = true
name = "eks-appmesh"
tags = {
env = "dev"
}
Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions examples/app-mesh/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,26 @@ module "codebuild" {
tags = var.tags
}

# vpc
module "vpc" {
source = "Young-ook/sagemaker/aws//modules/vpc"
version = "> 0.0.6"
name = var.name
tags = var.tags
vpc_config = var.use_default_vpc ? null : {
azs = var.azs
cidr = "10.10.0.0/16"
subnet_type = "private"
single_ngw = true
}
}

# eks
module "eks" {
source = "Young-ook/eks/aws"
name = var.name
tags = var.tags
subnets = slice(values(module.vpc.subnets[var.use_default_vpc ? "public" : "private"]), 0, 3)
kubernetes_version = var.kubernetes_version
managed_node_groups = var.managed_node_groups
node_groups = var.node_groups
Expand Down
5 changes: 5 additions & 0 deletions examples/app-mesh/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "vpc" {
description = "The attributes of Amazon VPC"
value = module.vpc.vpc
}

output "eks" {
description = "The generated AWS EKS cluster"
value = module.eks.cluster
Expand Down
13 changes: 5 additions & 8 deletions examples/app-mesh/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
variable "aws_region" {
description = "The aws region to deploy"
type = string
default = "us-east-1"
}

variable "azs" {
description = "A list of availability zones for the vpc to deploy resources"
type = list(string)
default = ["us-east-1a", "us-east-1b", "us-east-1c"]
variable "use_default_vpc" {
description = "A feature flag for whether to use default vpc"
type = bool
}

variable "subnets" {
description = "The list of subnets to deploy an eks cluster"
variable "azs" {
description = "A list of availability zones for the vpc to deploy resources"
type = list(string)
default = null
}

### kubernetes cluster
Expand Down
7 changes: 4 additions & 3 deletions examples/arm64/default.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
aws_region = "ap-northeast-1"
azs = ["ap-northeast-1a", "ap-northeast-1c", "ap-northeast-1d"]
name = "eks-arm64"
aws_region = "ap-northeast-1"
azs = ["ap-northeast-1a", "ap-northeast-1c", "ap-northeast-1d"]
use_default_vpc = true
name = "eks-arm64"
tags = {
env = "dev"
arch = "arm64"
Expand Down
15 changes: 15 additions & 0 deletions examples/arm64/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,26 @@ provider "aws" {
region = var.aws_region
}

# vpc
module "vpc" {
source = "Young-ook/sagemaker/aws//modules/vpc"
version = "> 0.0.6"
name = var.name
tags = var.tags
vpc_config = var.use_default_vpc ? null : {
azs = var.azs
cidr = "10.10.0.0/16"
subnet_type = "private"
single_ngw = true
}
}

# eks
module "eks" {
source = "Young-ook/eks/aws"
name = var.name
tags = var.tags
subnets = slice(values(module.vpc.subnets[var.use_default_vpc ? "public" : "private"]), 0, 3)
kubernetes_version = var.kubernetes_version
managed_node_groups = var.managed_node_groups
node_groups = var.node_groups
Expand Down
5 changes: 5 additions & 0 deletions examples/arm64/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "vpc" {
description = "The attributes of Amazon VPC"
value = module.vpc.vpc
}

output "eks" {
description = "The generated AWS EKS cluster"
value = module.eks.cluster
Expand Down
13 changes: 5 additions & 8 deletions examples/arm64/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
variable "aws_region" {
description = "The aws region to deploy"
type = string
default = "us-east-1"
}

variable "azs" {
description = "A list of availability zones for the vpc to deploy resources"
type = list(string)
default = ["us-east-1a", "us-east-1b", "us-east-1c"]
variable "use_default_vpc" {
description = "A feature flag for whether to use default vpc"
type = bool
}

variable "subnets" {
description = "The list of subnets to deploy an eks cluster"
variable "azs" {
description = "A list of availability zones for the vpc to deploy resources"
type = list(string)
default = null
}

### kubernetes cluster
Expand Down
7 changes: 4 additions & 3 deletions examples/autoscaling/default.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
name = "eks-autoscaling"
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
use_default_vpc = true
name = "eks-autoscaling"
tags = {
env = "dev"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
name = "eks-autoscaling-tc1"
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
use_default_vpc = false
name = "eks-autoscaling-tc1"
tags = {
env = "dev"
test = "tc1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
name = "eks-autoscaling-tc3"
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
use_default_vpc = false
name = "eks-autoscaling-tc3"
tags = {
env = "dev"
test = "tc3"
Expand Down
15 changes: 15 additions & 0 deletions examples/autoscaling/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ provider "aws" {
region = var.aws_region
}

# vpc
module "vpc" {
source = "Young-ook/sagemaker/aws//modules/vpc"
version = "> 0.0.6"
name = var.name
tags = var.tags
vpc_config = var.use_default_vpc ? null : {
azs = var.azs
cidr = "10.10.0.0/16"
subnet_type = "private"
single_ngw = true
}
}

# eks
module "eks" {
source = "Young-ook/eks/aws"
name = var.name
tags = var.tags
subnets = slice(values(module.vpc.subnets[var.use_default_vpc ? "public" : "private"]), 0, 3)
kubernetes_version = var.kubernetes_version
managed_node_groups = var.managed_node_groups
node_groups = var.node_groups
Expand Down
5 changes: 5 additions & 0 deletions examples/autoscaling/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "vpc" {
description = "The attributes of Amazon VPC"
value = module.vpc.vpc
}

output "eks" {
description = "The generated AWS EKS cluster"
value = module.eks.cluster
Expand Down
13 changes: 5 additions & 8 deletions examples/autoscaling/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
variable "aws_region" {
description = "The aws region to deploy"
type = string
default = "us-east-1"
}

variable "azs" {
description = "A list of availability zones for the vpc to deploy resources"
type = list(string)
default = ["us-east-1a", "us-east-1b", "us-east-1c"]
variable "use_default_vpc" {
description = "A feature flag for whether to use default vpc"
type = bool
}

variable "subnets" {
description = "The list of subnets to deploy an eks cluster"
variable "azs" {
description = "A list of availability zones for the vpc to deploy resources"
type = list(string)
default = null
}

### kubernetes cluster
Expand Down
6 changes: 4 additions & 2 deletions examples/bottlerocket/default.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
aws_region = "ap-northeast-2"
name = "eks-bottlerocket"
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2b", "ap-northeast-2c"]
use_default_vpc = true
name = "eks-bottlerocket"
tags = {
env = "dev"
}
Expand Down
5 changes: 3 additions & 2 deletions examples/bottlerocket/fixture.tc1.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
aws_region = "ap-northeast-2"
name = "eks-bottlerocket-tc1"
aws_region = "ap-northeast-2"
use_default_vpc = false
name = "eks-bottlerocket-tc1"
tags = {
env = "dev"
test = "tc1"
Expand Down
15 changes: 15 additions & 0 deletions examples/bottlerocket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,26 @@ provider "aws" {
region = var.aws_region
}

# vpc
module "vpc" {
source = "Young-ook/sagemaker/aws//modules/vpc"
version = "> 0.0.6"
name = var.name
tags = var.tags
vpc_config = var.use_default_vpc ? null : {
azs = var.azs
cidr = "10.10.0.0/16"
subnet_type = "private"
single_ngw = true
}
}

# eks
module "eks" {
source = "../../"
name = var.name
tags = var.tags
subnets = slice(values(module.vpc.subnets[var.use_default_vpc ? "public" : "private"]), 0, 3)
kubernetes_version = var.kubernetes_version
managed_node_groups = var.managed_node_groups
node_groups = var.node_groups
Expand Down
5 changes: 5 additions & 0 deletions examples/bottlerocket/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "vpc" {
description = "The attributes of Amazon VPC"
value = module.vpc.vpc
}

output "eks" {
description = "The generated AWS EKS cluster"
value = module.eks.cluster
Expand Down
11 changes: 10 additions & 1 deletion examples/bottlerocket/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
variable "aws_region" {
description = "The aws region to deploy"
type = string
default = "us-east-1"
}

variable "use_default_vpc" {
description = "A feature flag for whether to use default vpc"
type = bool
}

variable "azs" {
description = "A list of availability zones for the vpc to deploy resources"
type = list(string)
}

### kubernetes cluster
Expand Down
7 changes: 4 additions & 3 deletions examples/cw/default.auto.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2c", "ap-northeast-2d"]
name = "eks-cw"
aws_region = "ap-northeast-2"
azs = ["ap-northeast-2a", "ap-northeast-2c", "ap-northeast-2d"]
use_default_vpc = true
name = "eks-cw"
tags = {
env = "dev"
metrics = "false"
Expand Down
Loading