Giter Club home page Giter Club logo

Comments (5)

cailyoung avatar cailyoung commented on August 10, 2024 4

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 :)

StrongDM's product team to consider supporting backend type changes of resources

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 resource with lower-level blocks the way you've designed sdm_resource.

It would feel more idiomatic (to me, anyway) if there was sdm_azure_mysql_datasource as a full-blown resource itself, rather than a 'generic' sdm_resource. If you could pass that feedback on, I'd appreciate it. I recognise that'd be a massive breaking change in the provider, so have no expectations that it'll actually get shipped any time soon!

from terraform-provider-sdm.

200sc avatar 200sc commented on August 10, 2024

Thanks for the report; we'll add ForceNew: true to the resource type selection, and probably add this for other polymorphic SDK types (nodes) as well. I've opened an internal ticket for tracking this, feel free to raise additional questions or data points.

from terraform-provider-sdm.

200sc avatar 200sc commented on August 10, 2024

Unfortunately, attemping a pattern where top level fields are ForceNew results in the following terraform plugin error:
All fields are ForceNew or Computed w/out Optional, Update is superfluous

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 https://github.com/hashicorp/terraform-plugin-sdk to better support this architecture. It appears via tests that subfields underneath top level ForceNew fields do not, in their changes, cause terraform to believe the top level has changed, so this could be considered a bug.

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.

from terraform-provider-sdm.

aprice-sss avatar aprice-sss commented on August 10, 2024

@200sc I agree with @cailyoung here - I think the issue is that this is just not a typical structure for a Terraform resource; sdm_resource (and sdm_node etc) actually represents several completely exclusive resource types, which isn't how Terraform expects a resource to behave. The "real" resources are the blocks like ssh_cert or postgres; when you define a sdm_resource you define exactly 1 child block and nothing else, so it's just acting like a sort of pseudo container object for the real resource definition inside it. This is a fundamental deviation from how Terraform resources are structured, so I would not expect them to alter the core functionality to accommodate it.

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.

from terraform-provider-sdm.

200sc avatar 200sc commented on August 10, 2024

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.

from terraform-provider-sdm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.