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
01601169
Commit
01601169
authored
Jan 11, 2019
by
ebarault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding option to create a route to nat gateway in database subnets
parent
c9bfc7ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
main.tf
main.tf
+12
-1
variables.tf
variables.tf
+5
-0
No files found.
main.tf
View file @
01601169
...
@@ -122,7 +122,7 @@ resource "aws_route_table" "database" {
...
@@ -122,7 +122,7 @@ resource "aws_route_table" "database" {
}
}
resource
"aws_route"
"database_internet_gateway"
{
resource
"aws_route"
"database_internet_gateway"
{
count
=
"
${
var
.
create_vpc
&&
var
.
create_database_subnet_route_table
&&
length
(
var
.
database_subnets
)
>
0
&&
var
.
create_database_internet_gateway_route
?
1
:
0
}
"
count
=
"
${
var
.
create_vpc
&&
var
.
create_database_subnet_route_table
&&
length
(
var
.
database_subnets
)
>
0
&&
var
.
create_database_internet_gateway_route
&&
!
var
.
create_database_nat_gateway_route
?
1
:
0
}
"
route_table_id
=
"
${
aws_route_table
.
database
.
id
}
"
route_table_id
=
"
${
aws_route_table
.
database
.
id
}
"
destination_cidr_block
=
"0.0.0.0/0"
destination_cidr_block
=
"0.0.0.0/0"
...
@@ -133,6 +133,17 @@ resource "aws_route" "database_internet_gateway" {
...
@@ -133,6 +133,17 @@ resource "aws_route" "database_internet_gateway" {
}
}
}
}
resource
"aws_route"
"database_nat_gateway"
{
count
=
"
${
var
.
create_vpc
&&
var
.
enable_nat_gateway
&&
var
.
create_database_subnet_route_table
&&
length
(
var
.
database_subnets
)
>
0
&&
var
.
create_database_nat_gateway_route
&&
!
var
.
create_database_internet_gateway_route
?
local
.
nat_gateway_count
:
0
}
"
route_table_id
=
"
${
element
(
aws_route_table
.
private
.
*
.
id
,
count
.
index
)
}
"
destination_cidr_block
=
"0.0.0.0/0"
nat_gateway_id
=
"
${
element
(
aws_nat_gateway
.
this
.
*
.
id
,
count
.
index
)
}
"
timeouts
{
create
=
"5m"
}
}
#################
#################
# Redshift routes
# Redshift routes
#################
#################
...
...
variables.tf
View file @
01601169
...
@@ -122,6 +122,11 @@ variable "create_database_internet_gateway_route" {
...
@@ -122,6 +122,11 @@ variable "create_database_internet_gateway_route" {
default
=
false
default
=
false
}
}
variable
"create_database_nat_gateway_route"
{
description
=
"Controls if a nat gateway route should be created to give internet access to the database subnets"
default
=
false
}
variable
"azs"
{
variable
"azs"
{
description
=
"A list of availability zones in the region"
description
=
"A list of availability zones in the region"
default
=
[]
default
=
[]
...
...
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