Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Awx create credential #42

Open
Arjunasvr opened this issue Aug 11, 2023 · 2 comments
Open

Awx create credential #42

Arjunasvr opened this issue Aug 11, 2023 · 2 comments

Comments

@Arjunasvr
Copy link

Hi all I am trying to create a credential with terraform to awx. I really don't know what I need to put in inputs field. Here is my code:

resource "awx_credential" "add_cred" {
credential_type_id = 29
inputs = "username"
name = "${var.hostname}"
organization_id = 1
}

I also tried:

inputs = [
password = "${var.password}"
username = "userneme"
]

Does someone have a sample code or a solution?

@survfate
Copy link

Here is what working for me, prob there is other way to do define the inputs but I have been sticking to this since.

resource "awx_credential" "ssh_user_test" {
  name               = "SSH User"
  credential_type_id = 1
  description        = "SSH user with KeyPair"
  organization_id    = 1
  inputs = jsonencode(
    {
      "ssh_key_data" : "",
      "username" : "local_user"
    }
  )
}

@fivetran-joliveira
Copy link

I really don't know what I need to put in inputs field

You can use AWX API to see which input fields are expected and required by each credential type:

  1. Access AWX API https://<your awx domain.example.com>/api
  2. List all the credential types to find the one you want to create a credential
    • https://<your awx domain.example.com>/api/v2/credential_types/
  3. Then make sure on your terraform code you are providing at least the input fields listed under required and you should be fine
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants