Skip to content

Commit

Permalink
Merge pull request #92 from jysaad/remove-create-var
Browse files Browse the repository at this point in the history
  • Loading branch information
lorengordon authored Oct 2, 2020
2 parents c174dd0 + 7b8fd77 commit 3a9ca04
Show file tree
Hide file tree
Showing 21 changed files with 6 additions and 56 deletions.
3 changes: 1 addition & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[bumpversion]
current_version = 4.0.1
current_version = 5.0.0
commit = True
message = Bumps version to {new_version}
tag = False
tag_name = {new_version}

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Then commit the updated files.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| create\_sg\_per\_endpoint | Toggle to create a SecurityGroup for each VPC Endpoint. Defaults to using just one for all Interface Endpoints. Note that Gateway Endpoints don't support SecurityGroups. | `bool` | `false` | no |
| create\_vpc\_endpoints | Toggle to create VPC Endpoints. | `bool` | `true` | no |
| sg\_egress\_rules | Egress rules for the VPC Endpoint SecurityGroup(s). Set to empty list to disable default rules. | <pre>list(object({<br> description = string<br> prefix_list_ids = list(string)<br> from_port = number<br> to_port = number<br> protocol = string<br> cidr_blocks = list(string)<br> ipv6_cidr_blocks = list(string)<br> security_groups = list(string)<br> }))</pre> | <pre>[<br> {<br> "cidr_blocks": [<br> "0.0.0.0/0"<br> ],<br> "description": null,<br> "from_port": 0,<br> "ipv6_cidr_blocks": null,<br> "prefix_list_ids": null,<br> "protocol": "-1",<br> "security_groups": null,<br> "to_port": 0<br> }<br>]</pre> | no |
| sg\_ingress\_rules | Ingress rules for the VPC Endpoint SecurityGroup(s). Set to empty list to disable default rules. | <pre>list(object({<br> description = string<br> prefix_list_ids = list(string)<br> from_port = number<br> to_port = number<br> protocol = string<br> cidr_blocks = list(string)<br> ipv6_cidr_blocks = list(string)<br> security_groups = list(string)<br> }))</pre> | <pre>[<br> {<br> "cidr_blocks": [<br> "0.0.0.0/0"<br> ],<br> "description": null,<br> "from_port": 0,<br> "ipv6_cidr_blocks": null,<br> "prefix_list_ids": null,<br> "protocol": "-1",<br> "security_groups": null,<br> "to_port": 0<br> }<br>]</pre> | no |
| subnet\_ids | Target Subnet ids. | `list(string)` | `[]` | no |
Expand Down
5 changes: 2 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
data "aws_subnet" "selected" {
count = var.create_vpc_endpoints ? 1 : 0

id = var.subnet_ids[0]
}

data "aws_region" "selected" {}

data "aws_vpc_endpoint_service" "this" {
for_each = toset(var.create_vpc_endpoints ? var.vpc_endpoint_services : [])
for_each = toset(var.vpc_endpoint_services)

// If we get a "common name" (like "kms") we must generate a fully qualified name.
// If the name contains the current region we trust the user to have provided a valid fully qualified name.
Expand All @@ -26,7 +25,7 @@ locals {
interface_endpoints = toset([for e in data.aws_vpc_endpoint_service.this : e.service_name if e.service_type == "Interface"])

# Only Interface Endpoints support SGs
security_groups = toset(var.create_vpc_endpoints ? var.create_sg_per_endpoint ? local.interface_endpoints : ["shared"] : [])
security_groups = toset(var.create_sg_per_endpoint ? local.interface_endpoints : ["shared"])
}

resource "aws_security_group" "this" {
Expand Down
1 change: 0 additions & 1 deletion tests/config_endpoint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module "config_endpoint" {
aws = aws
}

create_vpc_endpoints = true
vpc_endpoint_services = ["config"]
subnet_ids = module.vpc.private_subnets
}
3 changes: 0 additions & 3 deletions tests/config_endpoint/versions.tf

This file was deleted.

1 change: 0 additions & 1 deletion tests/custom_sg_rules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ module "custom_sg_rules" {
aws = aws
}

create_vpc_endpoints = true
vpc_endpoint_services = ["config"]
subnet_ids = module.vpc.private_subnets
sg_ingress_rules = local.sg_ingress_rules
Expand Down
3 changes: 0 additions & 3 deletions tests/custom_sg_rules/versions.tf

This file was deleted.

1 change: 0 additions & 1 deletion tests/fully_qualified_name_endpoint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module "fully_qualified_name_endpoint" {
aws = aws
}

create_vpc_endpoints = true
vpc_endpoint_services = ["aws.sagemaker.us-east-1.notebook"]
subnet_ids = module.vpc.private_subnets
}
3 changes: 0 additions & 3 deletions tests/fully_qualified_name_endpoint/versions.tf

This file was deleted.

1 change: 0 additions & 1 deletion tests/gateway_type_endpoint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module "gateway_type_endpoint" {
aws = aws
}

create_vpc_endpoints = true
vpc_endpoint_services = ["s3"]
subnet_ids = module.vpc.private_subnets
}
3 changes: 0 additions & 3 deletions tests/gateway_type_endpoint/versions.tf

This file was deleted.

2 changes: 2 additions & 0 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200109152110-61a87790db17 h1:nVJ3guKA9qdkEQ3TUdXI9QSINo2CUPM/cySEvw2w8I0=
golang.org/x/crypto v0.0.0-20200109152110-61a87790db17/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -620,6 +621,7 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
1 change: 0 additions & 1 deletion tests/multiple_endpoints/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module "config_endpoint" {
aws = aws
}

create_vpc_endpoints = true
vpc_endpoint_services = [
"config",
"codepipeline",
Expand Down
3 changes: 0 additions & 3 deletions tests/multiple_endpoints/versions.tf

This file was deleted.

12 changes: 0 additions & 12 deletions tests/no_create/main.tf

This file was deleted.

3 changes: 0 additions & 3 deletions tests/no_create/versions.tf

This file was deleted.

3 changes: 1 addition & 2 deletions tests/no_endpoints/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ module "config_endpoint" {
aws = aws
}

create_vpc_endpoints = true
subnet_ids = module.vpc.private_subnets
subnet_ids = module.vpc.private_subnets
}
3 changes: 0 additions & 3 deletions tests/no_endpoints/versions.tf

This file was deleted.

1 change: 0 additions & 1 deletion tests/sg_per_endpoint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module "sg_per_endpoint" {
aws = aws
}

create_vpc_endpoints = true
vpc_endpoint_services = ["s3", "sns"]
subnet_ids = module.vpc.private_subnets
create_sg_per_endpoint = true
Expand Down
3 changes: 0 additions & 3 deletions tests/sg_per_endpoint/versions.tf

This file was deleted.

6 changes: 0 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ variable "create_sg_per_endpoint" {
default = false
}

variable "create_vpc_endpoints" {
description = "Toggle to create VPC Endpoints."
type = bool
default = true
}

variable "sg_egress_rules" {
description = "Egress rules for the VPC Endpoint SecurityGroup(s). Set to empty list to disable default rules."
type = list(object({
Expand Down

0 comments on commit 3a9ca04

Please sign in to comment.