For the complete documentation index, see llms.txt. This page is also available as Markdown.
How to use IaC tools on ECS
Prerequisites
Install Terraform
Terraform:
Creating VPC
Creating and configuring VMs:
Creating network interfaces
Creating vRouter
Creating boot volumes
Attaching additional volumes
Attaching network interfaces
Attaching port interfaces
Attaching the IP address to the router
Assigning Internal IP and Floating IP to vm
As a result, the directory where you will be working should contain the following items:
├── 00-variables.tf # Variables that we will define for our deployment
├── 010-ssh-key.tf # This file will hold your public SSH key to access the environments
├── 020-network.tf # Network creation/configuration
├── 030-instance.tf # Instances definition
├── provider.tf # OpenStack provider definition
└── secrets.tfvars # File with the password and info about your cloud
Step-by-step guide
Create the provider.tf file that will define the modules and terraform provider versions:
2. Create the secrets.tfvars file to store your secrets:
Create the 00-variables.tf file and change variables to match your current environment
Create the SSH key file that will define the key to be added to workloads. You need to specify your public SSH key.
Create the network configuration for your VMs that will define a network, a router, and subnets.
Create the VMs:
Verify
Now, you are ready to run Terraform commands to deploy the defined IaC in to your project.
Initialize Terraform:
2. Once Terraform is successfully initialized, run the terraform plan command:
If the previous command was successful, proceed with the deployment:
variable "os_username" {}
variable "os_tenant_name" {}
variable "os_password" {}
variable "os_auth_url" {}
variable "os_region" {}
variable "os_domain_name" {}
variable "os_user_domain_name" {
default = ""
}
variable "os_project_domain_name" {
default = ""
}
variable "image" {
type = string
default = "Ubuntu-24-v260112" #change this to match the name of the image you'd like to use (must be centos based)
}
variable "flavor_instance" {
type = string
default = "csa.large.v2" # change this to match the available flavor on your cloud
}
variable "volume_instance" {
type = number
default = 20
}
variable "volume_type" {
type = string
default = "default"
}
variable "internal_network_name" {
type = string
default = "network_1" # change this to match the name of your internal network
}
variable "vrouter_name" {
type = string
default = "vrouter_1" # change this to match the name of your internal subnet
}
# UUID of external gateway
variable "external_gateway" {
type = string
default = "35fea6b9-cbe8-40e0-94ea-2440dc609181"
}
# External network/pool name used to allocate floating IPs
variable "external_network_name" {
type = string
default = "Public"
}
variable "dns_ip" {
type = list(string)
default = ["8.8.8.8", "1.1.1.1"] # whatever you like to use here
}
010-ssh-key.tf
#Define ssh to config in instance
resource "openstack_compute_keypair_v2" "user_key" {
name = "<your_name_ssh_key>"
public_key = "ssh-ed25519..." # Your public SSH key here
}