Skip to content

Unable to create puppetdb_node resource #7

@Wiston999

Description

@Wiston999

Hi,
Thanks for puppetca and this provider.
I'm having some issues trying to use the provider that I'm not able to debug.
The code being used is

locals {
  puppet_enabled = lookup(var.base_tags, "puppet", "false") == "true" ? 1 : 0
}

resource puppetdb_node "puppetdb-metadata" {
  count    = var.srv_count * local.puppet_enabled
  certname = replace(azurerm_private_dns_a_record.a_record[count.index].fqdn, "/\\.$/", "")
}

resource puppetca_certificate "puppetca-metadata" {
  count = var.srv_count * local.puppet_enabled
  name = replace(azurerm_private_dns_a_record.a_record[count.index].fqdn, "/\\.$/", "")
}

Providers configuration is:

provider "puppetca" {
  url  = var.puppetca_host
  cert = var.puppet_cert
  key  = var.puppet_key
  ca   = var.puppet_ca_cert
}

provider "puppetdb" {
  url  = var.puppetdb_host
  cert = var.puppet_cert
  key  = var.puppet_key
  ca   = var.puppet_ca_cert
}

In fact, puppetca_certificate worked without issues at the first time.
After 51 tries, the error returned is

Error waiting for node (dev-01.str.global.example.com) to be found: couldn't find resource

And, if I reproduce using curl I get:

$ curl -k -i  --cacert /etc/puppetlabs/puppet/ssl/ca/ca_crt.pem --key /etc/puppetlabs/puppet/ssl/private_keys/$(hostname -f).pem --cert /etc/puppetlabs/puppet/ssl/certs/$(hostname -f).pem https://puppet.example.com:8145/pdb/query/v4/nodes/dev-01.str.global.example.com -H 'Content-Type: application/json' -H 'Accept: application/json'
HTTP/1.1 200 OK
Date: Thu, 04 Jun 2020 11:49:17 GMT
Content-Type: application/json;charset=utf-8
Vary: Accept-Encoding, User-Agent
Content-Length: 676

{
  "deactivated" : null,
  "latest_report_hash" : "6ba6505370755521a9eed033c5da84c5de444910",
  "facts_environment" : "production",
  "cached_catalog_status" : "not_used",
  "report_environment" : "production",
  "latest_report_corrective_change" : null,
  "catalog_environment" : "production",
  "facts_timestamp" : "2020-06-04T11:45:43.413Z",
  "latest_report_noop" : false,
  "expired" : null,
  "latest_report_noop_pending" : false,
  "report_timestamp" : "2020-06-04T11:47:39.272Z",
  "certname" : "dev-01.str.global.example.com",
  "catalog_timestamp" : "2020-06-04T11:46:45.306Z",
  "latest_report_job_id" : null,
  "latest_report_status" : "changed"
}

Am I doing anything wrong or might be a provider bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions