Giter Club home page Giter Club logo

terraform-provider-awx's Introduction

Terraform Provider AWX

_Fork from mrcrilly/terraform-provider-awx for develop additional functions.

Coming soon.

Local Development

1) Start a Local AWX instance in a kubernetes cluster

A fresh AWX instance is required for automated tests, so they can ensure terraform provider is working by targetting a live AWX instance.

A new instance can be re-created by invoking the reCreate mage target defined in tools/magefile.go. Once executed it will deploy an AWX instance to a Kubernetes cluster, using kind.

cd ./tools && go run mage.go -v reCreate && cd ..

2) Build Provider

  1. Ensure GoReleaser is installed
  2. Run build command:
goreleaser build --snapshot --rm-dist

3) Copy Provider

Copy the provider to user's ~/.terraform.d folder.

Important: if building the provider in an operating system other than Linux x86_64, adjust the paths below replacing linux_amd64 with the corresponding platform code. E.g.: darwin_amd64 for macOS.

mkdir -p ~/.terraform.d/plugins/github.com/denouche/awx/0.1/linux_amd64/terraform-provider-awx
find ./dist/terraform-provider-awx_linux_amd64/* -name 'terraform-provider-awx*' -print0 | xargs -0 -I {} mv {} ~/.terraform.d/plugins/github.com/denouche/awx/0.1/linux_amd64/terraform-provider-awx

4) Run tests and ensure they're all passing

go test ./test -count=1

Optional: All in one command

For convenience, all the steps above can be achieved by a single command that combines all of them:

goreleaser build --snapshot --rm-dist \
    && mkdir -p ~/.terraform.d/plugins/github.com/denouche/awx/0.1/linux_amd64/ \
    && find ./dist/terraform-provider-awx_linux_amd64/* -name 'terraform-provider-awx*' -print0 | xargs -0 -I {} mv {} ~/.terraform.d/plugins/github.com/denouche/awx/0.1/linux_amd64/terraform-provider-awx \
    && go test ./test -count=1

Update documentation

The files in ./docs folder are generated by executing the genDocumentation target defined in tools/magefile.go file:

cd ./tools && go run mage.go -v genDocumentation && cd ..

terraform-provider-awx's People

Contributors

anthonysterling avatar aperigault avatar chavo11 avatar claudex avatar denouche avatar dependabot[bot] avatar f0rkz avatar fivetran-joliveira avatar jfroche avatar jnahelou avatar lavahot avatar maxwoerner avatar mrcrilly avatar nolte avatar opsfactoryau avatar semantic-release-bot avatar spacex avatar tioborto avatar vaxvms avatar wdreeveii avatar wrighbr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

terraform-provider-awx's Issues

awx_job_template not wait for the first scm update of the awx_project to completed prior to it creation

Hi

At the moment we are trying to using this provider to deploy our projects and templates in several AWX instances, and we notice that the default behavior of the awx_job_template is that it would not wait for the first scm update of the awx_project to completed prior to it creation, leading to cases where the awx_job_template creation failure (since at that time the playbook(s) of the projects still haven't been cloned/checked out yet.

Is this the intended behavior? Are the provider going to support some flag that ensure the latest job of /project_updates/ endpoint for that project is done before marking the awx_project as complete? Any recommended workaround at the moment?

I have checked the https://github.com/denouche/goawx/ repo but doesn't seem like the client support doing that yet.

Provider unable to create AWX client

Currently working on trying to get the awx terraform provider to work with awx version 21.3.0. But when I do I get this error:

image

My config is like this:

terraform {
  required_version = ">= 1.0.0"
  required_providers {
    awx = {
      source  = "denouche/awx"
      version = "0.15.6"
    }
  }
}

provider "awx" {
  hostname = "https://my.awx.domain:443"
  username = "my_user"
  password = "my_passw"
}

Again, using AWX version 21.3.0 being deployed to kubernetes via their helm chart. I've looked at this 100 different ways but Im not sure how it wouldn't work lol. Let me know if there's anything I'm missing or if there's more ways to test this

FEATURE: awx_team_role, awx_organization_role, awx_job_template_role, awx_credential_role

Hello,

  • can you add the Data Source awx_team_role to add a Team the grant of "Member" of another team?
    This is supported by Ansible AWX APIs (even if not shown in AWX UI) and useful for RBAC management

  • can you add the Data Source awx_organization_role to add a Team or a User a specific grant to a Job Template (e.g. Inventory Admin, Credentials Admin, Project Admin, Execute etc. roles)?
    This is supported by Ansible AWX APIs and UI

  • can you add the Data Source awx_job_template_role to add a Team or a User a specific grant to a Job Template (e.g. Execute role)?
    This is supported by Ansible AWX APIs and UI

  • can you add the Data Source awx_credential_role to add a Team or a User a specific grant to a Credential (e.g. Use role)?
    This is supported by Ansible AWX APIs and UI

Useful ref. of Ansible AWX collection: https://docs.ansible.com/ansible/latest/collections/awx/awx/role_module.html#ansible-collections-awx-awx-role-module

Thank you!
Claudio

Plugin Crash when creating awx_organization

I get the following error when I try to create a new awx_organization:

awx_organization.acc-test: Creating...
╷
│ Error: Plugin did not respond
│
│   with awx_organization.acc-test,
│   on test.tf line 1, in resource "awx_organization" "acc-test":
│    1: resource "awx_organization" "acc-test" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-awx_v0.24.3 plugin:

panic: interface conversion: interface {} is nil, not int

goroutine 65 [running]:
github.com/denouche/terraform-provider-awx/awx.resourceOrganizationsCreate({0xe293a8, 0xc0005dd980}, 0x0?, {0xbb8460?, 0xc0005a0000?})
        github.com/denouche/terraform-provider-awx/awx/resource_organization.go:91 +0x6d1
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000149a40, {0xe293e0, 0xc0005dcea0}, 0xd?, {0xbb8460, 0xc0005a0000})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:778 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000149a40, {0xe293e0, 0xc0005dcea0}, 0xc000418750, 0xc0004ae880, {0xbb8460, 0xc0005a0000})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000369f20, {0xe293e0?, 0xc0005dcd80?}, 0xc00007df90)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1072 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00020afa0, {0xe293e0?, 0xc0005dc360?}, 0xc0001620e0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:859 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xcd29a0?, 0xc00020afa0}, {0xe293e0, 0xc0005dc360}, 0xc000162070, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002061e0, {0xe2d0b8, 0xc00008a680}, 0xc00059ac60, 0xc000373cb0, 0x131ad78, 0x0)
        google.golang.org/[email protected]/server.go:1358 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc0002061e0, {0xe2d0b8, 0xc00008a680}, 0xc00059ac60, 0x0)
        google.golang.org/[email protected]/server.go:1735 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/[email protected]/server.go:970 +0xca
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:981 +0x15c

Error: The terraform-provider-awx_v0.24.3 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

I use a freshly installed awx instance. (AWX-Operator 2.15.0 ,AWX 24.2.0)
Maybe related to #66

awx_inventory_source doesn't allow empty credentials ID

Hi,
AWX API permits to create an inventory source without specifying the credentials: if the credential ID is not passed it defaults to "None" instead of the expected integer.
However the current code casts the input to int and so passes "0" to the API instead of "None" returning this error:

resource "awx_inventory_source" "dynamic_inventory_source" {

│ Unable to create Inventory Source got Errors:
│ - credential: [Credential 0 does not exist]

This is particular problematic because it forces to create and use an AWS user instead of relying on the assume role inside ec2_plugin.

I've tried working it around inside the provider resource code but I'm not that much into Golang.

Stack trace when printing an error message.

We were testing the provider, and tried to change a resource while logged in with an API token that had read-only permissions. Instead of the error message at line 91 of awx/resource_organization.go, we got this stack trace:

Terraform will perform the following actions:

  # awx_organization.deleteme will be created
  + resource "awx_organization" "deleteme" {
      + default_environment = 0
      + description         = "just testing some more"
      + id                  = (known after apply)
      + max_hosts           = 0
      + name                = "Delete Me"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

awx_organization.deleteme: Creating...
╷
│ Error: Request cancelled
│ 
│   with awx_organization.deleteme,
│   on organizations.tf line 25, in resource "awx_organization" "deleteme":
│   25: resource "awx_organization" "deleteme" {
│ 
│ The plugin.(*GRPCProvider).ApplyResourceChange request was cancelled.
╵

Stack trace from the terraform-provider-awx_v0.24.3 plugin:

panic: interface conversion: interface {} is nil, not int

goroutine 55 [running]:
github.com/denouche/terraform-provider-awx/awx.resourceOrganizationsCreate({0xe293a8, 0xc0005274d0}, 0x0?, {0xbb8460?, 0xc000192000?})
	github.com/denouche/terraform-provider-awx/awx/resource_organization.go:91 +0x6d1
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000173a40, {0xe293e0, 0xc0005269f0}, 0xd?, {0xbb8460, 0xc000192000})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:778 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000173a40, {0xe293e0, 0xc0005269f0}, 0xc0004f8dd0, 0xc000528200, {0xbb8460, 0xc000192000})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0003aded8, {0xe293e0?, 0xc0005268d0?}, 0xc00009bea0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1072 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000259040, {0xe293e0?, 0xc0004efec0?}, 0xc00021f180)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:859 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xcd29a0?, 0xc000259040}, {0xe293e0, 0xc0004efec0}, 0xc00021f110, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002521e0, {0xe2d0b8, 0xc0004069c0}, 0xc0004fc360, 0xc0003b7cb0, 0x131ad78, 0x0)
	google.golang.org/[email protected]/server.go:1358 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc0002521e0, {0xe2d0b8, 0xc0004069c0}, 0xc0004fc360, 0x0)
	google.golang.org/[email protected]/server.go:1735 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	google.golang.org/[email protected]/server.go:970 +0xca
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:981 +0x15c

Error: The terraform-provider-awx_v0.24.3 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Data source aws_credentials doesn't work properly

When calling the data awx_credentials resource it returns me an array of 1 with the id of the single element been my organization id and other informations been empty.

Example :

data "awx_credentials" "credentials" {
}

output "credentials" {
  value = data.awx_credentials.credentials
}


Changes to Outputs:
  + credentials = {
      + credentials = [
          + {
              + id       = 25
              + kind     = ""
              + username = ""
            },
        ]
      + id          = "1700688727"
    }

Thank you !

Job template surveys

Thanks for this provider, I'm looking forward to testing it out.

Have you considered how to support job template surveys? It's a tricky bit, but could be handled as a substructure within the awx_job_template object.

Anyway, that's something that I'm interested in and would use as I'm working with my customers.

Any example on how to terraform AWX constructed inventories?

Constructed inventories are a pretty cool new feature added to AWX recently as a replacement/improvement for the so called "smart inventories".
Feature implementation details: ansible/awx#13448

AWX API endpoints related to this feature:

Example id = 123
/api/v2/inventories/123/
/api/v2/constructed_inventories/123/

My attempts to provision a constructed inventory using this AWX terraform provider:

Using source_vars:

resource "awx_inventory" "gcp_asia" {
  organization_id = awx_organization.<my-org>.id
  kind            = "constructed"
  name            = "GCP Asia"
  source_vars     = <<EOF
---
plugin: constructed
strict: true
use_vars_plugins: true
groups:
  test_group_gcp_asia_constructed: is_test_host and zone.startswith("asia")
compose:
  is_test_host: project == "my-project"
  EOF
}
Error:
terraform plan 
Error: Unsupported argument
 
   on awx-inventories-gcp.tf line 53, in resource "awx_inventory" "gcp_tunnels_asia":
   53:   source_vars     = <<EOF
 
 An argument named "source_vars" is not expected here.

Without source_vars:

resource "awx_inventory" "gcp_asia" {
  organization_id = awx_organization.<my-org>.id
  kind            = "constructed"
  name            = "GCP Asia"
}
Error:
terraform apply -auto-approve
Error: Unable to update Inventory

  with awx_inventory.gcp_asia,
  on <my file>.tf line 43, in resource "awx_inventory" "gcp_asia":
  43: resource "awx_inventory" "gcp_asia" {

Unable to update Inventory with id 123: got responsed with 405, resp: &{405 Method Not Allowed 405 HTTP/2.0
2 0 map[Access-Control-Expose-Headers:[X-API-Request-Id] Allow:[GET, PUT, PATCH, DELETE, HEAD, OPTIONS]
Alt-Svc:[h3=":443"; ma=2592000,h3-29=":443"; ma=2592000] Content-Language:[en] Content-Length:[94]
Content-Type:[application/json] Date:[Mon, 12 Jun 2023 19:45:48 GMT] Server:[nginx] Vary:[Accept,
Accept-Language, Origin, Cookie] Via:[1.1 google] X-Api-Node:[awx-sre-web-5cbb464f4f-r7jj4]
X-Api-Product-Name:[AWX] X-Api-Product-Version:[22.3.0]
X-Api-Request-Id:[29bf20b4cfa64bf082c6ea07fd38eb98] X-Api-Time:[0.502s] X-Api-Total-Time:[0.610s]]
{0x14000304180} 94 [] false false map[] 0x140004d6300 0x140003933f0}

Are there any plans to implement support for constructed inventories so they can be managed with this AWX terraform provider?

Migration to different go client

The current go client used is currently coded by hand and has several unimplemented endpoints. There exist go clients that are generated from awx's swagger api that have the full capabilities we are looking for and are kept up to date using automation.

Repo here: https://github.com/go-limix/awx-client

This might take some work, but it would allow for the rest of the resources to be quickly added.

Getting errors on create awx_inventory_source

I am trying to configure an awx_inventory_source but I am not having success with it.

This is the error that I get:

╷
│ Error: Unable to create Inventory Source
│ 
│   with awx_inventory_source.use1_labs_eks_worker,
│   on main.tf line 23, in resource "awx_inventory_source" "use1_labs_eks_worker":
│   23: resource "awx_inventory_source" "use1_labs_eks_worker" {
│ 
│ Unable to create Inventory Source got Errors:
│ - detail: []
╵
Releasing state lock. This may take a few moments...
ERRO[0031] Hit multiple errors:
Hit multiple errors:
exit status 1 

Below is my awx_inventory and awx_inventory_source definition:

resource "awx_inventory" "use1_labs_eks_worker" {
  name            = "use1-labs-eks-worker"
  description     = "eks-worker inventory in use1 and labs"
  organization_id = awx_organization.default.id
}
resource "awx_inventory_source" "use1_labs_eks_worker" {
  name              = "use1-labs-eks-worker"
  description       = "all eks-worker instances in labs and use-1 region"
  credential_id     = data.awx_credential.aws.id
  inventory_id      = data.awx_inventory.use1_labs_eks_worker.id
  source            = "Amazon EC2"
  overwrite         = true
  update_on_launch  = true
  verbosity         = 1
  source_vars       = <<YAML
---
regions:
  - "us-east-1"
iam_role_arn: "arn:aws:iam::451476197489:role/terraform-ansible"
hostnames:
  - name: 'private-ip-address'
    separator: '_'
    prefix: 'tag:Name'
filters:
  tag:role: "eks_worker"
  tag:environment: "labs"
compose:
  ansible_host: private_ip_address
YAML
}

Thanks in advance!

Add support param to job_template_launch

job_template_launch can launch a job template. However, if we want to send custom limit, extra_vars, job_tags, inventory or credential it's not possible due to this lack.

Can you add the support of this params ?
(api documentation: ansible-tower)

Regards

Question about source_project_id

Hello @denouche,

Do you know why "source_project_id" has been commented ?
Because it's require when you want to use a SCM inventory https://docs.ansible.com/ansible-tower/latest/html/administration/scm-inv-source.html#update-on-project-update

// "source_project": d.Get("source_project_id").(int),

Furthermore, this parameter still exists in the API https://github.com/ansible/awx/blob/devel/awx/api/serializers.py#L2098

Thanks

Credential resources cause constant diffs

Currently, all credential resources cause diffs between runs.

This is because they store the value from the read response, which always has the sensitive attributes (such as ssh_key_data) returning $encrypted$.

There are 3 solutions as I see it:

  1. AWX API needs to be changed to return a verifiable attribute, such as private key hash (unlikely)
  2. Store the private key from the create resource call and remove storing it from the read response. Benefit is the state knows the exact key and compare it to the input.
  3. Suppress the diff using DiffSupprrssFunc on the key data attribute in the schema that suppresses if the old value is "$encrypted$". Issue here is if the user does change key_data, it won't be picked up.

terraform-provider-awx_v0.19.0 plugin crashed!

we get below issue while connecting to denouche awx provider . any idea ?

terraform-provider-awx_v0.19.0 plugin crashed!

panic: runtime error: index out of range [0] with length 0

goroutine 30 [running]:
github.com/denouche/terraform-provider-awx/awx.dataSourceInventoriesRead({0xd04c78, 0xc0004180c0}, 0x7eb9564dbf18, {0xad66a0, 0xc000162300})
github.com/denouche/terraform-provider-awx/awx/data_source_inventory.go:87 +0x68b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc0003a2a80, {0xd04c78, 0xc0004180c0}, 0xc00054a5a0, {0xad66a0, 0xc000162300})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:358 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc0003a2a80, {0xd04c78, 0xc0004180c0}, 0xc0000e3180, {0xad66a0, 0xc000162300})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:569 +0xf7
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc00000d578, {0xd04c78, 0xc0004180c0}, 0xc00031ca60)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1133 +0x3a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0xc00014f080, {0xd04d20, 0xc000409cb0}, 0xc000472870)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:478 +0x37b
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0xbcf200, 0xc00014f080}, {0xd04d20, 0xc000409cb0}, 0xc000510de0, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:416 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00027b340, {0xd12678, 0xc000200780}, 0xc0000b6400, 0xc0003c5380, 0x11da9d0, 0x0)
google.golang.org/[email protected]/server.go:1194 +0xc8f
google.golang.org/grpc.(*Server).handleStream(0xc00027b340, {0xd12678, 0xc000200780}, 0xc0000b6400, 0x0)
google.golang.org/[email protected]/server.go:1517 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/[email protected]/server.go:859 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/[email protected]/server.go:857 +0x294

Approval Node

Does this provider allow you to create an approval workflow node?

data_awx_workflow_job_template_node

hi,

we would like to be able to add and remove nodes in a workflow job template that was created outside of terraform. there is an api for that in AWX here:

/api/v2/workflow_job_templates/302/workflow_nodes/?page=1&page_size=200

so it seems it might be an easy addition?

here's what we would like to use:

data "awx_workflow_job_template_node" "existing_node" {
       workflow_job_template_id = NNN
       name = "example name"
}

resource "awx_workflow_job_template_node_success" "new_node" {
               workflow_job_template_id = NNN
               workflow_job_template_node_id = data.awx_workflow_job_template_node.existing_node.id
              [....]
}

would this be easily doable? it looks like yes, but the go foo is lacking on my side ...

regards

.rm

unified_job_template_id only allow a single id with awx_workflow_job_template_node_success resource / failure / always

Hi

For the awx_workflow_job_template_node_success (and the failure/always one) the current implementation is only allow the a single workflow_job_template_node_id to be passed in, which limit the possible case of building a workflow node direction to only 1->1 or 1->many, but not many->1.

image

A suggestion would be either allow a list of id to be passed in the unified_job_template_id or another resource that manage the additional link between nodes via the /workflow_job_template_nodes/<id>/success_nodes/ end point

Awx create credential

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?

awx_settings resouce not working

I tried creating some saml resource using
resource "awx_settings" but it didn't do anything. Is it woking or better if you have an example for that

I am doing something like this

  name  = "SOCIAL_AUTH_SAML_ENABLED_IDPS"
  value = file("./files/${var.environment}.json")
}```

bit no resource is getting created

Add application resource

AWX allows an API for creating Authentication applications (found here).

Currently, there is no resource for creating those applications. These would be helpful for users who want to declaratively manage their authentication configuration.

This would require one resource (applications) and one data source.

If its something of interest, I'm happy to work on this.

Add support to `ask_scm_branch_on_launch` for `awx_job_template`

Hi,
Firstly, congrats for the provider, it helps a lot managing our AWX instances. Great work!

Is it expectable in the near future having support for the parameter ask_scm_branch_on_launch on resource awx_job_template?
It will be a great help for our specific use cases.

Thanks!

Error creating schedule for job template

I tried creating a schedule for a job template but got the following error:

resource "awx_schedule" "backup" {
Schedule failed to create Errors:

  • inventory: [Invalid pk "0" - object does not exist.]

How can I further troubleshoot this issue?

Provider crashes with Go error

Running against a fresh install of AWX (awx-operator-2.12.1)

awx_organization.it_ops: Creating...
╷
│ Error: Plugin did not respond
│ 
│   with awx_organization.it_ops,
│   on organization.tf line 1, in resource "awx_organization" "it_ops":
│    1: resource "awx_organization" "it_ops" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-awx_v0.24.3 plugin:

panic: interface conversion: interface {} is nil, not int

goroutine 57 [running]:
github.com/denouche/terraform-provider-awx/awx.resourceOrganizationsCreate({0x100c9eb08, 0x14000611e00}, 0x0?, {0x100b4a7a0?, 0x14000152100?})
        github.com/denouche/terraform-provider-awx/awx/resource_organization.go:91 +0x57c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x140000e5a40, {0x100c9eb40, 0x14000611320}, 0xd?, {0x100b4a7a0, 0x14000152100})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:778 +0xe8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140000e5a40, {0x100c9eb40, 0x14000611320}, 0x1400039e8f0, 0x140000e3300, {0x100b4a7a0, 0x14000152100})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0x8a0
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400036dfb0, {0x100c9eb40?, 0x14000611200?}, 0x140004aad70)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1072 +0xb78
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x1400022b040, {0x100c9eb40?, 0x14000610810?}, 0x140002dccb0)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:859 +0x3bc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x100c67c20?, 0x1400022b040}, {0x100c9eb40, 0x14000610810}, 0x140002dcc40, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:467 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x140002241e0, {0x100ca27d8, 0x14000480680}, 0x1400045ac60, 0x14000379cb0, 0x101175d18, 0x0)
        google.golang.org/[email protected]/server.go:1358 +0xcb4
google.golang.org/grpc.(*Server).handleStream(0x140002241e0, {0x100ca27d8, 0x14000480680}, 0x1400045ac60, 0x0)
        google.golang.org/[email protected]/server.go:1735 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/[email protected]/server.go:970 +0xb4
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:981 +0x174

Unable to create Schedule

Good day!

I can't create a schedule for a job template.

Code:

resource "awx_schedule" "run" {

  name                    = "${var.PROJECT_NAME} run"
  description             = var.FOOTPRINT
  unified_job_template_id = awx_job_template.run.id
  rrule                   = var.RUN_SCHEDULE
}

Plan:

  # awx_schedule.run will be created
  + resource "awx_schedule" "run" {
      + description             = "Terraform project: ansible/ansible-playbooks/gw-d"
      + enabled                 = true
      + id                      = (known after apply)
      + name                    = "gw-d run"
      + rrule                   = "DTSTART;TZID=Europe/Paris:20211214T120000 RRULE:INTERVAL=1;FREQ=DAILY"
      + unified_job_template_id = 74
    }

Result:

awx_schedule.run: Creating...
╷
│ Error: Unable to create Schedule
│
│   with awx_schedule.run,
│   on awx.tf line 92, in resource "awx_schedule" "run":
│   92: resource "awx_schedule" "run" {
│
│ Schedule failed to create Errors:
│ - detail: []
╵

AWX 23.7.0
Terraform v1.7.5

  • provider registry.terraform.io/denouche/awx v0.24.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.