-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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 0.6.16 - Vmware Vsphere Provider - ipv4_gateway not saved in tfstate file #6590
Comments
@chrislovecnm this may be worth looking into P. |
@stack72 I think this is resolved. #6522 @thetuxkeeper please confirm |
@chrislovecnm : Yes, it's fixed by #6522. Just confirmed it by testing and checking the code. |
@totojack this is fixed in the master branch. Can you test? |
Hi Chris. Yes, it's closed on the master branch. Thanks, |
This problem has not been solved for me. I am on v0.6.16, I may need to open another bug but the machine deploys fine with ipv4_gateway and it looks correct in the plan. Once the plan is applied and the machine is built, the statefile does not populate the address. On the next plan to 'fix' the issue, it shows that the machine needs to be destroyed and rebuilt due to a missing ipv4_gateway. |
Same as jare19, I'm still seeing this in v0.6.16 :(. Is there a beta available with the fix applied that we can use? Thank you! |
Hi @kenerwin88 There is an RC3 currently available https://releases.hashicorp.com/terraform/0.7.0-rc3/ Paul |
In recent news I love you, thanks Paul! :D |
So this seems to now be an issue again in v0.7.10 is there a work around that can be applied? (sorry I have been away from TF for a while so I am unsure if it ever started working again) |
This is also a problem in terraform v0.7.11. ipv4_gateway is not saved in tfstate. |
Can you please check if the gateway is set in the vsphere API? You can use the browser:
I don't see any reason why the settings should work different ("gateway" will be copied to "network_interface[].ipv4_gateway"). Just the one detail that "gateway" is set on all interfaces and network_interface[].ipv4_gateway only on the specified one (that could "workaround" #7673 or any "DeviceID <-> tfstate index"-mismatch). |
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. |
Terraform Version
v0.6.16
Affected Resource(s)
Terraform Configuration Files
define variable from terraform.tvars
variable "vsphere_user" {}
variable "vsphere_password" {}
variable "vsphere_server" {}
variable "vsphere_cluster" {}
variable "vsphere_datacenter" {}
variable "vsphere_domain" {}
variable "vsphere_dns" {}
variable "vsphere_timezone" {}
Configure the VMware vSphere Provider
provider "vsphere" {
user = "${var.vsphere_user}"
password = "${var.vsphere_password}"
vsphere_server = "${var.vsphere_server}"
allow_unverified_ssl = true
}
Create a folder
resource "vsphere_folder" "testfolder" {
path = "TEST/Vms"
datacenter = "${var.vsphere_datacenter}"
}
Create a virtual machine within the folder
resource "vsphere_virtual_machine" "web" {
name = "terraform-web"
folder = "${vsphere_folder.testfolder.path}"
vcpu = 2
memory = 2048
datacenter = "${var.vsphere_datacenter}"
cluster = "${var.vsphere_cluster}"
domain = "my.custom.domain.com"
dns_servers = ["${var.vsphere_dns}"]
#resource_pool = ""
time_zone = "${var.vsphere_timezone}"
network_interface {
label = "virtualwire_Template"
ipv4_address = "172.16.1.19"
ipv4_prefix_length = "28"
ipv4_gateway = "172.16.1.17"
}
disk {
template = "TEMPLATE/Centos7_tmpl_20160422_01"
datastore = "VPLEX-SAS"
}
disk {
size = "20"
datastore = "VPLEX-SAS"
}
disk {
size = "10"
datastore = "VPLEX-SAS"
}
}
Debug Output
https://gist.github.com/totojack/4db892bf6d9b03b3b982401fedd8c2f6
Expected Behavior
After applying the configuration, ipv4_gateway value is set on tfstate file.
Actual Behavior
ipv4_gateway value is not saved to tfstate file, and plan command shows another time changes to be applied for network_interface ipv4_gateway. Plan output is:
(...)
network_interface.0.ipv4_gateway: "" => "172.16.1.17" (forces new resource)
(...)
Plan: 1 to add, 0 to change, 1 to destroy.
tfstate file is:
(...)
"network_interface.#": "1",
"network_interface.0.adapter_type": "",
"network_interface.0.ip_address": "",
"network_interface.0.ipv4_address": "172.16.1.19",
"network_interface.0.ipv4_gateway": "",
"network_interface.0.ipv4_prefix_length": "28",
"network_interface.0.ipv6_address": "",
"network_interface.0.ipv6_gateway": "",
"network_interface.0.ipv6_prefix_length": "0",
"network_interface.0.label": "virtualwire_Template",
"network_interface.0.subnet_mask": "",
"skip_customization": "false",
"time_zone": "Europe/Rome",
"vcpu": "2"
(...)
Steps to Reproduce
terraform apply
terraform plan
The text was updated successfully, but these errors were encountered: