cc_staff
44
edits
m (→Terraform) |
|||
Line 24: | Line 24: | ||
=== Credentials === | === Credentials === | ||
There are two ways to provide your OpenStack credentials in a command-line environment: via environment variables or in a configuration file. We'll need to use one of these methods with Terraform, described in the [[#Defining_OpenStack_provider|next section]]. Regardless of your preferred method, the OpenStack web interface offers a simple way to download credentials: once logged in, click on ''API Access'' in the navigation bar, and on that page is a drop-down menu entitled “Download OpenStack RC File”. From here you may download a <code>clouds.yaml</code> file or an RC file which can be sourced from your shell session. | |||
The RC file is a series of shell commands which export environment variables to your current shell session. It's not a standalone script and must be sourced in the context of the current session, like so: | |||
The RC file is a series of shell commands | |||
<source lang="shell">$ . openrc.sh</source> | <source lang="shell">$ . openrc.sh</source> | ||
It will then prompt | It will then prompt you for your OpenStack password, which along with necessary information about you, your tenant and the cloud you’re connecting to will be stored in environment variables prefixed by <code>OS_</code>, such as <code>$OS_AUTH_URL</code> and so on. | ||
The other method is to create a configuration in <code>$HOME/.config/openstack/clouds.yaml</code>. If you don’t have such a file already, you can download `clouds.yaml` as described above and move it into place. We recommend changing the name given to the cloud in the downloaded file to something meaningful, especially if you use more than one OpenStack cloud. Then, to use the CLI tools described below, simply create an environment variable <code>$OS_CLOUD</code> with the name of the cloud you want to use. | |||
<source lang="shell">$ export OS_CLOUD=arbutus</source> | <source lang="shell">$ export OS_CLOUD=arbutus</source> | ||
Whichever you have chosen, you will use this soon to configure Terraform. | |||
=== OpenStack session === | === OpenStack session === |