Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremycook123 committed Jun 6, 2024
1 parent 81f8531 commit b67df11
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 77 deletions.
10 changes: 6 additions & 4 deletions labfiles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ resource "aws_vpc" "region1" {
resource "aws_subnet" "region1" {
provider = aws

vpc_id = aws_vpc.region1.id
cidr_block = "10.201.0.0/24"
vpc_id = aws_vpc.region1.id
availability_zone = "us-east-1a"
cidr_block = "10.201.0.0/24"
}

resource "aws_security_group" "vpc_endpoint_s3_region1" {
Expand Down Expand Up @@ -168,8 +169,9 @@ resource "aws_vpc" "region2" {
resource "aws_subnet" "region2" {
provider = aws.us-west-2

vpc_id = aws_vpc.region2.id
cidr_block = "10.202.0.0/24"
vpc_id = aws_vpc.region2.id
availability_zone = "us-west-2a"
cidr_block = "10.202.0.0/24"
}

resource "aws_security_group" "vpc_endpoint_s3_region2" {
Expand Down
67 changes: 0 additions & 67 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,73 +104,6 @@ module "s3-dest" {
# }
}

# REGION 1 (us-east-1)
# ====================================

data "aws_vpc" "region1" {
# provider = aws.us-west-2

default = true
state = "available"
}

data "aws_subnet" "region1" {
# provider = aws.us-west-2

vpc_id = data.aws_vpc.region1.id
availability_zone = "us-east-1a"
state = "available"
}

module "vpc-endpoint-s3-global-region1" {
source = "./modules/vpc-endpoint"

private_dns_only_for_inbound_resolver_endpoint = false
configuration = {
service_name = "com.amazonaws.s3-global.accesspoint"
subnet_type = "Private"
region = "us-east-1"
}

vpc_id = data.aws_vpc.region1.id
subnet_ids = [data.aws_subnet.region1.id]
}

# REGION 2 (us-west-2)
# ====================================

data "aws_vpc" "region2" {
provider = aws.us-west-2

default = true
state = "available"
}

data "aws_subnet" "region2" {
provider = aws.us-west-2

vpc_id = data.aws_vpc.region2.id
availability_zone = "us-west-2a"
state = "available"
}

module "vpc-endpoint-s3-global-region2" {
providers = {
aws = aws.us-west-2
}
source = "./modules/vpc-endpoint"

private_dns_only_for_inbound_resolver_endpoint = false
configuration = {
service_name = "com.amazonaws.s3-global.accesspoint"
subnet_type = "Private"
region = "us-west-2"
}

vpc_id = data.aws_vpc.region2.id
subnet_ids = [data.aws_subnet.region2.id]
}

# S3 MRAP
# ====================================

Expand Down
13 changes: 7 additions & 6 deletions terraform/modules/vpc-endpoint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ terraform {
}

resource "aws_vpc_endpoint" "endpoint" {
vpc_endpoint_type = "Interface"
vpc_id = var.vpc_id
service_name = var.configuration.service_name
subnet_ids = var.subnet_ids
security_group_ids = var.security_group_ids
private_dns_enabled = var.private_dns_only_for_inbound_resolver_endpoint
vpc_endpoint_type = "Interface"
vpc_id = var.vpc_id
service_name = var.configuration.service_name
subnet_ids = var.subnet_ids
security_group_ids = var.security_group_ids
#private_dns_enabled = var.private_dns_only_for_inbound_resolver_endpoint
private_dns_enabled = true
}

0 comments on commit b67df11

Please sign in to comment.