Skip to content
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

dns_a_record_set resource fails when vcd_vapp resource explicitly set to use dhcp #13812

Closed
stubblyhead opened this issue Apr 20, 2017 · 3 comments

Comments

@stubblyhead
Copy link

stubblyhead commented Apr 20, 2017

Terraform Version

Terraform v0.9.3

Affected Resource(s)

  • vcd_vapp
  • dns_a_record_set
    (I'm not sure which of the two is at fault, possibly they are just not playing nice with each other)

Terraform Configuration Files

variable "name" {}
variable "user" {}
variable "password" {}

provider "vcd" {
  user = "${var.user}"
  password = "${var.password}"
  org = "myorg"
  url = "https://vcd/api"
  vdc = "mydatacenter"
  maxRetryTimeout = 180
}

resource "vcd_vapp" "susebox" {
  name = "${var.name}"
  catalog_name = "My Catalog"
  template_name = "opensuse13.2"
  network_name = "192.168.52.0/24"
  ip = "dhcp"
}

provider "dns" {
  update {
    server = "192.168.50.12"
  }
}

resource "dns_a_record_set" "suse" {
  zone = "myzone.lec."
  name = "${vcd_vapp.susebox.name}"
  addresses = [ "${vcd_vapp.susebox.ip}", ]
  ttl = 3600
}

Debug Output

  1. https://gist.github.com/stubblyhead/774633c1cd21050dc96cd0105d8b3126
  2. https://gist.github.com/stubblyhead/23878afa4ded3a876eaf906467b4a42d
    The first gist is a failed apply, and the second is a successful one. The only difference in configuration is explicitly using dhcp (gist 1) instead of implicitly using dhcp as the default behavior (gist 2).

Expected Behavior

What should have happened?
The configuration above should work as written. Commenting out line #19 (ip = "dhcp") will result in a successful apply, but as dhcp is the default behavior it shouldn't matter if it's stated explicitly or not.

Actual Behavior

What actually happened?
The DNS entry does not get updated, and error text (see lines 633-654 in gist #1 above) is output.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
@drebes
Copy link
Contributor

drebes commented May 3, 2017

It appears upon a first look that the real IP only gets allocated and returned by ${vcd_vapp.susebox.ip} when the vapp is created.

During plan, the value cannot be read from the server as the vapp still don't exist, so the plan assumes its value to be the one defined in the config ("dhcp"). When the apply is done, the IP gets allocated and returned by ${vcd_vapp.susebox.ip}, so the value from plan ("dhcp"), and apply ("192.168.52.210") differ.

I'm not sure why terraform expects the value from plan and apply to be the same, though, if the attribute is computed.

What does the output of terraform plan show, if you comment the dns_a_record_set?

@stubblyhead
Copy link
Author

stubblyhead commented May 4, 2017

If I comment out the dns_a_record_set resource I get the following from terraform plan:

    catalog_name:  "My Catalog"
    href:          "<computed>"
    ip:            "dhcp"
    name:          "vapp_name"
    network_name:  "192.168.52.0/24"
    power_on:      "true"
    template_name: "My Template"


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

@ghost
Copy link

ghost commented Apr 9, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants