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

Terraform Crash [unexpected EOF] with chef provisoner, policyfile, & Terraform 0.9.8 - 0.10.8 #16655

Closed
chrisanthropic opened this issue Nov 15, 2017 · 3 comments · Fixed by #17147

Comments

@chrisanthropic
Copy link

Terraform Version

Terraform 0.9.8 - 0.10.8

Terraform Configuration Files

Relevant block from my module:

  provisioner "chef" {
    node_name = "${var.instance_name_prefix}${count.index}"
    server_url = "${var.instance_provisioner_chef_server_url}"
    policy_group = "${var.instance_provisioner_chef_policy_group}"
    policy_name = "${var.instance_provisioner_chef_policy_name}"
    attributes_json = "${var.instance_provisioner_chef_attributes_json}"
    secret_key = "${var.instance_provisioner_chef_secret_key}"
    user_name = "${var.instance_provisioner_chef_user_name}"
    user_key = "${var.instance_provisioner_chef_user_key}"
    version  = "${var.instance_provisioner_chef_version}"
    named_run_list = "${var.instance_provisioner_chef_named_run_list}"
  }

Resource block calling the module:

module "buggy-thing" {
  source = "../modules/module-pgc2"
  instance_provisioner_chef_server_url        = "https://api.opscode.com/organizations/myorg"
  instance_provisioner_chef_use_policyfile    = true
  instance_provisioner_chef_policy_group      = "staging"
  instance_provisioner_chef_policy_name       = "buggy-thing"
  instance_provisioner_chef_attributes_json = <<-EOS
    {
      "tags": ["dc-${var.region}"],
      "secrets_locker": {
        "default_data_bag_item": "staging"
      }
    }
  EOS
  instance_provisioner_chef_secret_key = "${var.chef_encrypted_data_bag_secret}"
  instance_provisioner_chef_user_name = "FrankOz"
  instance_provisioner_chef_user_key = "${var.chef_validation_key}"
  instance_provisioner_chef_version = "12.14.89"
  instance_provisioner_chef_named_run_list = ""
}

Debug Output

https://gist.github.com/chrisanthropic/e9f6cfb51c0e5a4c2623a0c991e8ccc8

Crash Output

Please see above.

Expected Behavior

Terraform plan should execute successfully.

Actual Behavior

Terraform crash.

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform get
  3. terraform plan

Important Factoids

This module works with terraform 0.9.6 - 0.9.7.
From 0.9.8 - .0.10.8 we see the same terraform crash.

Removing use_policyfile = "${var.instance_provisioner_chef_use_policyfile}" from the module and instance_provisioner_chef_use_policyfile from the resource block (and replacing it with a run_list) results in a successful terraform apply.

@chrisanthropic chrisanthropic changed the title Terraform Crash [unexpected EOF] with policyfile & Terraform 0.9.8 - 0.10.8 Terraform Crash [unexpected EOF] with chef provisoner, policyfile, & Terraform 0.9.8 - 0.10.8 Nov 15, 2017
@jbardin
Copy link
Member

jbardin commented Nov 15, 2017

The relevant stack trace:

panic: interface conversion: interface {} is string, not bool

goroutine 11 [running]:
github.com/hashicorp/terraform/builtin/provisioners/chef.validateFn(0xc4202b5290, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/hashicorp/terraform/builtin/provisioners/chef/resource_provisioner.go:378 +0x5c4
github.com/hashicorp/terraform/helper/schema.(*Provisioner).Validate(0xc420348320, 0xc4202b5290, 0xc42005be48, 0xc420313b28, 0x4107b7, 0xc4202b53e0, 0x30, 0x28)
	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/hashicorp/terraform/helper/schema/provisioner.go:198 +0x23d
github.com/hashicorp/terraform/plugin.(*ResourceProvisionerServer).Validate(0xc420332960, 0xc42000cb88, 0xc4202b5320, 0x0, 0x0)
	/opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/hashicorp/terraform/plugin/resource_provisioner.go:152 +0x59
reflect.Value.call(0xc42005be00, 0xc42000ca00, 0x13, 0x24ff99b, 0x4, 0xc420313f20, 0x3, 0x3, 0x0, 0x0, ...)
	/usr/local/go/src/reflect/value.go:434 +0x906
reflect.Value.Call(0xc42005be00, 0xc42000ca00, 0x13, 0xc420035f20, 0x3, 0x3, 0x0, 0x0, 0x0)
	/usr/local/go/src/reflect/value.go:302 +0xa4
net/rpc.(*service).call(0xc42019ba80, 0xc42006be00, 0xc420277100, 0xc42010ad80, 0xc4202b3be0, 0x1d024e0, 0xc42000cb88, 0x16, 0x1d02520, 0xc4202b5320, ...)
	/usr/local/go/src/net/rpc/server.go:381 +0x142
created by net/rpc.(*Server).ServeCodec
	/usr/local/go/src/net/rpc/server.go:475 +0x36b

@chrisanthropic
Copy link
Author

Same behavior in Terraform 0.11.1.

@ghost
Copy link

ghost commented Apr 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants