NEW: modulised terraform
This commit is contained in:
parent
7dc5288cb0
commit
f076837d3b
4
tf-modulised/.gitignore
vendored
Normal file
4
tf-modulised/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.tfstate
|
||||
*.tfstate.backup
|
||||
terraform.tfvars
|
||||
.terraform
|
10
tf-modulised/vpc-subnets/provider.tf
Normal file
10
tf-modulised/vpc-subnets/provider.tf
Normal file
@ -0,0 +1,10 @@
|
||||
variable "aws_access_key" {}
|
||||
variable "aws_secret_key" {}
|
||||
variable "aws_region" {}
|
||||
|
||||
provider "aws" {
|
||||
access_key = var.aws_access_key
|
||||
secret_key = var.aws_secret_key
|
||||
region = var.aws_region
|
||||
version = ">= 2.28.1"
|
||||
}
|
27
tf-modulised/vpc-subnets/vpc.tf
Normal file
27
tf-modulised/vpc-subnets/vpc.tf
Normal file
@ -0,0 +1,27 @@
|
||||
data "aws_availability_zones" "available" {}
|
||||
|
||||
resource "random_string" "suffix" {
|
||||
length = 4
|
||||
special = false
|
||||
}
|
||||
|
||||
module "vpc" {
|
||||
source = "terraform-aws-modules/vpc/aws"
|
||||
version = "2.6.0"
|
||||
|
||||
name = "demo-vpc-${random_string.suffix.result}"
|
||||
cidr = "172.16.0.0/16"
|
||||
azs = data.aws_availability_zones.available.names
|
||||
private_subnets = ["172.16.1.0/24", "172.16.2.0/24", "172.16.3.0/24"]
|
||||
public_subnets = ["172.16.4.0/24", "172.16.5.0/24", "172.16.6.0/24"]
|
||||
enable_nat_gateway = true
|
||||
single_nat_gateway = true
|
||||
enable_dns_hostnames = true
|
||||
|
||||
tags = {
|
||||
"owner" = "KF"
|
||||
"terraform" = "initial-deployment-only"
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user