cc_staff
44
edits
Line 49: | Line 49: | ||
== Defining OpenStack provider == | == Defining OpenStack provider == | ||
First, | First, describe the ''provider'': this is where you tell Terraform to use OpenStack, and how. On initialization the most recent version of the OpenStack provider plugin will be installed in the working directory and on subsequent Terraform operations the included credentials will be used to connect to the specified cloud. | ||
Your connection and credential information for OpenStack can be provided to Terraform in the specification, in the environment, or partially in the specification with the rest in the environment. | |||
The following is an example of a provider specification with connection and credential information: | |||
<source lang="terraform">provider "openstack" { | <source lang="terraform">provider "openstack" { | ||
Line 61: | Line 63: | ||
user_domain_name = "CentralID" | user_domain_name = "CentralID" | ||
}</source> | }</source> | ||
For some OpenStack instances the above would specify the complete set of information necessary to connect to the instance and manage resources in the given project (“tenant”). However, Terraform supports ''partial credentials'' in which you could leave some values out of the Terraform configuration and supply them a different way. This would allow us, for example, to leave the password out of the configuration file, in which case it would need to be specified in the environment with <code>$OS_PASSWORD</code>. | |||
Alternatively, if you prefer to use <code>clouds.yaml</code>, specify <code>cloud</code> in the provider stanza: | |||
<source lang="terraform">provider "openstack" { | <source lang="terraform">provider "openstack" { | ||
cloud = "my_cloud" | cloud = "my_cloud" | ||
}</source> | }</source> | ||
It's acceptable to leave the provider definition completely empty: | |||
<source lang="terraform">provider "openstack" { | <source lang="terraform">provider "openstack" { | ||
}</source> | }</source> | ||
In this case, either <code>$OS_CLOUD</code> or the variables set by the appropriate RC file would need to be in the executing environment for Terraform to proceed. | |||
The [https://www.terraform.io/docs/providers/openstack/index.html configuration reference of the OpenStack Provider] describes the available options in detail. | The [https://www.terraform.io/docs/providers/openstack/index.html configuration reference of the OpenStack Provider] describes the available options in detail. |