terraform-aws-modules / terraform-aws-autoscaling

Terraform module to create AWS Auto Scaling resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws
Apache License 2.0
292 stars 558 forks source link

set static IPs / how to use private_ip_addresses #263

Closed daodennis closed 6 months ago

daodennis commented 6 months ago

Hi,

I am trying to setup two boxes using one of two IP addresses depending on which subnet / availability zone it is placed in but passing in a list of IP addresses yields. I have considered setting up a /28, but I don't necessarily need 14 or so addresses for this use-case, however would love an ASG in case the instance goes down.

I have also tried to pass in an aws_network_interfaces into the module, and that actually has either no effect or an error like local. security_group_ids is tuple with 4 elements

Error: updating Auto Scaling Group (fix-20231103045202846800000001): InvalidQueryParameter: Incompatible launch template: Auto Scaling does not support Private IP addresses.
│   status code: 400, request id: b019077e-a28b-40d8-8afc-7390c607633e
│
│   with module.role.aws_autoscaling_group.this[0],
│   on .terraform/modules/role/main.tf line 345, in resource "aws_autoscaling_group" "this":
│  345: resource "aws_autoscaling_group" "this" {
│

The above is from setting these:

  network_interfaces = [
    {
      delete_on_termination = false
      description           = "eth0"
      device_index          = 0
      security_groups       = local.security_group_ids
      ipv4_addresses          = ["10.2.10.10", "10.2.16.16"]
    }
  ]

I have also like I said above tried to create two aws_network_interfaces and passed them in as two interfaces in a list or aws_network_interfaces.name[*] <-- this has no effect, the prior yields the error about security groups not being the correct type from above.

Слава Україні!

Денис

antonbabenko commented 6 months ago

This cannot be implemented using the autoscaling groups feature or this module. Please ask generic questions about this or Terraform at https://discuss.hashicorp.com and check the official AWS documentation for available features.

github-actions[bot] commented 5 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.