rundeck/terraform-provider-rundeck

node_step_plugin and step_plugin fail silently

achilds-vela opened this issue · 2 comments

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Terraform v0.12.21
+ provider.rundeck v0.4.0

Affected Resource(s)

  • rundeck_job

Terraform Configuration Files

variable "rundeck_api_version" {}
variable "rundeck_project" {}
variable "rundeck_token" {}
variable "rundeck_url" {}

provider "rundeck" {
  url         = var.rundeck_url
  api_version = var.rundeck_api_version
  auth_token  = var.rundeck_token
}

resource "rundeck_job" "step_plugin" {
  name         = "Example-step_plugin"
  project_name = var.rundeck_project
  description  = ""

  command {
    shell_command = "echo 'RUNDECK:DATA:my_key = my_value'"

    step_plugin {
      type = "key-value-data"

      config = {
        logData = true
        regex   = "^RUNDECK:DATA:(.+?)\\s*=\\s*(.+)$"
      }
    }
  }
}

resource "rundeck_job" "node_step_plugin" {
  name         = "Example node_step_plugin"
  project_name = var.rundeck_project
  description  = ""

  command {
    shell_command = "echo 'RUNDECK:DATA:my_key = my_value'"

    node_step_plugin {
      type = "key-value-data"

      config = {
        logData = true
        regex   = "^RUNDECK:DATA:(.+?)\\s*=\\s*(.+)$"
      }
    }
  }
}

Debug Output

https://gist.github.com/achilds-vela/69138bdef8015531c6ad74cec75245e3

Specifically:

2020/02/21 17:02:17 [WARN] Provider "registry.terraform.io/-/rundeck" produced an unexpected new value for rundeck_job.node_step_plugin, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .command[0].node_step_plugin: block count changed from 1 to 0

and

2020/02/21 17:02:17 [WARN] Provider "registry.terraform.io/-/rundeck" produced an unexpected new value for rundeck_job.step_plugin, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .command[0].step_plugin: block count changed from 1 to 0

Panic Output

None

Expected Behavior

If the node_step_plugin or step_plugin fails to "take", it should alert me when performing a terraform apply, or if something's not supported (yet?), throw an error and tell me to remove it.

Actual Behavior

Terraform output:

**Apply complete! Resources: 2 added, 0 changed, 0 destroyed.**

And any subsequent plans will perpetually show Plan: 0 to add, 2 to change, 0 to destroy.
Example for step_plugin (also applies to node_step_plugin):

  # rundeck_job.step_plugin will be updated in-place
  ~ resource "rundeck_job" "step_plugin" {
...
      ~ command {
            shell_command = "echo 'RUNDECK:DATA:my_key = my_value'"

          + step_plugin {
              + config = {
                  + "logData" = "true"
                  + "regex"   = "^RUNDECK:DATA:(.+?)\\s*=\\s*(.+)$"
                }
              + type   = "key-value-data"
            }
        }
    }

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

Steps to Reproduce

  1. terraform apply

Important Factoids

My Rundeck Version: Rundeck 3.2.1-20200113
My Rundeck API Version: 34

References

None that I know of.

Hello, it looks like you are trying to use log filters. I have just done a PR about it as it was not supported yet. It won't fix the fact that the step_plugin and node_step_plugin fail silently, but i thought that you could find it of interest https://github.com/terraform-providers/terraform-provider-rundeck/pull/55

Please try to recreate this issue on the current Terraform and provider version. If you still have trouble open a new issue with steps to reproduce please.