Your Automation Assembler template code can attach an existing, deployed disk to a newly created machine.
Use the following cloud template code example as a guideline.
formatVersion: 1 inputs: disk: type: string $data: /data/availableDisks?resourceType=Cloud.Volume resources: Cloud_Machine_1: type: Cloud.Machine properties: image: ubuntu flavor: small attachedDisks: - source: ${input.disk}
The highlighted line is an API call that lists the disks that are available for attachment, disks unattached to any machine.
The resourceType parameter lets Automation Assembler list available disks by cloud account type.
Cloud.Volume | Disks on any cloud that you have added |
Cloud.vSphere.Disk | Only vSphere disks |
Cloud.AWS.Volume | Only Amazon Web Services (AWS) disks |
Cloud.Azure.Disk | Only Microsoft Azure disks |
Cloud.GCP.Disk | Only Google Cloud Platform (GCP) disks |
When using this feature, there's no design canvas component for the existing disk that you attach. Even though there's no component on the design canvas, the attached disk appears under the storage section of the deployed machine, and under the Resources tab.