This page describes how to create a new VM by using Terraform.
Table of Contents |
---|
Pre-requisites
The following pre-requisites must be satisfied.
- Have read and followed the EWC - IaaC via Terraform and OpenTofu page.
- The Terraform or OpenTofu CLI installed.
- Application credentials to access the Openstack cloud project
There is a set of mandatory inputs required to create a new VM which are:
- image_name : the Virtual Machine image (see EWC - VM images and default users )
- flavor_name : the resources (CPU, RAM, Disk) configuration for the VM (see as reference EWC VM plans )
- key_pair : configured SSH key which is needed to connect to the VM (see EWC - OpenStack Command-Line client for how to import it )
- security_groups : security groups are sets of applied IP filter rules which define networking access to the instance
- network : the network to be attached to the VM : external-internet: access to the Internet with public IP ; private-<tenant>: local private network within the tenant.
Excerpt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The available selectable options could also be checked using the Opnstack CLI commands :
Write configuration filesCreate a directory for your configuration and change directory into it:
Create the main configuration file to define the infrastructure:
Open the
Replace the following fields as desired:
For instance for ECMWF can be :
Run Terraform or OpenTofu to create a VMInitialize the directory :
Review the required changes:
Apply the changes to create the VM :
Status can be then seen via:
Destroy the VMThe created VM can be then destroyed by simply running:
|