AndrewChubatiuk / terraform-provider-ssh

This provider enables SSH port forwarding in Terraform.
Mozilla Public License 2.0
8 stars 9 forks source link

Module doesn't work with `planfile`-workflow #14

Open david-jointech opened 9 months ago

david-jointech commented 9 months ago

Terraform Version

1.6.6

Affected Resource(s)

Expected Behavior

When using this provider, I'd expect the ssh-tunnel to be opened during the plan and the apply-step, when using those separately.

Actual Behavior

The tunnel opens on terraform plan -out planfile but doesn't open again during terraform apply planfile

Steps to Reproduce

  1. Configure the plugin to your needs
  2. Run terraform plan -out planfile
  3. Run terraform apply planfile

Important Factoids

This issue is actually with the general design of terraform and probably can't be solved in a provider. The problem is, that terraform only refreshes data-resources in the plan-step and then uses the values from there during apply. This is in line of how I'd expect data-resources to work in general. The whole reason for the separate plan/apply-steps is that apply should produce the result laid out in the planfile.

It would be nice to add a warning in the README and documentation of this provider though, since it's a bit of an annoying error to analyze and this way it'd be clear to users right away.