hashicorp / terraform-provider-ultradns

Terraform UltraDNS provider. Please note: This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
https://www.terraform.io/docs/providers/ultradns/
Mozilla Public License 2.0
7 stars 24 forks source link

TC pool not working: invalid keys `availableToServe` #11

Open fzipi opened 5 years ago

fzipi commented 5 years ago

TC pool is not working, maybe UltraDNS API has been updated but not module.

Terraform Version

Terraform v0.11.14

Not running the latest version, because, you know: it does not work. See #10 .

Affected Resource(s)

Terraform Configuration Files

resource "ultradns_tcpool" "example-traffic-controller-test" {
  zone        = "<example zone>"
  name        = "example-traffic-controller-test"
  ttl         = 300
  description = "traffic controller pool with all settings tuned"
  act_on_probes = false
  max_to_lb     = 2
  run_probes    = false
  rdata {
    host = "10.6.1.1"
    failover_delay = 30
    priority       = 1
    run_probes     = true
    state          = "ACTIVE"
    threshold      = 1
    weight         = 2
  }
  rdata {
    host = "10.6.1.2"
    failover_delay = 30
    priority       = 2
    run_probes     = true
    state          = "INACTIVE"
    threshold      = 1
    weight         = 4
  }
  backup_record_rdata          = "10.6.1.4"
  backup_record_failover_delay = 30
}

Expected Behavior

Resource is created properly.

Actual Behavior

Releasing state lock. This may take a few moments...

Error: Error applying plan:

1 error occurred:
    * ultradns_tcpool.example-traffic-controller-test: 1 error occurred:
    * ultradns_tcpool.example-traffic-controller-test: RRSet.profile could not be unmarshalled: 3 error(s) decoding:

* '' has invalid keys: status
* 'rdataInfo[0]' has invalid keys: availableToServe
* 'rdataInfo[1]' has invalid keys: availableToServe

Steps to Reproduce

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

Use the examples provided in code.

  1. terraform apply
  2. Boom!

Important Factoids

I guess the API in UltraDNS changed. These are the results for TC_POOLS query in postman (https://api.ultradns.com/zones/./rrsets/?q=kind:TC_POOLS):

{
    "zoneName": "<edited name>.",
    "rrSets": [
        {
            "ownerName": "example.com.",
            "rrtype": "A (1)",
            "ttl": 60,
            "rdata": [
                "127.0.0.1",
                "127.0.1.1"
            ],
            "profile": {
                "@context": "http://schemas.ultradns.com/TCPool.jsonschema",
                "description": "example.com.",
                "runProbes": true,
                "actOnProbes": true,
                "status": "CRITICAL", // <==== HERE
                "rdataInfo": [
                    {
                        "state": "NORMAL",
                        "runProbes": true,
                        "priority": 1,
                        "failoverDelay": 0,
                        "threshold": 1,
                        "weight": 100,
                        "availableToServe": true  // <=== HERE
                    },
                    {
                        "state": "INACTIVE",
                        "runProbes": true,
                        "priority": 2,
                        "failoverDelay": 0,
                        "threshold": 1,
                        "weight": 100,
                        "availableToServe": false //<=== HERE
                    }
                ],
                "maxToLB": 2
            }
        }
    ],
    "queryInfo": {
        "q": "kind:TC_POOLS",
        "sort": "OWNER",
        "reverse": false,
        "limit": 100
    },
    "resultInfo": {
        "totalCount": 1,
        "offset": 0,
        "returnedCount": 1
    }
}

References

josephholsten commented 5 years ago

:wave: I'm sorry you're having trouble. I'm not able to commit any time to this project, but I suspect that what's needed is to add that field to the type TCPoolProfile struct at https://github.com/terra-farm/udnssdk/blob/master/rrset.go#L219

You might also investigate finishing the PRs at https://github.com/terra-farm/udnssdk/pulls. I'm happy to get you commit privs, but the people managing that org hang out at https://gitter.im/hashicorp-terraform/terra-farm these days.

fzipi commented 5 years ago

@josephholsten Sure, I can help! Seems pretty straightforward.

fzipi commented 5 years ago

Also, dependency in this module is to github.com/Ensighten/udnssdk, not terra-farm (maybe that was before changing namespace).

fzipi commented 5 years ago

Seems like availableToServe is already there, so maybe the version availabe needs to be updated ...

// SBRDataInfo wraps the rdataInfo object of a SBPoolProfile
type SBRDataInfo struct {
  State            string `json:"state"`
  RunProbes        bool   `json:"runProbes"`
  Priority         int    `json:"priority"`
  FailoverDelay    int    `json:"failoverDelay,omitempty"`
  Threshold        int    `json:"threshold"`
  Weight           int    `json:"weight"`
  AvailableToServe bool   `json:"availableToServe,omitempty"` // <====
}