Add new resource: azuredevops_area_tree for managing area path hierarchies - #1587
Open
Levente Laszlo Papp (aklakina) wants to merge 1 commit into
Open
Add new resource: azuredevops_area_tree for managing area path hierarchies#1587Levente Laszlo Papp (aklakina) wants to merge 1 commit into
azuredevops_area_tree for managing area path hierarchies#1587Levente Laszlo Papp (aklakina) wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Description
This PR adds a new resource,
azuredevops_area_tree, which manages an entire Area Path (classification node) hierarchy for a project as a single Terraform resource.azuredevops_area(the existing resource) manages exactly one area path node per resource instance, which requires users to declare a separate resource instance per node and to reference sibling instances of the same resource type in order to build a hierarchy (e.g. a child node referencing its parent node'spathoutput). This is needed because Terraform cannot dynamically resolve dependencies between sibling instances of the same resource - the graph is built statically from configuration, so a resource cannot safely depend on another instance of itself when the set/shape of instances is only known at apply time (e.g. derived from a variable orfor_eachover a dynamic structure). In practice this shows up as the well-known Terraform "Cycle" error, or forces awkward workarounds (hard-coded ordering,depends_onhacks, splitting the hierarchy across multipleterraform applyruns) whenever an area path hierarchy needs to be built or reshaped dynamically.azuredevops_area_treeavoids this limitation entirely by taking the complete, desired area path hierarchy as a single, arbitrarily-deep nested object (via thepathsargument, expressed withjsonencode) and owning the full lifecycle of every node in one resource instance:azuredevops_area, which only knows about its own single node).area_idsandarea_pathsmaps (keyed by slash-separated relative path) so other resources, such asazuredevops_team, can reference any node in the tree without needing sibling-resource lookups.Because there is only ever one resource instance per project (no
for_eachover individual nodes), there is no possibility of the "Cycle" error, making this the recommended way to manage non-trivial area path hierarchies going forward.azuredevops_arearemains available/unchanged for simpler, single-node use cases.Does this introduce a breaking change?
This is a purely additive change: a new resource type, its documentation page, and a website navigation entry. No existing resources, data sources, or schemas are modified.
Test Result
Unit tests (
resource_area_tree_test.go) covering the tree-diffing, create/update/delete, and import logic are included and pass. Acceptance tests (resource_area_tree_test.gounderacceptancetests/) are also included, following the existing pattern used by other resources in this provider; they require a live Azure DevOps organization and credentials to execute (TF_ACC=1) and were exercised against a test organization during development.Related Issue(s)
N/A - this is a new feature contribution, not tied to an existing tracked issue.
Other information
None.