citrix / terraform-provider-citrixadc

Part of NetScaler Automation Toolkit | https://github.com/netscaler/automation-toolkit
https://registry.terraform.io/providers/citrix/citrixadc
Apache License 2.0
119 stars 59 forks source link

[FEATURE REQUEST]: Args option to citrixadc_nitro_info #1178

Open rein-tollevik opened 4 months ago

rein-tollevik commented 4 months ago

Description

I need a new "args" (or whatever its name) workflow argument to the citrixadc_nitro_info data-source. This is required to allow for instance the systemfile endpoint be used to test for, and read the content of, a file on the vpx. The required support for such an option is present in the adc-intro-go package, and used in at least resource_citrixadc_systemfile.go

As of now, the following terraform code will retrieve the systemfile from the vpx, but the provider fails to parse the returned structure as it looks for the full endpoint value in the returned json object. And the key there is only "systemfile", the args part is not included.

data "citrixadc_nitro_info" "myfile" {
  workflow = {
    lifecycle = "object-by-name"
    endpoint  = "systemfile?args=filename:my-file-name,filelocation:%2Fmy%2Ffile%2Fpath"
    bound_resource_missing_errorcode = 3441
  }
}

An extention like this would allow terraform to create a certificate request on the vpx, using the citrixadc_sslcertreq resource, download the created certificate request content using citrixadc_nitro_info, pass it to some CA to have it signed before the signed certificate is uploaded to the vpx again using citrixadc_systemfile. Combinded with my request to allow ssl keys to be created, ref https://github.com/citrix/terraform-provider-citrixadc/issues/1176, this would allow the entire lifecycle of a certificate to be managed by terraform without the private key ever leaving the vpx.

Affected Resource(s) and/or Data Source(s)

Equivalent NetScaler CLI Command

API kall:

Potential Terraform Configuration

data "citrixadc_nitro_info" "myfile" {
  workflow = {
    lifecycle = "object-by-name" # or "binding-list"??
    endpoint  = "systemfile"
    args = {
      filename     = "my-file-name"
      filelocation = "%2Fmy%2Ffile%2Fpath" # "/" must be url-encoded, done in provider or by caller as here?
    }
    bound_resource_missing_errorcode = 3441
  }
}

References

https://developer-docs.netscaler.com/en-us/adc-nitro-api/current-release/configuration/system/systemfile