cloudposse / terraform-provider-utils

The Cloud Posse Terraform Provider for various utilities (e.g. deep merging, stack configuration management)
https://cloudposse.com/accelerate
Apache License 2.0
96 stars 15 forks source link

Consider making utils_deep_merge_* local-only data sources #58

Open timcosta opened 2 years ago

timcosta commented 2 years ago

Describe the Feature

Currently utils_deep_merge_yaml and utils_deep_merge_json are implemented as normal data sources, not local-only data sources. This causes changes to the yaml files on disk to not take effect when running something like a terraform import which loads the cached result from state.

Expected Behavior

These data sources that merge strings should be local-only data sources so that the result is re-computed every time rather than cached.

Use Case

We use yaml files to store some configuration. We flipped a boolean there that allows us to import a Route53 hosted zone, but are getting errors during the import but not during the plan because the import is using the cached merge rather than re-evaluating the new boolean. This also is present during the usage of terraform console.

Describe Ideal Solution

Ideal solution would be to make these local-only data sources so that the result is re-computed every time.

Alternatives Considered

I ran tf apply -target=data.utils_deep_merge_yaml.environment_config which reported no changes but updated the value in state, which allowed the next import to succeed.

gthieleb commented 2 years ago

did you try to update the state with apply -refresh?