Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Installing Terraform

...

  1. Create a directory and cd  to the directory
  2. Create a file named providers.tf with the following content. This will enable the OpenStack provider

    Code Block
    themeEmacs
    titleproviders,.tf
    # Define required providers
    terraform {
    required_version = ">= 0.14.0"
      required_providers {
        openstack = {
          source  = "terraform-provider-openstack/openstack"
          version = "~> 1.35.0"
        }
      }
    }
    
    provider "openstack" {}


  3. 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.
  4. Run terraform init

    Code Block
    themeEmacs
    $ 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.


...

ProviderFunction
openstack_compute_instance_v2Create instance
openstack_networking_secgroup_v2Create security group
openstack_networking_secgroup_rule_v2Create security group rule
openstack_networking_network_v2Create network
openstack_networking_floatingip_v2Get a floating IP from allocated pool
openstack_compute_floatingip_associate_v2Associate floating IP to instances
openstack_containerinfra_clustertemplate_v1Create magnum cluster template
openstack_containerinfra_cluster_v1Create magnum cluster
openstack_blockstorage_volume_v2Create a new volume
openstack_compute_volume_attach_v2Attach volume to instances
openstack_lb_loadbalancer_v2Create Load balancer
openstack_lb_listener_v2Create Load balancer listener
openstack_lb_pool_v2Set method for load balance charge between instance (e.g. round robin)
openstack_lb_member_v2Add instance to load balancer
openstack_lb_monitor_v2Create health monitor for load balancer

...