-
Notifications
You must be signed in to change notification settings - Fork 10
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
Changing the sdm_resource
type doesn't cause a replacement
#49
Comments
Thanks for the report; we'll add |
Unfortunately, attemping a pattern where top level fields are In other words, Terraform believes that with this configuration, all operations are creates and none are updates, which isn't preferred. If every change caused a re-create, then historical logs, healthchecks, etc will lose consistency in the resource they are referring to. We (or you) could open a bug with In the meantime I'll raise a (much less simple) note to StrongDM's product team to consider supporting backend type changes of resources with or without terraform. |
Thanks for the detailed response. I don't have capacity to report the issue upstream as I'm not particularly confident I understand what you're saying about the underlying problem :)
TBH, this is the only TF provider I use that holds TF resources this way. It feels like an antipattern to have a top-level It would feel more idiomatic (to me, anyway) if there was |
@200sc I agree with @cailyoung here - I think the issue is that this is just not a typical structure for a Terraform resource; The most "correct" solution here would seem to be as cailyoung suggested, to replace these "polymorphic" types that are unsupported by Terraform and with more "normal" Terraform resources like "sdm_postgres" or "sdm_ssh_cert" or what have you. This would have the added (and not insignificant) benefit of making the provider more intuitive to use for Terraform users who are accustomed to the way most Terraform providers behave. |
We've opened an internal ticket for discussion on this proposed de-polymorphization; the only downside obvious to me is it would make it much more complicated to query for sets of resources covering multiple types in the datasource equivalent of these types, but that may not be a common use case. |
To repro:
apply
the below:Then, realise your error, and update your terraform config to:
Expected: The provider handles the change by removing the incorrect datasource and adding the right one.
Actual:
Plan shows an update-in-place for the resource, but then apply says:
The text was updated successfully, but these errors were encountered: