Skip to content

Commit 961dfea

Browse files
authored
Merge pull request #1793 from qahmed1998/QA-opentofu-provider
QA opentofu provider
2 parents 5e54cca + 8863f08 commit 961dfea

File tree

2 files changed

+286
-0
lines changed

2 files changed

+286
-0
lines changed

managing_providers/_topics/automation_management_providers.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,174 @@ To use the button to run an Ansible Tower job on a virtual machine:
365365
If you selected a service dialog to run when creating the button, {{ site.data.product.title_short }} will then prompt you to enter variables to complete the task. After entering your desired parameters, {{ site.data.product.title_short }} takes you to the **Requests** page.
366366

367367
The service item’s details can be viewed in menu: **Services > My Services** in {{ site.data.product.title_short }}.
368+
369+
## Embedded Terraform (OpenTofu)
370+
371+
OpenTofu is an open source infrastructure as code tool, which can be used to build, change, and version the infrastructure. You can use OpenTofu to define infrastructure resources in human-readable configuration files that you can use to version, reuse, and share.
372+
373+
OpenTofu is built into {{ site.data.product.title_short }} so you do not need to install any additional components.
374+
375+
If you want to use the Embedded Terraform feature in {{ site.data.product.title_short }} that is deployed as a virtual machine appliance, then you need to manually import the Terraform image on an appliance:
376+
377+
## Importing OpenTofu image on an appliance
378+
379+
**Note**: Follow this section if you have {{ site.data.product.title_short }} that is deployed as a virtual appliance. These steps are not applicable to a containerized deployment (podified) of {{ site.data.product.title_short }}.
380+
381+
Use the following command to import the OpenTofu image on your appliance server.
382+
383+
``` bash
384+
runuser --login manageiq --command 'podman --root=/var/www/miq/vmdb/data/containers/storage image load --input /tmp/<OpenTofu_image>'
385+
```
386+
387+
Where `OpenTofu_image` is the name of your OpenTofu image.
388+
389+
You also need to set the docker image name in advanced settings before enabling the server role. Navigate to the **Settings** > **Application Settings** in {{ site.data.product.title_short }} UI and set the value for `workers/worker_base/opentofu_worker/container_image` field.
390+
391+
An example value of this field is `container_image: docker.io/manageiq/opentofu-runner:latest`.
392+
393+
## Usage of Embedded Terraform (OpenTofu)
394+
395+
The following sections show the usage of Embedded Terraform in {{ site.data.product.title_short }}. The following sections apply to {{ site.data.product.title_short }} that is deployed as a containerized deployment (podified) and {{ site.data.product.title_short }} that is deployed as a virtual machine appliance:
396+
397+
1. Enable the Embedded Terraform server role.
398+
2. Add a source control repository that contains your templates.
399+
3. Add credentials to access the repository.
400+
4. Create a Service Catalog item with the desired Terraform template.
401+
402+
### Enabling the Embedded Terraform Server Role
403+
404+
In {{ site.data.product.title_short }}, the Embedded Terraform server role is disabled by default. Enable this server role to use Embedded Terraform (OpenTofu).
405+
406+
To enable the Embedded Terraform Server Role, use the following steps:
407+
408+
1. Browse to the settings menu, and click **Configuration** > **Settings**.
409+
2. Select the desired server under **Zones**.
410+
3. Set the **Server Role** for **Embedded Terraform** to `On`.
411+
412+
### Verifying the Embedded Terraform worker state
413+
414+
Verify that the Embedded Terraform worker is started to use its features:
415+
416+
1. Browse to the settings menu, then click **Configuration** > **Diagnostics** and click the server that you want to choose.
417+
2. Click **Roles by Servers** tab.
418+
419+
A table of all workers and their status appears from which you can confirm the state of your Embedded Terraform worker.
420+
421+
### Adding a Template Repository
422+
423+
To enable {{ site.data.product.title_short }} to discover and use your Terraform templates, add a repository to store and manage your templates.
424+
425+
If your repository requires credentials for access, then you need to create SCM credentials. For more information about how to create SCM credentials, see [SCM credentials](../_topics/opentofu_credentials.md#scm).
426+
427+
Use the following steps to add a repository:
428+
429+
1. Browse to the menu and click **Automation > Embedded Terraform > Repositories**.
430+
431+
2. Click **Configuration**, then ![Add New Repository](../images/1862.png) (**Add New Repository**).
432+
433+
3. Provide a Repository Name in the **Name** field.
434+
435+
4. Add a description for the repository in the **Description** field.
436+
437+
5. Add a **URL** and an optional port for the repository.
438+
439+
6. Select the appropriate **SCM Credentials** from the drop-down menu.
440+
441+
7. Provide a branch name in the **SCM Branch** field. This field is optional and default value is set to `master` branch.
442+
443+
8. Click **Save**.
444+
445+
When you save the repository, the Terraform templates are synced, and are available to {{ site.data.product.title_short }}.
446+
447+
### Refreshing Repositories
448+
449+
You can use {{ site.data.product.title_short }} to refresh specific Terraform repositories or all repositories in your inventory to make sure that your templates are up to date.
450+
451+
Use the following steps to refresh a specific repository:
452+
453+
1. Browse to the menu and click **Automation > Embedded Terraform > Repositories**.
454+
455+
2. Click a repository.
456+
457+
3. Click **Configuration**, then ![Refresh this Repository](../images/2003.png) (**Refresh this Repository**).
458+
459+
Alternately, you can refresh some or all of the repositories from the list view:
460+
461+
1. Browse to the menu and click **Automation > Embedded Terraform > Repositories**.
462+
463+
2. Select the repositories that you want to refresh. Click **Check All** to select all repositories.
464+
465+
3. Click **Configuration**, then ![Refresh Selected Terraform Templates Repositories](../images/2003.png) (**Refresh Selected Ansible Repositories**).
466+
467+
{% include_relative _topics/opentofu_credentials.md %}
468+
469+
### Running a Terraform Template from a Service Catalog
470+
471+
You can run a Terraform Template from {{ site.data.product.title_short }} by creating a Service Catalog item from a Terraform template.
472+
473+
Use the following listed steps in each section to run the Terraform Template from a Service Catalog:
474+
475+
1. Create a catalog
476+
2. Create a Terraform Service Catalog item
477+
3. Run the Terraform template
478+
479+
#### Create a catalog
480+
481+
Use the following steps to create a catalog:
482+
483+
1. In the navigation bar, click **Services** > **Catalogs and click Catalog Items**.
484+
485+
2. Click **Configuration**, then click **Add a New Catalog**.
486+
487+
3. Enter a **Name** and **Description** for the catalog.
488+
489+
4. Click **Add**.
490+
491+
#### Create a Terraform Service Catalog item
492+
493+
Use the following steps to create a Terraform Service Catalog item:
494+
495+
1. In the navigation bar click **Automation** > **Embedded Automate** > **Customization**, then click **Service Dialog**.
496+
497+
2. Click **Configuration** > **Create Service Dialog**.
498+
499+
3. Enter a **Service Dialog Name** and add the required fields for the Terraform template.
500+
501+
4. Click **Save**.
502+
503+
5. In the navigation bar, click **Services** > **Catalogs** > **Catalog Items**.
504+
505+
6. Click **Configuration** > **Add a New Catalog Item** to create a new catalog item with the following details at minimum:
506+
507+
- For **Catalog Item type**, select **Terraform Template**.
508+
509+
- Enter a **Name** for the service catalog item.
510+
511+
- Select **Display** in **Catalog**.
512+
513+
- In Catalog, select the catalog that you created previously.
514+
515+
- In Provisioning, select the repository that you previously added and select the Terraform template that you want to deploy.
516+
517+
- In Provisioning, select the **Cloud Type** and then select the **credential** to connect to the cloud.
518+
519+
- In Provisioning, select the **Service Dialog** that you created previously. If you want to enter additional information when you run the task, **Service Dialog** must be selected. A dialog is required if **Display in Catalog** is chosen.
520+
521+
6. Click **Save**.
522+
523+
The catalog item that you created appears in the *All Service Catalog Items* list.
524+
525+
#### Run the Terraform Template:
526+
527+
Use the following steps to run the Terraform Template.
528+
529+
1. In the navigation bar, click **Service** > **Catalogs** > **Service Catalogs** > **created catalog**.
530+
531+
2. Click **Order** for the catalog item.
532+
533+
3. Enter any variables that are requested and click **Submit**.
534+
535+
{{ site.data.product.title_short }} takes you to the *Requests queue* page and displays the status of the job.
536+
537+
The service item details can be viewed when you navigate to **Services** > **My Services in {{ site.data.product.title_short }}**.
538+
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
### Credentials
2+
3+
Use the following sections to learn more about credentials that are associated with {{ site.data.product.title_short }} and Embedded Terraform:
4+
5+
#### Adding Credentials
6+
7+
Credentials are used by {{ site.data.product.title_short }} for authentication when you connect to cloud providers for infrastructure deployment.
8+
9+
1. Browse to the menu and click **Automation > Embedded Terraform > Credentials**.
10+
11+
2. Click **Configuration**, then ![Add New Credential](../images/1862.png) (**Add New Credential**).
12+
13+
3. Provide a **Name** for the credential.
14+
15+
4. Select the **Credential Type**. Additional fields might appear depending on the credential type that you chose.
16+
17+
5. Click **Add**.
18+
19+
#### Credential Types
20+
21+
Each credential type that is used by {{ site.data.product.title_short }} for the Embedded Terraform is listed in the following sections:
22+
23+
##### SCM
24+
25+
SCM (source control) credentials are used with projects to clone and update the local source code repositories from a remote revision control system such as Git, Subversion, or Mercurial.
26+
27+
Source Control credentials contain multiple attributes, which you need to configure:
28+
29+
- **Username**: The username for source control system.
30+
31+
- **Password**: The password for source control system.
32+
33+
- **Private key passphrase**: If the SSH private key used is protected by a passphrase, you might need to configure a key passphrase for the private key.
34+
35+
- **Private Key**: Copy or drag-and-drop the actual SSH private key, which is used to authenticate the user to the source control system by using SSH.
36+
37+
##### Amazon
38+
39+
If you select this credential type, it enables connection between {{ site.data.product.title_short }} and Amazon Web Services.
40+
41+
Amazon Web Services credentials contain multiple attributes, which you need to configure:
42+
43+
- **Access Key**: User credentials that allow for programmatic calls to Amazon Web Services.
44+
45+
- **Secret Key**: The secret key that corresponds to the user access key.
46+
47+
- **STS Token**: Token generated by Amazon Web Services Security Token Service.
48+
49+
##### Azure
50+
51+
If you select this credential type, it enables connection between {{ site.data.product.title_short }} and Microsoft Azure.
52+
53+
Microsoft Azure credentials contain multiple attributes, which you need to configure:
54+
55+
- **Username**: The username to connect to the Microsoft Azure account.
56+
57+
- **Password**: The password to connect to the Microsoft Azure account.
58+
59+
- **Subscription ID**: The Subscription UUID for the Microsoft Azure account.
60+
61+
- **Tenant ID**: The Tenant ID for the Microsoft Azure account.
62+
63+
- **Client Secret**: The Client Secret for the Microsoft Azure account.
64+
65+
- **Client ID**: The Client ID for the Microsoft Azure account.
66+
67+
##### Google Compute Engine
68+
69+
If you select this credential type, it enables connection between {{ site.data.product.title_short }} and Google Compute Engine.
70+
71+
Google Compute Engine credentials contain multiple attributes, which you need to configure:
72+
73+
- **Service Account Email Address**: The Service Account email address to connect to the Google Compute Engine.
74+
- **RSA Private Key**: Contents of the PEM file associated with the service account email.
75+
- **Project**: The Google Compute Engine assigned identification. This field is constructed as two words followed by a three-digit number, such as `squeamish-ossifrage-123`.
76+
- **Google Cloud Region**: The default region for the resources. If another region is specified on the resource, it takes precedence.
77+
78+
##### IBM Cloud Classic Infrastructure
79+
80+
If you select this credential type, it enables connection between {{ site.data.product.title_short }} and IBM Cloud Classic Infrastructure.
81+
82+
IBM Cloud Classic Infrastructure credentials contain multiple attributes, which you need to configure:
83+
84+
- **IBM Cloud Classic Infrastructure User Name**: The username for IBM Cloud Classic Infrastructure.
85+
- **IBM Cloud Classic Infrastructure API Key**: The API key for IBM Cloud Classic Infrastructure.
86+
87+
##### OpenStack
88+
89+
If you select this credential type, it enables connection between {{ site.data.product.title_short }} and OpenStack.
90+
91+
OpenStack credentials contain multiple attributes, which you might need to configure:
92+
93+
- **Username**: The username to connect to OpenStack.
94+
95+
- **Password (API Key)**: The password or API key to connect to OpenStack.
96+
97+
- **Host (Authentication URL)**: The host to be used for authentication.
98+
99+
- **Project (Tenant Name)**: The Tenant name or Tenant ID to connect to OpenStack. This value is usually the same as the username.
100+
101+
- **Domain name**: The Fully qualified domain name (FQDN) to connect to OpenStack.
102+
103+
##### VMware
104+
105+
If you select this credential type, it enables connection between {{ site.data.product.title_short }} and VMware vCenter.
106+
107+
**Important:** If both {{ site.data.product.title_short }} and a VMware provider are located in the same IPv6-only network, then use a DNS-resolvable hostname for the VMware provider in the **vCenter Host** field when you add the credentials.
108+
109+
VMware credentials contain multiple attributes, which you might need to configure:
110+
111+
- **Username**: The username to connect to vCenter.
112+
113+
- **Password**: The password to connect to vCenter.
114+
115+
- **vCenter Host**: The vCenter hostname or IP address to connect to.

0 commit comments

Comments
 (0)