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
19fcf0d6
Unverified
Commit
19fcf0d6
authored
Jan 11, 2022
by
Bryant Biggs
Committed by
GitHub
Jan 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Correct `for_each` map on VPC endpoints to propagate endpoint maps correctly (#729)
parent
5f5d8776
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
107 deletions
+123
-107
README.md
examples/complete-vpc/README.md
+1
-0
main.tf
examples/complete-vpc/main.tf
+19
-0
main.tf
modules/vpc-endpoints/main.tf
+2
-6
outputs.tf
outputs.tf
+101
-101
No files found.
examples/complete-vpc/README.md
View file @
19fcf0d6
...
...
@@ -42,6 +42,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Type |
|------|------|
|
[
aws_security_group.vpc_tls
](
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group
)
| resource |
|
[
aws_iam_policy_document.dynamodb_endpoint_policy
](
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document
)
| data source |
|
[
aws_iam_policy_document.generic_endpoint_policy
](
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document
)
| data source |
|
[
aws_security_group.default
](
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group
)
| data source |
...
...
examples/complete-vpc/main.tf
View file @
19fcf0d6
...
...
@@ -102,6 +102,7 @@ module "vpc_endpoints" {
service
=
"ssm"
private_dns_enabled
=
true
subnet_ids
=
module
.
vpc
.
private_subnets
security_group_ids
=
[
aws_security_group
.
vpc_tls
.
id
]
}
,
ssmmessages
=
{
service
=
"ssmmessages"
...
...
@@ -127,6 +128,7 @@ module "vpc_endpoints" {
service
=
"ec2"
private_dns_enabled
=
true
subnet_ids
=
module
.
vpc
.
private_subnets
security_group_ids
=
[
aws_security_group
.
vpc_tls
.
id
]
}
,
ec2messages
=
{
service
=
"ec2messages"
...
...
@@ -149,6 +151,7 @@ module "vpc_endpoints" {
service
=
"kms"
private_dns_enabled
=
true
subnet_ids
=
module
.
vpc
.
private_subnets
security_group_ids
=
[
aws_security_group
.
vpc_tls
.
id
]
}
,
codedeploy
=
{
service
=
"codedeploy"
...
...
@@ -232,3 +235,19 @@ data "aws_iam_policy_document" "generic_endpoint_policy" {
}
}
}
resource
"aws_security_group"
"vpc_tls"
{
name_prefix
=
"
${
local
.
name
}
-vpc_tls"
description
=
"Allow TLS inbound traffic"
vpc_id
=
module
.
vpc
.
vpc_id
ingress
{
description
=
"TLS from VPC"
from_port
=
443
to_port
=
443
protocol
=
"tcp"
cidr_blocks
=
[
module
.
vpc
.
vpc_cidr_block
]
}
tags
=
local
.
tags
}
modules/vpc-endpoints/main.tf
View file @
19fcf0d6
locals
{
endpoints
=
var
.
create
?
var
.
endpoints
:
tomap
(
{}
)
}
################################################################################
# Endpoint(s)
################################################################################
data
"aws_vpc_endpoint_service"
"this"
{
for_each
=
local
.
endpoints
for_each
=
{
for
k
,
v
in
var
.
endpoints
:
k
=
>
v
if
var
.
create
}
service
=
lookup
(
each
.
value
,
"service"
,
null
)
service_name
=
lookup
(
each
.
value
,
"service_name"
,
null
)
...
...
@@ -19,7 +15,7 @@ data "aws_vpc_endpoint_service" "this" {
}
resource
"aws_vpc_endpoint"
"this"
{
for_each
=
local
.
endpoints
for_each
=
{
for
k
,
v
in
var
.
endpoints
:
k
=
>
v
if
var
.
create
}
vpc_id
=
var
.
vpc_id
service_name
=
data
.
aws_vpc_endpoint_service
.
this
[
each
.
key
]
.
service_name
...
...
outputs.tf
View file @
19fcf0d6
This diff is collapsed.
Click to expand it.
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