-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor vpc-interface-endpoint (#20)
* Refactor vpc-interface-endpoint * Add examples for vpc-interface-endpoint
- Loading branch information
Showing
16 changed files
with
444 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
data "aws_subnet" "default" { | ||
for_each = toset(["use1-az1", "use1-az2"]) | ||
|
||
availability_zone_id = each.key | ||
default_for_az = true | ||
} | ||
|
||
|
||
################################################### | ||
# Interface Endpoint | ||
################################################### | ||
|
||
module "endpoint" { | ||
source = "../../modules/vpc-interface-endpoint" | ||
# source = "tedilabs/vpc-connectivity/aws//modules/vpc-interface-endpoint" | ||
# version = "~> 0.2.0" | ||
|
||
name = "interface-aws-s3" | ||
service_name = "com.amazonaws.us-east-1.s3" | ||
auto_accept = true | ||
|
||
policy = <<EOF | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Sid": "Allow-callers-from-specific-account", | ||
"Effect": "Allow", | ||
"Principal": "*", | ||
"Action": "*", | ||
"Resource": "*", | ||
"Condition": { | ||
"StringEquals": { | ||
"aws:PrincipalAccount": "111122223333" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
EOF | ||
|
||
## Network | ||
vpc_id = data.aws_vpc.default.id | ||
ip_address_type = "IPV4" | ||
network_mapping = { | ||
"use1-az1" = { | ||
subnet = data.aws_subnet.default["use1-az1"].id | ||
} | ||
"use1-az2" = { | ||
subnet = data.aws_subnet.default["use1-az2"].id | ||
} | ||
} | ||
default_security_group = { | ||
enabled = true | ||
name = "interface-aws-s3" | ||
description = "Managed by Terraform." | ||
ingress_rules = [ | ||
{ | ||
description = "Allow all outbound traffic by default." | ||
from_port = 0 | ||
to_port = 0 | ||
cidr_blocks = ["0.0.0.0/0"] | ||
}, | ||
] | ||
} | ||
security_groups = [] | ||
|
||
|
||
## DNS | ||
private_dns_enabled = false | ||
|
||
|
||
## Notifications | ||
connection_notifications = [ | ||
{ | ||
name = "admin-email" | ||
sns_topic = module.topic.arn | ||
events = ["Accept", "Reject"] | ||
} | ||
] | ||
|
||
|
||
tags = { | ||
"project" = "terraform-aws-vpc-connectivity-examples" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "endpoint" { | ||
description = "The Interface Endpoint." | ||
value = module.endpoint | ||
} | ||
|
||
output "topic" { | ||
description = "The SNS Topic." | ||
value = module.topic | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
################################################### | ||
# SNS Topic | ||
################################################### | ||
|
||
module "topic" { | ||
source = "tedilabs/messaging/aws//modules/sns-standard-topic" | ||
version = "~> 0.1.0" | ||
|
||
name = "interface-aws-s3" | ||
display_name = "Interface Endpoint Events" | ||
|
||
subscriptions_by_email = [ | ||
{ | ||
email = "[email protected]" | ||
}, | ||
] | ||
|
||
tags = { | ||
"project" = "terraform-aws-vpc-connectivity-examples" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = "~> 1.6" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
data "aws_vpc" "default" { | ||
default = true | ||
} | ||
|
||
|
||
################################################### | ||
# Interface Endpoint | ||
################################################### | ||
|
||
module "endpoint" { | ||
source = "../../modules/vpc-interface-endpoint" | ||
# source = "tedilabs/vpc-connectivity/aws//modules/vpc-interface-endpoint" | ||
# version = "~> 0.2.0" | ||
|
||
name = "interface-aws-s3" | ||
service_name = "com.amazonaws.us-east-1.s3" | ||
|
||
|
||
## Network | ||
vpc_id = data.aws_vpc.default.id | ||
|
||
|
||
tags = { | ||
"project" = "terraform-aws-vpc-connectivity-examples" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "endpoint" { | ||
description = "The Interface Endpoint." | ||
value = module.endpoint | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = "~> 1.6" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.