hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.7k stars 9.07k forks source link

[Bug]: provided private_ip of network interface is not applied #35350

Closed saiprasad-dhumal-ms closed 5 months ago

saiprasad-dhumal-ms commented 7 months ago

Terraform Core Version

1.6.6

AWS Provider Version

3.65.0

Affected Resource(s)

aws network interface: when we specify the private_ip address of network interface while creating, terraform plan will show it correctly but after terraform apply, assigned primary private IP address is different. Note that we already checked given IP is available in VPC.

Expected Behavior

Provided primary private IP should be the we specify in argument private_ip

Actual Behavior

Provided primary private IP is different than be the one we specified in argument private_ip

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_network_interface" "network_interface" {
  subnet_id = var.subnets
  private_ip = var.primary_private_ip
  private_ips = var.secondary_private_ips
  security_groups = var.security_groups
}

Steps to Reproduce

Run below code:

resource "aws_network_interface" "network_interface" {
  subnet_id = var.subnets
  private_ip = var.primary_private_ip
  private_ips = var.secondary_private_ips
  security_groups = var.security_groups
}

pass appropriate arguments.

Debug Output

Terraform will perform the following actions:

  # module.ec2.aws_network_interface.network_interface will be created
  + resource "aws_network_interface" "network_interface" {
      + arn                = (known after apply)
      + id                 = (known after apply)
      + interface_type     = (known after apply)
      + ipv4_prefix_count  = (known after apply)
      + ipv4_prefixes      = (known after apply)
      + ipv6_address_count = (known after apply)
      + ipv6_addresses     = (known after apply)
      + ipv6_prefix_count  = (known after apply)
      + ipv6_prefixes      = (known after apply)
      + mac_address        = (known after apply)
      + outpost_arn        = (known after apply)
      + owner_id           = (known after apply)
      + private_dns_name   = (known after apply)
      + private_ip         = "10.255.89.96"
      + private_ips        = (known after apply)
      + private_ips_count  = (known after apply)
      + security_groups    = [
          + "sg-038eca10948f63009",
          + "sg-0769eefd4edb3f48c",
          + "sg-5ce80d2c",
          + "sg-eb8d5094",
          + "sg-ed8d5092",
          + "sg-ef8d5090",
        ]
      + source_dest_check  = true
      + subnet_id          = "subnet-b6566d9b"
      + tags_all           = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

Panic Output

After we verify on console, found that private_ip is different

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 7 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 7 months ago

Hey @saiprasad-dhumal-ms šŸ‘‹ Thank you for taking the time to raise this! I notice that you're using a fairly old version of the Terraform AWS Provider. I also noted that private_ip doesn't appear to be a valid argument for the aws_network_interface resource.

Can you test with a more recent version of the provider and, if possible, supply debug logs (redacted as needed)?

justinretzolk commented 5 months ago

Since we haven't heard back, I'm going to close this issue. If you're still having trouble, please feel free to open a new issue, referencing this one for context as needed.

github-actions[bot] commented 4 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.