Skip to content

Commit cd4fcaa

Browse files
committed
🔧 add output and update example
1 parent 7e0585a commit cd4fcaa

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ module "test" {
3434
| natgateway | nat gateway list of availability zone to spread | `list` | false | yes |
3535

3636
## output
37-
vpc_id
37+
| Name | Description | Type |
38+
|------|-------------|------|
39+
| vpc-id | the vpc id | string |
40+
| public-subnet-ids | a map of generated public subnet ids| map |
41+
| private-subnet-ids | a map of generated private subnet ids| map|

example/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,10 @@ module "test" {
1414
c = "10.17.10.0/23"
1515
}
1616
}
17+
18+
output "public-subnet-ids" {
19+
value = module.test.public-subnet-ids
20+
}
21+
output "a-private-subnet-id" {
22+
value = module.test.private-subnet-ids["a"]
23+
}

example/provider.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
provider "aws" {
2-
# i am using environment variables locally
3-
region = "us-east-1"
4-
# access_key = "AKIAZGWEKBAWRKPVLRIL"
5-
# secret_key = "my-secret-key"
62
default_tags {
73
tags = {
84
Provisioner = "Terraform"
95
Project = "POC"
10-
OWNER = "ops"
116
}
127
}
138
}

output.tf

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
output "vpc_id" {
2-
value=aws_vpc.vpc.id
1+
output "vpc-id" {
2+
value = aws_vpc.vpc.id
3+
}
4+
5+
output "public-subnet-ids" {
6+
value = { for k, v in aws_subnet.public-subnet : k => v.id }
7+
}
8+
9+
output "private-subnet-ids" {
10+
value = { for k, v in aws_subnet.private-subnet : k => v.id }
311
}

0 commit comments

Comments
 (0)