zerotier/terraform-provider-zerotier

zerotier_member resource requires 2 applies to set the resource's state to the correct values

weiijiie opened this issue ยท 2 comments

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 CLI and Terraform Zerotier Provider Version

  • Terraform - v0.14.8
  • Zerotier Provider - v0.1.56

Affected Resource(s)

  • zerotier_member

Terraform Configuration Files

terraform {
  required_providers {
    zerotier = {
      source  = "zerotier/zerotier"
      version = "~> 0.1.56"
    }
  }
}

provider "zerotier" {
  # set your controller token
  zerotier_central_token = ""
}

locals {
  members = {
    member1 = ["172.30.2.1"]
    member2 = ["172.30.2.2"]
    member3 = ["172.30.2.3"]
  }
}

resource "zerotier_identity" "this" {
  for_each = local.members
}

resource "zerotier_member" "this" {
  for_each = local.members

  name      = each.key
  member_id = zerotier_identity.this[each.key].id
  # set your network id
  network_id = ""

  ip_assignments     = each.value
  description        = "Example description"
  no_auto_assign_ips = true
}

Expected Behavior

Zerotier member resources should be created with the configured IP assignments, description, and no_auto_assign_ips set to false.

Actual Behavior

After the first apply, the zerotier members are created, but none of the fields (IP assignments, description, etc.) are set to their actual values.

Running terraform plan after the first apply will report a diff with the actual state, and only after running terraform apply a second time, will the fields be set properly.

Steps to Reproduce

  1. terraform apply with the above Terraform configuration files.
  2. Navigate to the Zerotier network console, and notice that the members are created, but the fields are not set.
  3. Run terraform apply again and notice the diff in the plan output. After the apply has succeeded, navigate to the console and notice that the values are now set.

Hello!

Thanks for reporting.
This is now fixed as of 1.0.0.
Enjoy!

-s

Hello!

Thanks for reporting.
This is now fixed as of 1.0.0.
Enjoy!

-s

Thanks for the help!