-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Terraform can not validate empty IPv4 address with 2.65.0 #13626
Comments
I'm facing same issue as of today.
My tf file contents
|
I am facing same issue $ terraform plan Error: aws_instance.test1: expected private_ip to contain a valid IPv4 address, got: |
Facing the same issue with the new provider version 2.65.0. As a workaround forcing the older version to be used:
|
Same for me |
Facing this issue while trying to create spot instances at my organisation :( |
Can confirm, 2.64.0 version of the provider is fine. But this change will very likely remain since validation function is totally legit. :) As a workaround, this is a part of our code for resource "aws_instance" "instance" {
...
private_ip = var.private_ip == "" ? null : var.private_ip
...
dynamic "root_block_device" {
for_each = var.root_block_device
content {
delete_on_termination = lookup(root_block_device.value, "delete_on_termination", null)
encrypted = lookup(root_block_device.value, "encrypted", null)
iops = lookup(root_block_device.value, "iops", null)
kms_key_id = lookup(root_block_device.value, "kms_key_id", null)
volume_size = lookup(root_block_device.value, "volume_size", null)
volume_type = lookup(root_block_device.value, "volume_type", null)
}
}
dynamic "ephemeral_block_device" {
for_each = var.ephemeral_block_device
content {
device_name = ephemeral_block_device.value.device_name
no_device = lookup(ephemeral_block_device.value, "no_device", null)
virtual_name = lookup(ephemeral_block_device.value, "virtual_name", null)
}
}
} |
This hack should help.
|
We have a module that takes an optional |
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:
|
It appears to be some form of validation that's being done on the submitted value: |
I was about to comment and say I just hit the same issue, and I am using However, I see someone else has already submitted such a PR to address this issue: #13640 |
Fix (allowing for |
Wouldn't such regression justify a dot release with just the regression fix? Say, |
Also experiencing this issue now on version 11 |
@anGie44 Will v2.66.0 be released this week? |
yes, will be released later today @DanielZhangQD! |
This has been released in version 2.66.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
I'm still getting this error with provider.aws v2.67.0 |
hi @luckyvalentine! thanks or commenting here. What does your config look like? Using the config provided in this issue's example and the same terraform version |
Just ran into this when setting variable
This is on Setting the default variable value to
p.s. this is on |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
Terraform v0.11.14 and Terraform AWS provider 2.65.0
Affected Resource(s)
Terraform Configuration Files
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
terraform plan
Important Factoids
References
The text was updated successfully, but these errors were encountered: