Installing Terraform
...
- Create a directory and
cd
to the directory Create a file named providers.tf with the following content. This will enable the OpenStack provider
Code Block theme Emacs title provider,tf # Define required providers terraform { required_version = ">= 0.14.0" required_providers { openstack = { source = "terraform-provider-openstack/openstack" version = "~> 1.35.0" } } } provider "openstack" {}
- Declare the cloud information. It is recommended that you refer to Using OpenStack Command-line Interface. You can also declare it in the
providers.tf
However, you will have to declare your login details in plain text which is not secure. Run terraform init
Code Block theme Emacs $ terraform init Initializing the backend... Initializing provider plugins... - Reusing previous version of terraform-provider-openstack/openstack from the dependency lock file - Using previously-installed terraform-provider-openstack/openstack v1.35.0 Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work. If you ever set or change modules or backend configuration for Terraform, rerun this command to reinitialize your working directory. If you forget, other commands will detect it and remind you to do so if necessary.
...
Provider | Function |
---|---|
openstack_compute_instance_v2 | Create instance |
openstack_networking_secgroup_v2 | Create security group |
openstack_networking_secgroup_rule_v2 | Create security group rule |
openstack_networking_network_v2 | Create network |
openstack_networking_floatingip_v2 | Get a floating IP from allocated pool |
openstack_compute_floatingip_associate_v2 | Associate floating IP to instances |
openstack_containerinfra_clustertemplate_v1 | Create magnum cluster template |
openstack_containerinfra_cluster_v1 | Create magnum cluster |
openstack_blockstorage_volume_v2 | Create a new volume |
openstack_compute_volume_attach_v2 | Attach volume to instances |
openstack_lb_loadbalancer_v2 | Create Load balancer |
openstack_lb_listener_v2 | Create Load balancer listener |
openstack_lb_pool_v2 | Set method for load balance charge between instance (e.g. round robin) |
openstack_lb_member_v2 | Add instance to load balancer |
openstack_lb_monitor_v2 | Create health monitor for load balancer |
...