F5Networks / terraform-provider-bigipnext

Terraform resources that can Manage F5 BIG-IP Next Devices through BIG-Next Central Manager
Mozilla Public License 2.0
2 stars 1 forks source link

bigipnext_cm_as3_deploy - HTTPS Certificate #19

Closed lahavana closed 4 months ago

lahavana commented 5 months ago

Hello,

I'm trying to deploy a resource via terraform in combination with central manager. HTTP applications works as expected. For HTTPS we want to use certificates already located on the Central Manager. Is this already implemented because I can't find no infos in the documentation?

Thanks!

Terraform Version

Terraform v1.8.2

Terraform Configuration Files

{
  "$schema": "https://raw.githubusercontent.com/F5Networks/f5-appsvcs-extension/main/schema/latest/as3-schema.json",  
  "class": "AS3",
    "schemaVersion": "3.45.0",
    "id": "example-declaration-02",
      "label": "HTTPS Example",
      "remark": "HTTPS with round-robin pool",

      "demo-tenant01": {
        "class": "Tenant",

            "next-cm-pp02": {

          "class": "Application",
          "template": "http",
          "serviceMain2": {
            "class": "Service_HTTPS",
            "virtualAddresses": [
              "172.16.1.100"
            ],
            "pool": "next-cm-pool02",
            "serverTLS": "myTLS"
          },

          "next-cm-pool02": {
            "class": "Pool",
            "loadBalancingMode": "round-robin",
            "monitors": [
             "http"
            ],

            "members": [{

              "servicePort": 80,
              "shareNodes": true,
              "serverAddresses": [
                "192.168.111.120"

              ]
            }]
          },

          "myTLS": {
            "class": "TLS_Server",
            "certificates": [{
              "certificate": "myCert"
            }]
          },

          "myCert": {
             "class": "Certificate",
             "certificate": {
               "bigip": "cert-test.crt"
             },
             "privateKey": {
               "bigip": "cert-test.pem"
             }
          }
        }
      }
    }

Debug Output

For Terraform the configuration is valid and a deploymetn is started on Central Manager which does not finish. The error visible if the started deployment is manually adjusted on Central Manager with a Tenant is: The task failed, failure reason: AS3-0007: AS3 Deploy Error: Failed to accept request on BIG-IP Next instance: {"code":422,"message":"declaration is invalid","errors":["/demo-tenant01/next-cm-pp01/acmeCert/certificate: must contain path pointing to a reference that exists on the system"

pgouband commented 4 months ago

Hi @lahavana,

It's supported but when you are deploying the application cert and key are located in CM not Next instance so 'bigip' needs to be changed to 'cm' in myCert.

Here a valid as3.json

{
    "class": "ADC",
    "schemaVersion": "3.45.0",
    "id": "example-declaration-02",
      "label": "HTTPS Example",
      "remark": "HTTPS with round-robin pool",

      "demo-tenant01": {
        "class": "Tenant",

            "next-cm-pp02": {

          "class": "Application",
          "template": "http",
          "serviceMain2": {
            "class": "Service_HTTPS",
            "virtualAddresses": [
              "172.16.1.100"
            ],
            "pool": "next-cm-pool02",
            "serverTLS": "myTLS"
          },

          "next-cm-pool02": {
            "class": "Pool",
            "loadBalancingMode": "round-robin",
            "monitors": [
             "http"
            ],

            "members": [{

              "servicePort": 80,
              "shareNodes": true,
              "serverAddresses": [
                "192.168.111.120"

              ]
            }]
          },

          "myTLS": {
            "class": "TLS_Server",
            "certificates": [{
              "certificate": "myCert"
            }]
          },

          "myCert": {
             "class": "Certificate",
             "certificate": {
               "cm": "cert-test.crt"
             },
             "privateKey": {
               "cm": "cert-test.pem"
             }
          }
        }
      }
}

Can I close the issue?

lahavana commented 4 months ago

Hello, thanks! I was not aware of the "cm" option. Case can be closed Kind regards,