f5devcentral / terraform-aws-bigip-module

This Repo has been Archived, and moved to: https://github.com/F5Networks/terraform-aws-bigip-module for Supported Module
3 stars 8 forks source link

duplicate logic in f5_onboard.tmpl #21

Closed codygreen closed 3 years ago

codygreen commented 3 years ago

The runtime_parameters logic is duplicated in the f5_onboard.tmpl file. This makes it difficult for a user to easily override the f5_onboard.tmpl with their own version.

Can we simplify the logic by using the conditional detection for ${aws_secretsmanager_auth} to output only the ADMIN_PASS section of the runtime_parameters? You can leverage the append (>>) output versus always overwriting the file (>).

Something like this:

cat << 'EOF' > /config/cloud/runtime-init-conf.yaml
---
runtime_parameters:
  - name: USER_NAME
    type: static
    value: ${bigip_username}
EOF

# Check for aws_secretsmanager_auth
if ${aws_secretmanager_auth}
then
  cat << 'EOF' >> /config/cloud/runtime-init-conf.yaml
  - name: ADMIN_PASS
      type: secret
      secretProvider:
        environment: aws
        type: SecretsManager
        version: AWSCURRENT
        secretId: ${bigip_password}
EOF
else
  cat << 'EOF' >> /config/cloud/runtime-init-conf.yaml
  - name: ADMIN_PASS
     type: static
     value: ${bigip_password}
EOF
fi

# Add remaining runtime_parameters:
cat << 'EOF' >> /config/cloud/runtime-init-conf.yaml
pre_onboard_enabled:
  - name: provision_rest
    type: inline
    commands:
      - /usr/bin/setdb provision.extramb 500
      - /usr/bin/setdb restjavad.useextramb true
extension_packages:
  install_operations:
    - extensionType: do
      extensionVersion: ${DO_VER}
      extensionUrl: ${DO_URL}
    - extensionType: as3
      extensionVersion: ${AS3_VER}
      extensionUrl: ${AS3_URL}
extension_services:
  service_operations:
    - extensionType: do
      type: url
      value: https://raw.githubusercontent.com/f5devcentral/terraform-aws-bigip-module/master/config/onboard_do.json
    - extensionType: as3
      type: url
      value: https://raw.githubusercontent.com/f5devcentral/terraform-aws-bigip-module/master/config/as3.json
post_onboard_enabled: []

EOF
nmenant commented 3 years ago

Thanks Cody, i've created INFRAANO-153 to track it internally

RavinderReddyF5 commented 3 years ago

Issue fixed in v0.9.1,try with latest master