This is a template to perform a simple deployment of a ubuntu virtual machine into the AUCloud IaaS platform (based on VMware Cloud Director), install and turn on apache web server, and present the default apache landing page.
The demo also uses a virtual service, allowing users to configure TLS termination, load balancing and advanced firewalls.
This requires that your tenancy has object storage enabled, and that the account used to login to VCD is an 'organizational administrator'.
The project is setup with automation based on Github actions. This can be ported with minimal changes to other CICD environments.
This system is simple, however, it is not designed for production use:
- Passwords must be changed.
- Currently it does not provide an admin access channel except via the web console.
- Minimal / no Operating system hardening has been performed.
- The firewall has no restrictions on outbound.
The github workflows, are designed to execute a simple trunk based development workflow:
- All of the workflows can be triggered manually
- On a PR to main,
terraform planandterraform validateare run to provide testing. - On merging a PR to main,
terraform applyis run
Two manual only workflows exist:
- A destroy only workflow, which cleans up the environment
- A destroy workflow, which triggers recreation of resources afterwards, which can be used for refreshing.
This project requires a number of elements in order for this to work within an AUCloud tenancy
Ubuntu Cloud images are optimised for automated builds. This demo has been tested with the Ubuntu 20.04 (Focal Fossa) ova image. The catalog name and image name will need to be updated in the tfvars file.
Each of the variables in demo.auto.tfvars
Github secrets are required to be set. The workflows are pre-configured assuming an github secrets environment exist called demo.
AWS_ACCESS_KEY_ID: Object storage access key - can be generated from the VCLoud Object Storage ExtensionAWS_SECRET_ACCESS_KEY: Object secret access key - can be generated from the VCLoud Object Storage ExtensionVCD_USER: VCD username. Takes the form of, in aucloud of{user-id}@{tenancy-id}e.g.100.0@sz000-00-00.VCD_PASSWORD: Your VCD password
Cloud-init is used to set the user password, update the system, and install apache http server.
The user password, is stored salted and hashed. The default in this demonstration repo is demo,demo_password.
THIS PASSWORD MUST BE CHANGED
A password hash (tested on ubuntu), can be generated by:
sudo apt install whois
mkpasswd --method=SHA-512 --rounds=4096 > hash.txtUsers are encouraged to pass in the password hash via a github secret combined with a terraform variable.
An alternative is to enable only an ssh key in cloud-init e.g.:
users:
- name: root
lock_passwd: true
shell: /bin/bash
ssh-authorized-keys:
- # SSH key here; or variable to pass in the key from a terraform variable.- VCD terraform provider
- Terraform docs
- VCD docs
- Cloud init
- AUCloud connect
- Github actions docs
- AUCloud PDCE Portal
- AUCloud ODCE Portal
- AUCloud EDCE Portal
Builds can get broken for a number of reasons such as:
- Manual editing of resources
- Certain terraform file edits (removing of resources before deletions)
- Problems with the downstream edits
If you are worried about edits
- Test in a non prod-environment OR
- Run a destroy workflow before merging code to ensure clean state
- Attempt the destroy the resources
- Two pipelines are provided for running terraform destroy.
- One destroys and leaves it empty
- One destroys then triggers recreation of the resources
- Use the Workflow dispatch button to ensure code is up to date; and a unique github actions run is recoreded.
- Two pipelines are provided for running terraform destroy.
If a destroy run fails:
- Try to repeatedly run destroy.
- Some resources may not be correctly coded into the DAG resulting in problems with destructions
- If all else fails
- Manually delete / cleanup resources on the target system.
- Remove the state file manually (delete) from object storage.