VMware Aria Automation 8.x
Using ${self} inside a cloudConfig & updating the cloudConfig using __computeConfigContent property will lead to cloudConfig not being updated. This happens if cloudConfig script contains references to self or resource in any section of the script (not only runcmd, in any section or module of the script).
Example blueprint which causes this issue:
formatVersion: 1
inputs: {}
resources:
vSphere_VM:
type: Cloud.vSphere.Machine
properties:
name: ${replace(env.projectName, " ", "-")}
imageRef: https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.ova
cpuCount: 2
totalMemoryMB: 2048
cloudConfigSettings:
deploymentFailOnCloudConfigRuntimeError: true
customCloudConfig: |
runcmd:
- echo Hello
cloudConfig: |
ssh_pwauth: true
chpasswd:
expire: false
users:
- name: root
password: XXXXX
type: text
runcmd:
- hostnamectl set-hostname ${self.resourceName}
- ejectBlueprint which works & updates the cloudConfig even after Create phase is shown below:
formatVersion: 1
inputs: {}
resources:
vSphere_VM:
type: Cloud.vSphere.Machine
properties:
name: ${replace(env.projectName, " ", "-")}
imageRef: https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.ova
cpuCount: 2
totalMemoryMB: 2048
cloudConfigSettings:
deploymentFailOnCloudConfigRuntimeError: true
customCloudConfig: |
runcmd:
- echo Hallo
cloudConfig: |
ssh_pwauth: true
chpasswd:
expire: false
users:formatVersion: 1
inputs: {}
resources:
vSphere_VM:
type: Cloud.vSphere.Machine
properties:
name: ${replace(env.projectName, " ", "-")}
imageRef: https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.ova
cpuCount: 2
totalMemoryMB: 2048
cloudConfigSettings:
deploymentFailOnCloudConfigRuntimeError: true
customCloudConfig: |
runcmd:
- echo Hallo
cloudConfig: |
ssh_pwauth: true
chpasswd:
expire: false
users:
- name: root
password: XXXXX type: text
runcmd:
- hostnamectl set-hostname ${replace(env.projectName, " ", "-")}
- eject
- name: root
password: XXXXX type: text
runcmd:
- hostnamectl set-hostname ${replace(env.projectName, " ", "-")}
- eject
Impact/Risks:
The cloudConfig will be updated in Allocate phase of the resource, but it will go back to the original cloudConfig after the create phase.