# Authenticate OpenStack Provider Using Terraform

## Problem

For those unfamiliar with Platform9 Managed OpenStack's Clarity UI, it can be difficult to locate the necessary credentials with which to properly authenticate as an infrastructure provider using the "Infrastructure as a Code" tool, **Terraform**. This article will provide the steps necessary to properly authenticate using data available in the Clarity UI.

## Environment

* Platform9 Managed OpenStack - All Versions

## Procedure

1. Create a new file and terraform directory under your users' home directory.

{% tabs %}
{% tab title="None" %}

```none
$ vi ~/terraform/provider.tf
```

{% endtab %}
{% endtabs %}

2. Press 'I' to enter "Insert" mode and paste the below template into the file.

{% tabs %}
{% tab title="None" %}

```none
# Configure the OpenStack Providerprovider "openstack" { user_name = "admin" tenant_name = "admin" password = "pwd" auth_url = "http://myauthurl:5000/v2.0" region = "RegionOne"}
```

{% endtab %}
{% endtabs %}

3. When logged into the Platform9 UI, locate your username (1), tenant\_name (2) and region (3) in the top right corner of the window. $plugin\[s3xjspnwtm3]
4. Navigate to the "Access & Security" tab (1) in the left pane, click "API Access" (2) at the top of the window and copy the Keystone (Identity) endpoint (3) into your *provider.tf* template as the **auth\_url**.

<figure><img src="/files/XUTR0keNrQit1IbkLIgu" alt="tf-keystone.png"><figcaption><p>tf-keystone.png</p></figcaption></figure>

5. Insert the password you've used to login to the Platform9 UI and save the file. Press the 'ESC' key to exit "Insert" mode and type ':wq' (without quotation), then press 'Enter' to save the file.
6. Ensure your present working directory contains the completed *provider.tf* file and issue a \*\*`terraform init`\*\*command to complete authentication.

{% tabs %}
{% tab title="None" %}

```none
$ cd ~/terraform
$ ls
provider.tf
$ terraform init
Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "openstack" (1.14.0)...

The following providers do not have any version constraints in configuration, so the latest version was installed. To prevent automatic upgrades to new major versions that may contain breaking changes, it is recommended to add version = "..." constraints to the corresponding provider blocks in configuration, with the constraint strings suggested below.

* provider.openstack: version = "~> 1.14"

Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to seeany 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.
```

{% endtab %}
{% endtabs %}

If the command exits with a return similar to the one above, you have successfully authenticated with Terraform.

## Additional Information

* [Terraform - OpenStack Provider Usage](https://www.terraform.io/docs/providers/openstack/)
* [Terraform - Documentation](https://www.terraform.io/docs/index.html)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmo/how-to/authenticate-openstack-provider-using-terraform.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
