Skip to content

Commit

Permalink
Edits as per Helen's review and TVo's PR:
Browse files Browse the repository at this point in the history
  • Loading branch information
EMcWhinn committed May 3, 2024
1 parent 3aad3d8 commit e003827
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,30 @@

= Terraform State

Configure an inventory sourced from a Terraform State file.
This inventory source uses the link:https://github.com/ansible-collections/cloud.terraform/blob/main/plugins/inventory/terraform_state.py[terraform_state] inventory plugin from the link:https://github.com/ansible-collections/cloud.terraform[cloud.terraform] collection.
The plugin parses a terraform state file and add hosts for AWS EC2, GCE, and {Azure} instances.

.Procedure

. From the navigation panel, select {MenuAEProjects}.
. On the *Projects* page, click btn:[Create project] to start the *Create Project* window.
** Enter the appropriate details according to the steps in xref:proc-controller-adding-a-project[Adding a new project].
** Use the configuration files at link:https://github.com/hakbailey/terraform-aap-demo[terraform-aap-demo].
. From the navigational panel, select {MenuInfrastructureInventories}.
. Select the inventory that you want to add a source to.
. In the *Sources* tab, click btn:[Add Source].
. From the menu:Source[] menu, select *Terraform State*.
. The *Add new source* window expands with the required *Credential* field.
* The *Add new source* window expands with the required *Credential* field.
+
Choose from an existing Terraform backend configuration credential. For more information, see xref:ref-controller-credential-terraform[Terraform backend configuration].
. Enable the options to *Overwrite* and *Update on Launch*.
. Use the *Source Variables* field to override variables used by the `terraform_state` inventory plugin.
Enter variables by using either JSON or YAML syntax.
Use the radio button to toggle between the two. For more information about these variables, see link:https://github.com/ansible-collections/cloud.terraform/blob/main/plugins/inventory/terraform_state.py[cloud.terraform].
Use the radio button to toggle between the two.
For more information about these variables, see the link:https://github.com/ansible-collections/cloud.terraform/blob/main/plugins/inventory/terraform_state.py[terraform_state] file.
+
The `backend_type` variable is required by the `terraform_state` inventory plugin.
The `backend_type` variable is required by the Terraform State inventory plugin.
This should match the remote backend configured in the *Terraform backend credential*.
The following is an example s3 backend:
The following is an example Amazon S3 backend:
+
----
backend_type: s3
Expand All @@ -36,5 +37,11 @@ backend_type: s3
. Select an *Execution Environment* that has a Terraform binary.
This is required for the inventory plugin to run the Terraform commands that read inventory data from the Terraform state file.

.Additional resources
For more information, see the link:https://github.com/ansible-cloud/terraform_ee[Terraform EE] readme that has an example {ExecEnvShort} configuration with a Terraform binary.

== Terraform provider for {PlatformNameShort}

Inventories created this way are managed by Terraform and must not be modified in {PlatformNameShort} as it can introduce drift to the Terraform deployment.

// ADD FURTHER DESCRIPTION/PROCEDURE HERE
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@

= Terraform backend configuration

Select this credential type to enable synchronization of inventory with Terraform.
Terraform is a HashiCorp tool used to automate various infrastructure tasks.
Select this credential type to enable synchronization with the Terraform inventory source.

Terraform credentials require the following inputs:
The Terraform credential requires the *Backend configuration* attribute which must contain the data from a link:https://developer.hashicorp.com/terraform/language/settings/backends/configuration[Terraform backend block].
You can paste, drag a file, browse to upload a file, or click the image:leftkey.png[Key,15,15] icon to populate the field from an external xref:assembly-controller-secret-management[Secret Management System].

Terraform backend configuration requires the following inputs:

* *Name*
* Credential type: Select *Terraform backend configuration*.
* Optional: *Organization*
* Optional: *Description*
//Not yet available in test env. *Backend configuration*: Drag a file here or browse to upload.
//This must contain the data from a link:https://developer.hashicorp.com/terraform/language/settings/backends/configuration[Terraform backend block].
//Example configuration for an S3 backend:
//[literal, options="nowrap" subs="+attributes"]
//----
//bucket = "my-terraform-state-bucket"
//key = "path/to/terraform-state-file"
//region = "us-east-1"
//access_key = "my-aws-access-key"
//secret_key = "my-aws-secret-access-key"
//----
//Not yet available in test env.
* *Backend configuration*: Drag a file here or browse to upload.

Example configuration for an S3 backend:

----
bucket = "my-terraform-state-bucket"
key = "path/to/terraform-state-file"
region = "us-east-1"
access_key = "my-aws-access-key"
secret_key = "my-aws-secret-access-key"
----

0 comments on commit e003827

Please sign in to comment.