Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
locals {
enabled = module.this.enabled

external_vpc_id = var.vpc_id != null ? { "ExternalVpcId" = var.vpc_id } : {}
networking_stack = var.networking_stack != null ? { "NetworkingStack" = var.networking_stack } : {}
subnet_ids = var.subnet_ids != null ? { "ExternalVpcSubnetIds" = join(",", var.subnet_ids) } : {}
external_vpc_id = var.vpc_id != null ? { "ExternalVpcId" = var.vpc_id } : {}
networking_stack = var.networking_stack != null ? { "NetworkingStack" = var.networking_stack } : {}
subnet_ids = concat(coalesce(var.public_subnet_ids, []), coalesce(var.private_subnet_ids, []))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
subnet_ids = concat(coalesce(var.public_subnet_ids, []), coalesce(var.private_subnet_ids, []))
subnet_ids = concat(var.public_subnet_ids, var.private_subnet_ids)

external_vpc_subnet_ids = length(local.subnet_ids) > 0 ? { "ExternalVpcSubnetIds" = join(",", local.subnet_ids) } : {}
// If var.security_group_id is provided, we use it. Otherwise, if we are using the external networking stack, we create one.
external_security_group_id = var.security_group_id != null ? { "ExternalVpcSecurityGroupId" = var.security_group_id } : {}
// If var.security_group_id is not provided and we are using the external networking stack, we create one.
Expand All @@ -14,7 +15,7 @@ locals {
}, var.parameters
, local.networking_stack
, local.external_vpc_id
, local.subnet_ids
, local.external_vpc_subnet_ids
, local.external_security_group_id
, local.created_security_group_id
)
Expand Down Expand Up @@ -70,7 +71,7 @@ module "iam_policy" {
]
}

// Typically when runs-on is installed, and we're using the embedded networking stack, we need a security group.
// Typically when runs-on is installed, and we're using the embedded networking stack, we need a security group.
// This is a batties included optional feature.
module "security_group" {
source = "cloudposse/security-group/aws"
Expand Down
11 changes: 9 additions & 2 deletions src/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,16 @@ variable "vpc_id" {
default = null
}

variable "subnet_ids" {
variable "public_subnet_ids" {
type = list(string)
description = "Subnet IDs"
description = "Public subnet IDs"
nullable = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nullable = true
nullable = false

default = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default = null
default = []

}

variable "private_subnet_ids" {
type = list(string)
description = "Private subnet IDs"
nullable = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nullable = true
nullable = false

default = null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default = null
default = []

}
Expand Down
Loading