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

Unknown 'ValidateResource' shadow value for "null_resource": &errors.errorString{s:"shadow closed"} #10200

Closed
adamdecaf opened this issue Nov 17, 2016 · 4 comments

Comments

@adamdecaf
Copy link
Contributor

Terraform Version

Terraform v0.7.11

Affected Resource(s)

Please list the resources as a list, for example:

  • null_resource

Debug Output

4 error(s) occurred:

* plan operation: Unknown 'ValidateResource' shadow value for "null_resource": &errors.errorString{s:"shadow closed"}
* plan operation: Diff "module.mesos.mesos_lb_agent_machines.json_attributes.null_resource.render" had unequal states (real, then shadow):

&terraform.ResourceConfig{ComputedKeys:[]string(nil), Raw:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"empty":"", "default_content":"${sha1(var.default_attributes_json)}", "override_content":"${sha1(file(\"${var.base_path}/${var.name}.overrides.json\"))}"}}}, Config:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"empty":"", "default_content":"5f36b2ea290645ee34d943220a14b54ee5ea5be5", "override_content":"0b8a0b65aa85188f8a5208c4bd9dfe8bd6c7a2e5"}}}, raw:(*config.RawConfig)(0xc4221e19e0)}

&terraform.ResourceConfig{ComputedKeys:[]string(nil), Raw:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"default_content":"${sha1(var.default_attributes_json)}", "override_content":"${sha1(file(\"${var.base_path}/${var.name}.overrides.json\"))}", "empty":""}}}, Config:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"default_content":"5f36b2ea290645ee34d943220a14b54ee5ea5be5", "override_content":"1096aeea32ba355aa3495b6bf0186088afeab294", "empty":""}}}, raw:(*config.RawConfig)(0xc420b2f9e0)}
* apply operation: Unknown 'ValidateResource' shadow value for "null_resource": &errors.errorString{s:"shadow closed"}
* apply operation: Diff "module.mesos.mesos_lb_agent_machines.json_attributes.null_resource.render" had unequal states (real, then shadow):

&terraform.ResourceConfig{ComputedKeys:[]string(nil), Raw:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"default_content":"${sha1(var.default_attributes_json)}", "override_content":"${sha1(file(\"${var.base_path}/${var.name}.overrides.json\"))}", "empty":""}}}, Config:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"empty":"", "default_content":"5f36b2ea290645ee34d943220a14b54ee5ea5be5", "override_content":"1096aeea32ba355aa3495b6bf0186088afeab294"}}}, raw:(*config.RawConfig)(0xc422c33500)}

&terraform.ResourceConfig{ComputedKeys:[]string(nil), Raw:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"override_content":"${sha1(file(\"${var.base_path}/${var.name}.overrides.json\"))}", "empty":"", "default_content":"${sha1(var.default_attributes_json)}"}}}, Config:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"default_content":"5f36b2ea290645ee34d943220a14b54ee5ea5be5", "override_content":"3e9c0c6ced32761aeb07e29fdb28ac4fb0267ca6", "empty":""}}}, raw:(*config.RawConfig)(0xc423de5d40)}

This is not an error. Your terraform operation completed successfully
and your real infrastructure is unaffected by this message.

Expected Behaviour

There seems to be an extra "empty":"" added onto the real graph. The shadow graph doesn't have this.

References

The following issues look similar, but none of them deal with a null_resource.

@adamdecaf
Copy link
Contributor Author

adamdecaf commented Nov 17, 2016

Oh, this might be something with our tf resources. We've got the following:

resource "null_resource" "render" {

  triggers {
    default_content = "${sha1(var.default_attributes_json)}"
    override_content = "${sha1(file("${var.base_path}/${var.name}.overrides.json"))}"
    empty = ""
  }

  provisioner "local-exec" {
    command = "" // shell command to change around json. 
  }
}

# These outputs having the triggers are so that terraform will wait to make the
# rendered output after the rendered file has been made from the default and override
# files, as well as to let modules get the changes from the two to be triggered on
output "rendered_json" {
  value = "${null_resource.render.triggers.empty}${file("${var.base_path}/${var.name}.rendered.json")}"
}

@adamdecaf
Copy link
Contributor Author

adamdecaf commented Nov 17, 2016

Update:

I switched that empty trigger to a sha1 of the .rendered.json file. This works fine (we can't remember why we used that empty = "" trigger). Running terraform apply again completes successfully under the real graph, however the shadow graph reports an error that the diffs aren't matching.

I think we're running into what #10118 was fixing.

* apply operation: Unknown 'ValidateResource' shadow value for "null_resource": &errors.errorString{s:"shadow closed"}
* apply operation: Diff "module.graphite.carbon_machines.json_attributes.null_resource.render" had unequal states (real, then shadow):

&terraform.ResourceConfig{ComputedKeys:[]string(nil), Raw:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"default_content":"${sha1(var.default_attributes_json)}", "override_content":"${sha1(file(\"${var.base_path}/${var.name}.overrides.json\"))}", "rendered_content":"${sha1(file(\"${var.base_path}/${var.name}.rendered.json\"))}"}}}, Config:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"override_content":"bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f", "rendered_content":"da39a3ee5e6b4b0d3255bfef95601890afd80709", "default_content":"5f36b2ea290645ee34d943220a14b54ee5ea5be5"}}}, raw:(*config.RawConfig)(0xc420e5a120)}

&terraform.ResourceConfig{ComputedKeys:[]string(nil), Raw:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"override_content":"${sha1(file(\"${var.base_path}/${var.name}.overrides.json\"))}", "rendered_content":"${sha1(file(\"${var.base_path}/${var.name}.rendered.json\"))}", "default_content":"${sha1(var.default_attributes_json)}"}}}, Config:map[string]interface {}{"triggers":[]map[string]interface {}{map[string]interface {}{"default_content":"5f36b2ea290645ee34d943220a14b54ee5ea5be5", "override_content":"bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f", "rendered_content":"5f36b2ea290645ee34d943220a14b54ee5ea5be5"}}}, raw:(*config.RawConfig)(0xc42246df20)}

Running another plan reports the resource that previously completed as tainted now.

-/+ module.graphite.carbon_machines.json_attributes.null_resource.render
    triggers.%:                "3" => "3"
    triggers.default_content:  "5f36b2ea290645ee34d943220a14b54ee5ea5be5" => "5f36b2ea290645ee34d943220a14b54ee5ea5be5"
    triggers.override_content: "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f" => "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"
    triggers.rendered_content: "da39a3ee5e6b4b0d3255bfef95601890afd80709" => "5f36b2ea290645ee34d943220a14b54ee5ea5be5" (forces new resource)

Running apply afterwords runs that resource again successfully. (No shadow graph failure either.) A plan afterwords shows no changes.

@mitchellh
Copy link
Contributor

Oh this makes sense actually. You're modifying a file that it reads mid-apply. I'm not sure how we can actually fix this unfortunately. Please try running without the shadow with -Xshadow=false and that'll for sure get rid of this.

In the mean time we're going to make it easier to doso.

@ghost
Copy link

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

No branches or pull requests

2 participants