F5Networks / f5-bigip-runtime-init

Apache License 2.0
14 stars 15 forks source link

GCP hostname fails to pull metadata - invalid declaration #40

Closed JeffGiroux closed 2 years ago

JeffGiroux commented 2 years ago

User tries to retrieve hostname as metadata. This works in AWS and Azure. Using same fields for Google results in runtime init error.

This results in a lack across cloud parity. Please correct and allow all CSP to query hostname or something common. Also, update docs with proper example.

error...

Invalid declaration: "data.runtime_parameters[15].metadataProvider.field should be equal to one of the allowed values, data.runtime_parameters[15].metadataProvider should match \"then\" schema"

Example code block...

  - name: HOST_NAME
    type: metadata
    metadataProvider:
      environment: gcp
      type: compute
      field: hostname

Workaround

You can query the metadata URL in a manual way to get hostname. Example...

        - name: SHORTNAME
          type: url
          value: http://169.254.169.254/computeMetadata/v1/instance/name
          returnType: string
          headers:
            - name: Metadata-Flavor
              value: Google
shyawnkarim commented 2 years ago

Thanks for reporting this bug. We are now tracking it internally with ID ESECLDTPLT-3046.

shyawnkarim commented 2 years ago

@JeffGiroux, this Google URL is going to be included in the next release:

    - name: HOST
      type: url
      value: http://169.254.169.254/computeMetadata/v1/instance/hostname
      headers:
        - name: Metadata-Flavor
          value: Google

Do you think this would suffice? We'd like to avoid adding a new custom type to the metadata provider if possible.

JeffGiroux commented 2 years ago

yes that is fine. I would also alternatively offer "name" too as that is the shorter name of the google VM instance rather than including the big project ID which can be found in "hostname". Depending on customer project ID, the default hostname could go beyond 65 characters and error. Therefore, having "name" and "hostname" would be good to have in examples.

shyawnkarim commented 2 years ago

Closing.

The fix for this was included with Release 1.4.2.