Skip to content

Commit 5e9feff

Browse files
fix(samples): vars and arguments
1 parent 3308002 commit 5e9feff

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

samples/ec2.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# - SECURITY GROUPS ---------------------------------------------------- #
22

33
resource "aws_security_group" "alpha_ec2" {
4+
# WARNING: generation was aws_vpc.ec2 => need to be aws_vpc.vpc
45
depends_on = [aws_vpc.alpha]
56
name = "${lookup(var.global, "name")}-ec2"
67
description = "${lookup(var.global, "name")}-ec2"

samples/variables.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
variable "global" {
22
type = map(string)
33
default = {
4+
# WARN: need to be alpha-lowercase with comma: NO spaces or Uppercase
45
name = "tfgui-alpha"
56
region = "us-east-1"
67
}
@@ -9,17 +10,22 @@ variable "global" {
910
variable "vpc" {
1011
type = map(string)
1112
default = {
13+
# WARN: need to be 'default'
1214
tenancy = "default"
1315
cidr = "10.0.0.0/24"
1416
pub_subnet = "10.0.0.128/26"
1517
prv_subnet = "10.0.0.192/26"
16-
eip_vpc = true
18+
# to be added respectively in public and private
19+
pub_availability_zone = "us-east-1a"
20+
prv_availability_zone = "us-east-1b"
21+
eip_vpc = true
1722
}
1823
}
1924

2025
variable "ec2" {
2126
type = map(string)
2227
default = {
28+
# WARN: need to be specific IDs (maybe use select form)
2329
ami = "ami-052efd3df9dad4825"
2430
type = "t2.micro"
2531
public_ip = true
@@ -41,6 +47,7 @@ variable "rds" {
4147
version = "13"
4248
family = "postgres13"
4349
username = "alpha"
50+
# WARN: need to be > 8 characters
4451
password = "alphaalphaalpha"
4552
publicly_accessible = false
4653
skip_final_snapshot = true

samples/vpc.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ resource "aws_nat_gateway" "alpha" {
3939
resource "aws_subnet" "alpha_pub" {
4040
vpc_id = aws_vpc.alpha.id
4141
cidr_block = lookup(var.vpc, "pub_subnet")
42+
# new var added in vpc group
43+
availability_zone = lookup(var.vpc, "pub_availability_zone")
4244
tags = {
4345
Name = "${lookup(var.global, "name")}-vpc-pub"
4446
}
@@ -47,6 +49,8 @@ resource "aws_subnet" "alpha_pub" {
4749
resource "aws_subnet" "alpha_prv" {
4850
vpc_id = aws_vpc.alpha.id
4951
cidr_block = lookup(var.vpc, "prv_subnet")
52+
# new var added in vpc group
53+
availability_zone = lookup(var.vpc, "prv_availability_zone")
5054
tags = {
5155
Name = "${lookup(var.global, "name")}-vpc-prv"
5256
}

0 commit comments

Comments
 (0)