Terraform Update statefile for null_resource

I have a null_resource that will format disks attached to an aws_instance. I made a change to the null_resource trigger to be based off the instance ID rather than the IP. Terraform now wants to re-run the null resource. How can I update the state file with that configuration without re-running the resource?

Yes, any change to the triggers map will force replacement/re-run the resource. The relevant block in state looks like:

          "attributes": {
            "id": "6500401501386199918",
            "triggers": {
              "foo": "bar"
            }
          },

So if you want to manually edit state so that Terraform will calculate that no changes are needed, update that "bar" value or whatever you need in the map to be what you need it to be.

1 Like