rundeck / terraform-provider-rundeck

Terraform Rundeck provider
https://www.terraform.io/docs/providers/rundeck/
Mozilla Public License 2.0
52 stars 61 forks source link

How to pass an option to an inline_script defined in rundeck_job #118

Open ronaldoafonsoncsa opened 1 year ago

ronaldoafonsoncsa commented 1 year ago

Hi all,

I'm using the rundeck terraform provider and I need to pass a variable or option to an inline_script that I added to a job workflow. I was not able to find that argument for the rundeck_job resource so I started wondering if that kind of argument really exists.

In the UI I can configure a parameter like "${option.NAME}", so the command will end up executing like: echo.sh ${option.NAME}. I just don't know how to do the same using Terraform code.

Terraform Version

Terraform v1.3.7 on linux_amd64

Affected Resource(s)

Terraform Configuration Files


resource "rundeck_job" "echo" {
  name                         = "echo"
  project_name            = rundeck_project.name
  description                 = "Echo a name"
  schedule_enabled     = false
  schedule                    = ""
  node_filter_query       = "some-nodes-.*"
  node_filter_exclude_query   = ""
  allow_concurrent_executions = true
  max_thread_count            = 10

  command {
    inline_script = file("${path.module}/scripts/echo.sh")
  }

  option {
    name     = "NAME"
    required = true
  }
}

Debug Output

There is no error since it seems that this functionality is not supported by the Rundeck Terraform module. I guess.

Panic Output

There is no panic.

Expected Behavior

I was expecting the echo.sh command to be executed like echo.sh ${option.NAME}.

Actual Behavior

The echo.sh command is being executed like: echo.sh (no parameter is passed to the echo.sh shell script).

fdevans commented 1 month ago

Did you try putting them in single quotes? echo 'a name'