rundeck / terraform-provider-rundeck

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

Segmentation faults for all resources #48

Closed iridian-ks closed 1 year ago

iridian-ks commented 4 years ago

Affected Resource(s)

rundeck_*

Terraform Configuration Files

provider "rundeck" {
  url         = "https://myurlwithvalidtls.com"
  auth_token  = ""
  api_version = 32
}

locals {
  private_key_path = "middleware/id_rsa"
}

resource "tls_private_key" "middleware" {
  algorithm = "RSA"
}

resource "rundeck_private_key" "middleware" {
  path         = local.private_key_path
  key_material = tls_private_key.middleware.private_key_pem
}

resource "rundeck_public_key" "middleware" {
  path         = "${local.private_key_path}.pub"
  key_material = tls_private_key.middleware.public_key_openssh
}

resource "rundeck_project" "middleware" {
  name                 = "middleware"
  description          = "jobs granted to everyone - brought to you by middleware"
  ssh_key_storage_path = local.private_key_path

  resource_model_source {
    type   = "file"
    config = {
      format = "resourcexml"
      file   = "/var/rundeck/projects/middleware/resources.xml"
    }
  }
}

Debug Output

tls_private_key.middleware: Refreshing state... [id=315ab18cc048adb9b2a8b02ddc89e29cb03a7987]
rundeck_private_key.middleware: Creating...

Error: rpc error: code = Unavailable desc = transport is closing

panic: runtime error: invalid memory address or nil pointer dereference
2020-01-31T00:41:56.529Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe0ee00]
2020-01-31T00:41:56.529Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:
2020-01-31T00:41:56.529Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: goroutine 42 [running]:
2020-01-31T00:41:56.530Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: github.com/terraform-providers/terraform-provider-rundeck/rundeck.CreateOrUpdatePrivateKey(0xc00017efc0, 0x10a71e0, 0xc0002cc120, 0x2, 0x1bc1620)
2020-01-31T00:41:56.530Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/rundeck/resource_private_key.go:69 +0x3f0
2020-01-31T00:41:56.531Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: github.com/terraform-providers/terraform-provider-rundeck/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0002e6f80, 0xc0000bf270, 0xc000565fa0, 0x10a71e0, 0xc0002cc120, 0xf21d01, 0xc0000b7468, 0xc000153cb0)
2020-01-31T00:41:56.531Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:286 +0x363
2020-01-31T00:41:56.532Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: github.com/terraform-providers/terraform-provider-rundeck/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc0002e7100, 0xc0006239b8, 0xc0000bf270, 0xc000565fa0, 0xc0000b74e0, 0xc0001640b0, 0xf23dc0)
2020-01-31T00:41:56.532Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:285 +0x9c
2020-01-31T00:41:56.532Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: github.com/terraform-providers/terraform-provider-rundeck/vendor/github.com/hashicorp/terraform/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc0001644c8, 0x126b920, 0xc000153620, 0xc0000a6cc0, 0xc0001644c8, 0xc000153590, 0xf49300)
2020-01-31T00:41:56.533Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go:842 +0x87a
2020-01-31T00:41:56.533Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: github.com/terraform-providers/terraform-provider-rundeck/vendor/github.com/hashicorp/terraform/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x106c0c0, 0xc0001644c8, 0x126b920, 0xc000153620, 0xc0000befa0, 0x0, 0x0, 0x0, 0xc00020c000, 0xe00)
2020-01-31T00:41:56.533Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go:3019 +0x23e
2020-01-31T00:41:56.534Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: github.com/terraform-providers/terraform-provider-rundeck/vendor/google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000a9080, 0x12721e0, 0xc000081080, 0xc00015e400, 0xc0000adb00, 0x1b93a80, 0x0, 0x0, 0x0)
2020-01-31T00:41:56.534Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/vendor/google.golang.org/grpc/server.go:972 +0x4a2
2020-01-31T00:41:56.535Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: github.com/terraform-providers/terraform-provider-rundeck/vendor/google.golang.org/grpc.(*Server).handleStream(0xc0000a9080, 0x12721e0, 0xc000081080, 0xc00015e400, 0x0)
2020-01-31T00:41:56.535Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/vendor/google.golang.org/grpc/server.go:1252 +0xe02
2020-01-31T00:41:56.536Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: github.com/terraform-providers/terraform-provider-rundeck/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc0000a0100, 0xc0000a9080, 0x12721e0, 0xc000081080, 0xc00015e400)
2020-01-31T00:41:56.537Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/vendor/google.golang.org/grpc/server.go:691 +0x9f
2020-01-31T00:41:56.537Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: created by github.com/terraform-providers/terraform-provider-rundeck/vendor/google.golang.org/grpc.(*Server).serveStreams.func1
2020-01-31T00:41:56.538Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-rundeck/vendor/google.golang.org/grpc/server.go:689 +0xa1
2020/01/31 00:41:56 [DEBUG] rundeck_private_key.middleware: apply errored, but we're indicating that via the Error pointer rather than returning it: rpc error: code = Unavailable desc = transport is closing
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/01/31 00:41:56 [TRACE] EvalMaybeTainted: rundeck_private_key.middleware encountered an error during creation, so it is now marked as tainted
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/01/31 00:41:56 [TRACE] EvalWriteState: removing state object for rundeck_private_key.middleware
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalApplyProvisioners
2020/01/31 00:41:56 [TRACE] EvalApplyProvisioners: rundeck_private_key.middleware has no state, so skipping provisioners
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalMaybeTainted
2020/01/31 00:41:56 [TRACE] EvalMaybeTainted: rundeck_private_key.middleware encountered an error during creation, so it is now marked as tainted
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalWriteState
2020/01/31 00:41:56 [TRACE] EvalWriteState: removing state object for rundeck_private_key.middleware
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalIf
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalIf
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalWriteDiff
2020/01/31 00:41:56 [TRACE] <root>: eval: *terraform.EvalApplyPost
2020/01/31 00:41:56 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: rpc error: code = Unavailable desc = transport is closing
2020/01/31 00:41:56 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/01/31 00:41:56 [TRACE] [walkApply] Exiting eval tree: rundeck_private_key.middleware
2020/01/31 00:41:56 [TRACE] vertex "rundeck_private_key.middleware": visit complete
2020/01/31 00:41:56 [TRACE] dag/walk: upstream of "meta.count-boundary (EachMode fixup)" errored, so skipping
2020/01/31 00:41:56 [TRACE] dag/walk: upstream of "provider.rundeck (close)" errored, so skipping
2020/01/31 00:41:56 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/01/31 00:41:56 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2020-01-31T00:41:56.542Z [DEBUG] plugin: plugin process exited: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-rundeck_v0.4.0_x4 pid=125 error="exit status 2"
2020/01/31 00:41:56 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2020/01/31 00:41:56 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2020/01/31 00:41:56 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2020/01/31 00:41:56 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2020-01-31T00:41:56.547Z [DEBUG] plugin: plugin exited

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

SECURITY WARNING: the "crash.log" file that was created may contain
sensitive information that must be redacted before it is safe to share
on the issue tracker.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Panic Output

2020/01/31 00:41:52 [INFO] Terraform version: 0.12.18
2020/01/31 00:41:52 [INFO] Go runtime version: go1.12.13
2020/01/31 00:41:52 [INFO] CLI args: []string{"/bin/terraform", "apply", "-no-color", "-parallelism=2"}
2020/01/31 00:41:52 [DEBUG] Attempting to open CLI config file: /root/.terraformrc
2020/01/31 00:41:52 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/01/31 00:41:52 [INFO] TF_CLI_ARGS_apply value: "-auto-approve"
2020/01/31 00:41:52 [INFO] CLI command args: []string{"apply", "-auto-approve", "-no-color", "-parallelism=2"}
2020/01/31 00:41:52 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/01/31 00:41:52 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/01/31 00:41:52 [DEBUG] New state was assigned lineage "eb932895-f577-1aa8-a76b-3a2be81cd954"
2020/01/31 00:41:52 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2020/01/31 00:41:52 [TRACE] Meta.Backend: instantiated backend of type <nil>
2020/01/31 00:41:52 [DEBUG] checking for provider in "."
2020/01/31 00:41:52 [DEBUG] checking for provider in "/bin"
2020/01/31 00:41:52 [DEBUG] checking for provider in ".terraform/plugins/linux_amd64"
2020/01/31 00:41:52 [DEBUG] found provider "terraform-provider-rundeck_v0.4.0_x4"
2020/01/31 00:41:52 [DEBUG] found provider "terraform-provider-tls_v2.1.1_x4"
2020/01/31 00:41:52 [DEBUG] found valid plugin: "rundeck", "0.4.0", "/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-rundeck_v0.4.0_x4"
2020/01/31 00:41:52 [DEBUG] found valid plugin: "tls", "2.1.1", "/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-tls_v2.1.1_x4"
2020/01/31 00:41:52 [DEBUG] checking for provisioner in "."
2020/01/31 00:41:52 [DEBUG] checking for provisioner in "/bin"
2020/01/31 00:41:52 [DEBUG] checking for provisioner in ".terraform/plugins/linux_amd64"
2020/01/31 00:41:52 [TRACE] Meta.Backend: backend <nil> does not support operations, so wrapping it in a local backend
2020/01/31 00:41:52 [INFO] backend/local: starting Apply operation
2020/01/31 00:41:52 [TRACE] backend/local: requesting state manager for workspace "default"
2020/01/31 00:41:52 [TRACE] backend/local: state manager for workspace "default" will:
 - read initial snapshot from terraform.tfstate
 - write new snapshots to terraform.tfstate
 - create any backup at terraform.tfstate.backup
2020/01/31 00:41:52 [TRACE] backend/local: requesting state lock for workspace "default"
2020/01/31 00:41:52 [TRACE] statemgr.Filesystem: preparing to manage state snapshots at terraform.tfstate
2020/01/31 00:41:52 [TRACE] statemgr.Filesystem: existing snapshot has lineage "d6085816-dd93-5eac-83eb-bd83f8ce7d52" serial 4
2020/01/31 00:41:52 [TRACE] statemgr.Filesystem: locking terraform.tfstate using fcntl flock
2020/01/31 00:41:52 [TRACE] statemgr.Filesystem: writing lock metadata to .terraform.tfstate.lock.info
2020/01/31 00:41:52 [TRACE] backend/local: reading remote state for workspace "default"
2020/01/31 00:41:52 [TRACE] statemgr.Filesystem: reading latest snapshot from terraform.tfstate
2020/01/31 00:41:52 [TRACE] statemgr.Filesystem: read snapshot with lineage "d6085816-dd93-5eac-83eb-bd83f8ce7d52" serial 4
2020/01/31 00:41:52 [TRACE] backend/local: retrieving local state snapshot for workspace "default"
2020/01/31 00:41:52 [TRACE] backend/local: building context for current working directory
2020/01/31 00:41:52 [TRACE] terraform.NewContext: starting
2020/01/31 00:41:52 [TRACE] terraform.NewContext: resolving provider version selections
2020/01/31 00:41:53 [TRACE] terraform.NewContext: loading provider schemas
2020/01/31 00:41:53 [TRACE] LoadSchemas: retrieving schema for provider type "rundeck"
2020-01-31T00:41:53.259Z [INFO]  plugin: configuring client automatic mTLS
2020-01-31T00:41:53.294Z [DEBUG] plugin: starting plugin: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-rundeck_v0.4.0_x4 args=[/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-rundeck_v0.4.0_x4]
2020-01-31T00:41:53.307Z [DEBUG] plugin: plugin started: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-rundeck_v0.4.0_x4 pid=25
2020-01-31T00:41:53.307Z [DEBUG] plugin: waiting for RPC address: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-rundeck_v0.4.0_x4
2020-01-31T00:41:53.483Z [INFO]  plugin.terraform-provider-rundeck_v0.4.0_x4: configuring server automatic mTLS: timestamp=2020-01-31T00:41:53.483Z
2020-01-31T00:41:53.523Z [DEBUG] plugin: using plugin: version=5
2020-01-31T00:41:53.523Z [DEBUG] plugin.terraform-provider-rundeck_v0.4.0_x4: plugin address: address=/tmp/plugin189698022 network=unix timestamp=2020-01-31T00:41:53.523Z
2020/01/31 00:41:53 [TRACE] GRPCProvider: GetSchema
2020/01/31 00:41:53 [TRACE] GRPCProvider: Close
2020-01-31T00:41:53.613Z [DEBUG] plugin: plugin process exited: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-rundeck_v0.4.0_x4 pid=25
2020-01-31T00:41:53.613Z [DEBUG] plugin: plugin exited
2020/01/31 00:41:53 [TRACE] LoadSchemas: retrieving schema for provider type "tls"
2020-01-31T00:41:53.614Z [INFO]  plugin: configuring client automatic mTLS
2020-01-31T00:41:53.649Z [DEBUG] plugin: starting plugin: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-tls_v2.1.1_x4 args=[/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-tls_v2.1.1_x4]
2020-01-31T00:41:53.661Z [DEBUG] plugin: plugin started: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-tls_v2.1.1_x4 pid=39
2020-01-31T00:41:53.661Z [DEBUG] plugin: waiting for RPC address: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-tls_v2.1.1_x4
2020-01-31T00:41:53.771Z [INFO]  plugin.terraform-provider-tls_v2.1.1_x4: configuring server automatic mTLS: timestamp=2020-01-31T00:41:53.770Z
2020-01-31T00:41:53.843Z [DEBUG] plugin.terraform-provider-tls_v2.1.1_x4: plugin address: address=/tmp/plugin292323435 network=unix timestamp=2020-01-31T00:41:53.843Z
2020-01-31T00:41:53.844Z [DEBUG] plugin: using plugin: version=5
2020/01/31 00:41:53 [TRACE] GRPCProvider: GetSchema
2020/01/31 00:41:53 [TRACE] GRPCProvider: Close
2020-01-31T00:41:53.955Z [DEBUG] plugin: plugin process exited: path=/Users/dgilmor/Code/infrastructure/src/rundeck/nonprod/.terraform/plugins/linux_amd64/terraform-provider-tls_v2.1.1_x4 pid=39
2020-01-31T00:41:53.955Z [DEBUG] plugin: plugin exited
2020/01/31 00:41:53 [TRACE] terraform.NewContext: complete
2020/01/31 00:41:53 [TRACE] backend/local: finished building terraform.Context
2020/01/31 00:41:53 [TRACE] backend/local: requesting interactive input, if necessary
2020/01/31 00:41:53 [TRACE] Context.Input: Prompting for provider arguments
2020/01/31 00:41:53 [TRACE] Context.Input: Provider provider.rundeck declared at main.tf:1,1-19
2020/01/31 00:41:53 [TRACE] Context.Input: Provider provider.tls implied by resource block at main.tf:11,1-40
2020/01/31 00:41:53 [TRACE] Context.Input: Input for provider.rundeck: map[string]cty.Value{}
2020/01/31 00:41:53 [TRACE] Context.Input: Input for provider.tls: map[string]cty.Value{}
2020/01/31 00:41:53 [TRACE] backend/local: running validation operation
2020/01/31 00:41:53 [INFO] terraform: building graph: GraphTypeValidate
2020/01/31 00:41:53 [TRACE] Executing graph transform *terraform.ConfigTransformer
2020/01/31 00:41:53 [TRACE] ConfigTransformer: Starting for path:
2020/01/31 00:41:53 [TRACE] Completed graph transform *terraform.ConfigTransformer with new graph:
  rundeck_private_key.middleware - *terraform.NodeValidatableResource
  tls_private_key.middleware - *terraform.NodeValidatableResource
  ------
2020/01/31 00:41:53 [TRACE] Executing graph transform *terraform.LocalTransformer
2020/01/31 00:41:53 [TRACE] Completed graph transform *terraform.LocalTransformer with new graph:
  local.private_key_path - *terraform.NodeLocal
  rundeck_private_key.middleware - *terraform.NodeValidatableResource
  tls_private_key.middleware - *terraform.NodeValidatableResource
  ------

Expected Behavior

If I am doing something wrong then the provider or API should be able to return that back to me.

Actual Behavior

Seg fault on all resources.

Steps to Reproduce

  1. terraform init
  2. terraform apply
brucellino commented 3 years ago

For what it's worth, this hit me today. I got around it by setting RUNDECK_URL and RUNDECK_AUTH_TOKEN in the shell instead of as parameters of the provider.

smaddock commented 2 years ago

I'm running into this too, plugin v0.4.3. @brucellino's workaround ~did not fix it for me.~ EDIT: yes, it did fix it. I just can't type. lol

fdevans commented 1 year ago

Thanks for providing help to the community @brucellino !