Automated Terraform deployment for MAAS.
Terramaas is a Python-based tool designed to simplify and automate the deployment of network resources in a MAAS (Metal as a Service) environment using Terraform. This project provides an easy-to-use solution for generating Terraform scripts, streamlining the setup and configuration of your network infrastructure within a MAAS environment.
Terramaas can be installed using snap:
sudo snap install terramaas --channel edge --devmode
Terramaas provides a CLI with various commands:
create
: Generate network configuration Terraform files from CSV files.
update
: Update MAAS network configurations.
destroy
: Destroy MAAS network configurations.
To create the terraform configuration from the CSVs, use the create
command. You'll need to specify all the csv files containing the network and disks configurations and the MAAS API configuration file (or provide API key and URL). For example:
terramaas create --node-config node_config.csv --partition-config partition_config.csv --network-config network_config.csv --api-config key.yaml
Option | Description | Default | Required |
---|---|---|---|
--csv , -c |
CSV file containing network configuration | Yes | |
--api-config , -a |
MAAS API configuration file | Yes* | |
--api-key |
MAAS API key | Yes* | |
--api-url |
MAAS API URL | Yes* | |
--output , -o |
Output file name | ./terraform_script.tf | No |
*Either api-config
or api-key
and api-url
are required.
CIDR | Gateway | MTU | Dynamic Range | Reserved Range | VLAN | Fabric | |
---|---|---|---|---|---|---|---|
Openstack Public API | 10.20.0.0/24 | 10.20.0.1 | 1500 | 10.20.0.10-10.20.0.100 | 10.20.0.101-10.20.0.200 | 412 | fab-2 |
Resource Name | vlan id | tags | mode | Ip address | Default Gateway | Subnet Name |
---|---|---|---|---|---|---|
enx8 | 0 | DHCP | false | OpenstackPublicAPI | ||
enp0s25 | 1 | DHCP | false | OpenstackPublicAPI |
Resource Name | size gigabytes | fs type | label | bootable |
---|---|---|---|---|
sda1 | 1 | ext4 | boot | true |
sda2 | 118 | ext4 | root | false |
Resource Name | Power type | Power pass | Power address | pxe mac address | id path | nic name | mac address | partition schema |
---|---|---|---|---|---|---|---|---|
node01 | amt | Password1+ | 172.27.84.11 | 172.27.84.11 | enx8,enp0s25 | b8:ae:ed:7b:f3:99,b8:ae:ed:7b:f3:89 | sda1, sda2 |
Resource Name | name | Password | is admin | |
---|---|---|---|---|
cloudbase | cloudbase | Passw0rd123 | admin@cloudbase.local | true |
---
api_key: <MAAS_API_KEY>
api_url: <MAAS_API_URL>
To update a network configuration in MAAS, use the update
command. You'll need to specify the updated CSV File describing the network configuration, the API configuration file (or provide API key and URL), and the output file name. For example:
terramaas update --node-config node_config.csv --partition-config partition_config.csv --network-config network_config.csv --api-config key.yaml
Option, Shorthand | Description | Default | Required |
---|---|---|---|
--csv , -c |
CSV file containing network configuration | Yes | |
--api-config , -a |
MAAS API configuration file | Yes* | |
--api-key |
MAAS API key | Yes* | |
--api-url |
MAAS API URL | Yes* | |
--output , -o |
Output file name | ./terraform_script.tf | No |
--directory , -d |
Directory containing Terraform state files | ./ | No |
--yes , -y |
Skip confirmation prompt | False | No |
*Either api-config
or api-key
and api-url
are required.
To destroy a network configuration in MAAS, use the destroy
command.
terramaas destroy -d <tfstate_directory>
Option, Shorthand | Description | Default | Required |
---|---|---|---|
--directory , -d |
Directory containing Terraform state files | ./ | No |