Skip to content

Feature: Add credential type resource and data source

Compare
Choose a tag to compare
@github-actions github-actions released this 25 Oct 14:34
· 25 commits to develop since this release

This release adds the resource awx_credential_type as well as a data source awx_credential_type.

This is useful for configuring custom data types.

Example:

terraform {
    required_providers {
        awx = {
            source = "f0rkz/awx"
            version = "0.7.1"
        }
    }
}

provider "awx" {
    hostname = "https://your-tower-host.com"
    username = "someuser"
    password = "somepassword"
}

data "awx_credential_type" "testing" {
    id = awx_credential_type.testing.id
}

resource "awx_credential_type" "testing" {
    name = "testing credential type"
    description = "this is a test"
    inputs = jsonencode(
        {
            "fields": [
                {
                    "id": "db_hostname",
                    "type": "string",
                    "label": "Database Hostname foo"
                },
                {
                    "id": "db_name",
                    "type": "string",
                    "label": "Database Name"
                },
                {
                    "id": "db_username",
                    "type": "string",
                    "label": "Database Username"
                },
                {
                    "id": "db_password",
                    "type": "string",
                    "label": "Database Password",
                    "secret": true
                }
            ],
            "required": [
                "db_hostname",
                "db_username",
                "db_password",
                "db_name"
            ]
        }
    )
    injectors = jsonencode(
        {
            "extra_vars": {
                "db_hostname": "{{ db_hostname }}",
                "db_name": "{{ db_name }}",
                "db_password": "{{ db_password }}",
                "db_username": "{{ db_username }}"
            }
        }
    )
}