Uploaded image for project: 'Ansible Cloud Automation'
  1. Ansible Cloud Automation
  2. ACA-1111

Create a new inventory plugin for cloud.terraform

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Undefined Undefined
    • Testing
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • ANSTRAT-29 - Add value to Terraform for AAP customers

      Background

      The cloud.terraform collection already has the terraform_provider inventory plugin, which is designed to work in tandem with the Ansible provider. We want a new inventory plugin that can directly work with an existing state file to create an inventory from resources created by cloud providers.

      For this initial iteration, create a terraform_state inventory plugin that can pull aws_instance resources out of a state file. We can keep this simple for now, and avoid placing hosts in groups, or doing any kind of filtering/querying. More complicated functionality will be added in later iterations.

      The inventory plugin should accept a Terraform backend config to an existing state file. Like the existing terraform_provider inventory plugin, use terraform show -json to read the state file. terraform show will only work with an initialized directory, but with this inventory plugin we won't have the Terraform project available. We will need to write the provided backend config to a main.tf file and then initialize the directory before running terraform show.

      Please submit your PR against the statefile-inventory branch on the cloud.terraform repo.

      Definition of Done

      For demonstrating the inventory plugin, you can just use the command line. In a later step we will add a new inventory source type to AAP to allow the inventory plugin to be used in the platform.

      • A PR with a new inventory plugin and a suite of tests verifying its functionality.
      • A recorded demo showing the new inventory plugin doing the following:
        1. Provision multiple ec2 instances using cloud.terraform with an S3 state backend.
        2. Use the new inventory plugin with the configured S3 state backend to generate the list of ec2 instances previously created.

              abikouo1@redhat.com BIKOUO AUBIN
              mgraves1@redhat.com Mike Graves
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: