NEW: first commit

This commit is contained in:
xpk
2020-08-02 19:08:53 +08:00
commit 50cb3acfbc
14 changed files with 249 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
# terraform.tfvars example
```
aws_access_key = "..."
aws_secret_key = "..."
aws_region = "ap-east-1"
default-tags = {
"owner" = "KF"
"terraform" = "initial-deployment-only"
"environment" = "demo"
"project" = "project1"
"application" = "network"
}
```
+17
View File
@@ -0,0 +1,17 @@
resource "random_string" "string" {
length = 4
special = false
}
resource "random_integer" "number" {
min = 1000
max = 9999
}
output "string" {
value = random_string.string.result
}
output "number" {
value = random_integer.number.result
}
+6
View File
@@ -0,0 +1,6 @@
name,value
owner,KF
terraform,initial-deploy-only
environment,demo
project,project1
application,network
1 name value
2 owner KF
3 terraform initial-deploy-only
4 environment demo
5 project project1
6 application network
+12
View File
@@ -0,0 +1,12 @@
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"
}
variable "default-tags" {}
+23
View File
@@ -0,0 +1,23 @@
data "aws_availability_zones" "available" {}
module "random" {
source = "./m.random"
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "2.6.0"
name = "demo-vpc-${module.random.number}"
cidr = "172.16.0.0/16"
azs = data.aws_availability_zones.available.names
private_subnets = cidrsubnets("172.16.18.0/23", 1, 1)
public_subnets = cidrsubnets("172.16.20.0/23", 1, 1)
enable_nat_gateway = false
single_nat_gateway = true
enable_dns_hostnames = true
tags = var.default-tags
}