Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Auto-assign public IP in VPC config #100

Open
piotr-rzepa opened this issue Jan 17, 2025 · 0 comments
Open

[Bug Report] Auto-assign public IP in VPC config #100

piotr-rzepa opened this issue Jan 17, 2025 · 0 comments

Comments

@piotr-rzepa
Copy link
Contributor

piotr-rzepa commented Jan 17, 2025

Describe the bug

Bug description

in VPC module, inside options variable object, there is a map_public_ip_on_launch property, which controls assignment of public Ipv4 address when launching resources in the given subnet(s). The module does not give an option to specify this setting at subnet level, e.g. as a property in a subnets variable.
Currently it's not possible to deploy public and private subnets, where public subnets would have public IP assignment enabled and private subnets would have the same option disabled. You can either deploy all subnets with this setting enabled or not.

resource "aws_subnet" "this" {
  for_each = { for k, v in var.subnets : k => v if v.create_subnet }

<redacted for brevity>

  map_public_ip_on_launch = var.options.map_public_ip_on_launch

<redacted for brevity>
}

This option should be probably moved to the subnets variable, like so:

resource "aws_subnet" "this" {
  for_each = { for k, v in var.subnets : k => v if v.create_subnet }

<redacted for brevity>

  map_public_ip_on_launch = each.value.map_public_ip_on_launch

<redacted for brevity>
}

Another possibility could be to keep the option in the VPC in order to provide a global setting, which could then be overwritten by a subnet-level configuration

Module Version

v3.0.0-rc.1

Terraform version

Terraform v1.10.0 on linux_amd64 + provider registry.terraform.io/hashicorp/aws v5.17.0

Expected behavior

Ability to specify public IP auto-assignment at subnet-level

Current behavior

You have to either enable to disable public IP auto-assignment at VPC level for all of the declared subnets

Anything else to add?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant