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

Returning a warning in ValidateFunc will cause a panic in apply step #2870

Closed
catsby opened this issue Jul 28, 2015 · 2 comments · Fixed by #2878
Closed

Returning a warning in ValidateFunc will cause a panic in apply step #2870

catsby opened this issue Jul 28, 2015 · 2 comments · Fixed by #2878

Comments

@catsby
Copy link
Contributor

catsby commented Jul 28, 2015

When adding a ValidateFunc for any schema, returning a non-nil warnings slice will cause the a provider to not call it's configure block.

Branch b-validate-func-config demonstrates this:

plan will show the error:

Warnings:

  * provider.aws: this is a warning

No errors found. Continuing with 1 warning(s).

Refreshing Terraform state prior to plan...

apply causes a panic:

2015/07/28 11:10:05 [DEBUG] apply: aws_instance.nat: executing Apply
2015/07/28 11:10:05 terraform-provider-aws: aws_instance.nat: Creating...
  ami:                      "" => "ami-21f78e11"
  availability_zone:        "" => "<computed>"
  ebs_block_device.#:       "" => "<computed>"
  ephemeral_block_device.#: "" => "<computed>"
  instance_type:            "" => "t1.micro"
  key_name:                 "" => "<computed>"
  placement_group:          "" => "<computed>"
  private_dns:              "" => "<computed>"
  private_ip:               "" => "<computed>"
  public_dns:               "" => "<computed>"
  public_ip:                "" => "<computed>"
  root_block_device.#:      "" => "<computed>"
  security_groups.#:        "" => "<computed>"
  source_dest_check:        "" => "1"
  subnet_id:                "" => "<computed>"
  tags.#:                   "" => "1"
  tags.Name:                "" => "testing-vpc-subnet-things"
  tenancy:                  "" => "<computed>"
  vpc_security_group_ids.#: "" => "<computed>"
Error applying plan:

2 error(s) occurred:

* aws_vpc.foo: unexpected EOF
* aws_instance.nat: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
panic: interface conversion: interface is nil, not *aws.AWSClient
2015/07/28 11:10:05 terraform-provider-aws:
2015/07/28 11:10:05 terraform-provider-aws: goroutine 26 [running]:
2015/07/28 11:10:05 terraform-provider-aws: github.com/hashicorp/terraform/builtin/providers/aws.resourceAwsVpcCreate(0xc2080520c0, 0x0, 0x0, 0x0, 0x0)
2015/07/28 11:10:05 terraform-provider-aws:     /Users/clint/Projects/Go/src/github.com/hashicorp/terraform/builtin/providers/aws/resource_aws_vpc.go:84 +0x67
2015/07/28 11:10:05 terraform-provider-aws: github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc208142c80, 0xc2081829c0, 0xc20817d5c0, 0x0, 0x0, 0x1, 0x0, 0x0)
2015/07/28 11:10:05 terraform-provider-aws:     /Users/clint/Projects/Go/src/github.com/hashicorp/terraform/helper/schema/resource.go:145 +0x2c1
2015/07/28 11:10:05 terraform-provider-aws: github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc2080b5620, 0xc208185480, 0xc2081829c0, 0xc20817d5c0, 0x6b2920, 0x0, 0x0)
2015/07/28 11:10:05 terraform-provider-aws:     /Users/clint/Projects/Go/src/github.com/hashicorp/terraform/helper/schema/provider.go:162 +0x1da
2015/07/28 11:10:05 terraform-provider-aws: github.com/hashicorp/terraform/rpc.(*ResourceProviderServer).Apply(0xc2080ed700, 0xc20817b940, 0xc20817d6a0, 0x0, 0x0)
2015/07/28 11:10:05 terraform-provider-aws:     /Users/clint/Projects/Go/src/github.com/hashicorp/terraform/rpc/resource_provider.go:323 +0x7f
2015/07/28 11:10:05 terraform-provider-aws: reflect.Value.call(0x866040, 0xa47f20, 0x13, 0xab48a0, 0x4, 0xc20809bf28, 0x3, 0x3, 0x0, 0x0, ...)
2015/07/28 11:10:05 terraform-provider-aws:     /usr/local/go-versions/go1.4.2/src/reflect/value.go:419 +0x10e5
2015/07/28 11:10:05 terraform-provider-aws: reflect.Value.Call(0x866040, 0xa47f20, 0x13, 0xc20809bf28, 0x3, 0x3, 0x0, 0x0, 0x0)
2015/07/28 11:10:05 terraform-provider-aws:     /usr/local/go-versions/go1.4.2/src/reflect/value.go:296 +0xbc
2015/07/28 11:10:05 terraform-provider-aws: net/rpc.(*service).call(0xc208142e80, 0xc208142e40, 0xc20800b8a8, 0xc2080a2880, 0xc208162000, 0x6b28c0, 0xc20817b940, 0x16, 0x6b2920, 0xc20817d6a0, ...)
2015/07/28 11:10:05 terraform-provider-aws:     /usr/local/go-versions/go1.4.2/src/net/rpc/server.go:382 +0x1f7
2015/07/28 11:10:05 terraform-provider-aws: created by net/rpc.(*Server).ServeCodec
2015/07/28 11:10:05 terraform-provider-aws:     /usr/local/go-versions/go1.4.2/src/net/rpc/server.go:476 +0x44a
2015/07/28 11:10:05 terraform-provider-aws:

cc @phinze / @mitchellh

@catsby
Copy link
Contributor Author

catsby commented Jul 28, 2015

Note that this is a ValidateFunc attached to the schema of a Provider, and not the schema of a Resource.

phinze added a commit that referenced this issue Jul 28, 2015
When a provider validation only returns a warning, we were cutting the
evaltree short by returning an error. This is fine during a
`walkValidate` but was causing trouble during `walkPlan` and
`walkApply`.

fixes #2870
phinze added a commit that referenced this issue Jul 28, 2015
When a provider validation only returns a warning, we were cutting the
evaltree short by returning an error. This is fine during a
`walkValidate` but was causing trouble during `walkPlan` and
`walkApply`.

fixes #2870
@ghost
Copy link

ghost commented May 1, 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 May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant