its for define providers . "openstack" in this file come from clouds.yaml
put all variables in this file such as number of worker node or ssh-key file
First it creates an external network (or you can import it) then it creates subnet and router Next it creates 2 floatingip and finally it assigns IPs to VMs
We add our public key to use in OpenStack. default from ~/.ssh/id_rsa.pub
I gave the image of Debian from the local path. You can download it directly from the Internet
flavor is size for VMs. RAM , CPU and disk
Security group like iptables . We can use default security group
This file up and runnig VMs
in locals.tf we save the IPs of the VMs. And put in host.ini with templating for use it in ansible
this is template file for create host.ini and put IPs in this
we need clouds.yaml as config and put username and password and auth url there and terraform read data from clouds.yaml example:
clouds:
openstack:
auth:
auth_url: http://192.168.122.10:35357/
project_name: demo
username: demo
password: 1234
region_name: RegionOne
See this address for more information
First edit clouds.yaml file
next:
terraform init
terrafrom plan
terraform apply