Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-vpc
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-vpc
Commits
4416e379
Unverified
Commit
4416e379
authored
Oct 21, 2022
by
andrewtcymmer
Committed by
GitHub
Oct 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add custom subnet names (#816)
Co-authored-by:
Anton Babenko
<
anton@antonbabenko.com
>
parent
386de73a
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
22 deletions
+78
-22
.pre-commit-config.yaml
.pre-commit-config.yaml
+1
-1
README.md
README.md
+7
-0
main.tf
examples/complete-vpc/main.tf
+7
-0
main.tf
main.tf
+21
-21
variables.tf
variables.tf
+42
-0
No files found.
.pre-commit-config.yaml
View file @
4416e379
repos
:
-
repo
:
https://github.com/antonbabenko/pre-commit-terraform
rev
:
v1.7
5
.0
rev
:
v1.7
6
.0
hooks
:
-
id
:
terraform_fmt
-
id
:
terraform_validate
...
...
README.md
View file @
4416e379
This diff is collapsed.
Click to expand it.
examples/complete-vpc/main.tf
View file @
4416e379
...
...
@@ -31,6 +31,13 @@ module "vpc" {
redshift_subnets
=
[
"10.0.41.0/24"
,
"10.0.42.0/24"
,
"10.0.43.0/24"
]
intra_subnets
=
[
"10.0.51.0/24"
,
"10.0.52.0/24"
,
"10.0.53.0/24"
]
private_subnet_names
=
[
"Private Subnet One"
,
"Private Subnet Two"
]
# public_subnet_names omitted to show default name generation for all three subnets
database_subnet_names
=
[
"DB Subnet One"
]
elasticache_subnet_names
=
[
"Elasticache Subnet One"
,
"Elasticache Subnet Two"
]
redshift_subnet_names
=
[
"Redshift Subnet One"
,
"Redshift Subnet Two"
,
"Redshift Subnet Three"
]
intra_subnet_names
=
[]
create_database_subnet_group
=
false
manage_default_network_acl
=
true
...
...
main.tf
View file @
4416e379
...
...
@@ -370,9 +370,9 @@ resource "aws_subnet" "public" {
tags
=
merge
(
{
"Name"
=
format
(
"
${
var
.
name
}
-
${
var
.
public_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
),
Name
=
try
(
var
.
public_subnet_names
[
count
.
index
]
,
format
(
"
${
var
.
name
}
-
${
var
.
public_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
))
)
}
,
var
.
tags
,
...
...
@@ -397,9 +397,9 @@ resource "aws_subnet" "private" {
tags
=
merge
(
{
"Name"
=
format
(
"
${
var
.
name
}
-
${
var
.
private_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
),
Name
=
try
(
var
.
private_subnet_names
[
count
.
index
]
,
format
(
"
${
var
.
name
}
-
${
var
.
private_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
))
)
}
,
var
.
tags
,
...
...
@@ -425,9 +425,9 @@ resource "aws_subnet" "outpost" {
tags
=
merge
(
{
"Name"
=
format
(
"
${
var
.
name
}
-
${
var
.
outpost_subnet_suffix
}
-%s"
,
var
.
outpost_az
,
Name
=
try
(
var
.
outpost_subnet_names
[
count
.
index
]
,
format
(
"
${
var
.
name
}
-
${
var
.
outpost_subnet_suffix
}
-%s"
,
var
.
outpost_az
)
)
}
,
var
.
tags
,
...
...
@@ -452,9 +452,9 @@ resource "aws_subnet" "database" {
tags
=
merge
(
{
"Name"
=
format
(
"
${
var
.
name
}
-
${
var
.
database_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
),
Name
=
try
(
var
.
database_subnet_names
[
count
.
index
]
,
format
(
"
${
var
.
name
}
-
${
var
.
database_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
),
)
)
}
,
var
.
tags
,
...
...
@@ -495,9 +495,9 @@ resource "aws_subnet" "redshift" {
tags
=
merge
(
{
"Name"
=
format
(
"
${
var
.
name
}
-
${
var
.
redshift_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
),
Name
=
try
(
var
.
redshift_subnet_names
[
count
.
index
]
,
format
(
"
${
var
.
name
}
-
${
var
.
redshift_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
))
)
}
,
var
.
tags
,
...
...
@@ -536,9 +536,9 @@ resource "aws_subnet" "elasticache" {
tags
=
merge
(
{
"Name"
=
format
(
"
${
var
.
name
}
-
${
var
.
elasticache_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
),
Name
=
try
(
var
.
elasticache_subnet_names
[
count
.
index
]
,
format
(
"
${
var
.
name
}
-
${
var
.
elasticache_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
))
)
}
,
var
.
tags
,
...
...
@@ -577,9 +577,9 @@ resource "aws_subnet" "intra" {
tags
=
merge
(
{
"Name"
=
format
(
"
${
var
.
name
}
-
${
var
.
intra_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
),
Name
=
try
(
var
.
intra_subnet_names
[
count
.
index
]
,
format
(
"
${
var
.
name
}
-
${
var
.
intra_subnet_suffix
}
-%s"
,
element
(
var
.
azs
,
count
.
index
))
)
}
,
var
.
tags
,
...
...
variables.tf
View file @
4416e379
...
...
@@ -136,6 +136,48 @@ variable "private_subnet_suffix" {
default
=
"private"
}
variable
"public_subnet_names"
{
description
=
"Explicit values to use in the Name tag on public subnets. If empty, Name tags are generated."
type
=
list
(
string
)
default
=
[]
}
variable
"private_subnet_names"
{
description
=
"Explicit values to use in the Name tag on private subnets. If empty, Name tags are generated."
type
=
list
(
string
)
default
=
[]
}
variable
"outpost_subnet_names"
{
description
=
"Explicit values to use in the Name tag on outpost subnets. If empty, Name tags are generated."
type
=
list
(
string
)
default
=
[]
}
variable
"intra_subnet_names"
{
description
=
"Explicit values to use in the Name tag on intra subnets. If empty, Name tags are generated."
type
=
list
(
string
)
default
=
[]
}
variable
"database_subnet_names"
{
description
=
"Explicit values to use in the Name tag on database subnets. If empty, Name tags are generated."
type
=
list
(
string
)
default
=
[]
}
variable
"redshift_subnet_names"
{
description
=
"Explicit values to use in the Name tag on redshift subnets. If empty, Name tags are generated."
type
=
list
(
string
)
default
=
[]
}
variable
"elasticache_subnet_names"
{
description
=
"Explicit values to use in the Name tag on elasticache subnets. If empty, Name tags are generated."
type
=
list
(
string
)
default
=
[]
}
variable
"outpost_subnet_suffix"
{
description
=
"Suffix to append to outpost subnets name"
type
=
string
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment