terraform-provider-aws: Terraform can not validate empty IPv4 address with 2.65.0

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave “+1” or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.14 and Terraform AWS provider 2.65.0

Affected Resource(s)

  • aws_instance

Terraform Configuration Files

variable "private_ip" {
  default     = ""
  type        = "string"
  description = "Private IP address to associate with the instance in a VPC."
}
resource "aws_instance" "ec2_node" {
  private_ip = "${var.private_ip}"
}

Debug Output

Panic Output

Expected Behavior

should ignore when no IPv4 is provided

Actual Behavior

Error: module.x.aws_instance.ec2_node: expected private_ip to contain a valid IPv4 address, got:

Steps to Reproduce

  1. lockdown the provider to 2.65.0 and terraform plan

Important Factoids

References

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 33
  • Comments: 23 (6 by maintainers)

Most upvoted comments

Facing the same issue with the new provider version 2.65.0.

As a workaround forcing the older version to be used:

terraform {
    required_providers {
    aws = "~> 2.64.0"
  }
}

Fix (allowing for private_ip = "" ) has been merged and will release with v2.66.0 of the Terraform AWS Provider, expected in next week’s release. Apologies for the unintended interruptions in your environments!

Wouldn’t such regression justify a dot release with just the regression fix? Say, 2.65.1?

Fix (allowing for private_ip = "" ) has been merged and will release with v2.66.0 of the Terraform AWS Provider, expected in next week’s release. Apologies for the unintended interruptions in your environments!

yes, will be released later today @DanielZhangQD!

Thanks for that workaround of explicitly setting the version, @v3se .

Note that if you have explicitly defined an AWS provider you’ll need to set that version within that block, not the top level terraform block, eg:

provider "aws" {
  region  = "us-east-1"
  version = "~> 2.64.0"
}

I’m facing the same issues. And how do we address this with Terraform 0.11 as there is no null we could assign to the object.

This hack should help.

terraform {
    required_providers {
    aws = "~> 2.64.0"
  }
}

hi @elpy1, I believe what you’re experiencing relates to the validation for IPv4 addresses added in https://github.com/terraform-providers/terraform-provider-aws/pull/13650. The fix https://github.com/terraform-providers/terraform-provider-aws/pull/13958 will be in v2.69.0 of the provider, expected to be released on Thursday.

Also experiencing this issue now on version 11

It appears to be some form of validation that’s being done on the submitted value: https://github.com/terraform-providers/terraform-provider-aws/pull/13033#discussion_r435955250

Same for me