Skip to content
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

azurerm_resource_group_template_deployment - output_content can now be referenced in other resources #25403

Merged
merged 5 commits into from
Apr 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Also SetNewComputed when parameters_content changes
  • Loading branch information
mbfrahry committed Mar 26, 2024
commit 36c36db9aae9b4f998a87614a725097283537e04
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func resourceGroupTemplateDeploymentResource() *pluginsdk.Resource {
},

// this is needed to fix https://github.com/hashicorp/terraform-provider-azurerm/issues/12828
// On a change to `template_content`, we'll set `output_content` to empty
// On a change to `template_content` or `parameters_content`, we'll set `output_content` to empty
// The adverse effect of this is that any change to `template_content` will also cause any resource referencing `output_content` to update
CustomizeDiff: func(ctx context.Context, d *pluginsdk.ResourceDiff, i interface{}) error {
if d.HasChange("template_content") {
Expand All @@ -122,6 +122,15 @@ func resourceGroupTemplateDeploymentResource() *pluginsdk.Resource {
}
}

if d.HasChange("parameters_content") {
o, n := d.GetChange("parameters_content")

// the json has to be normalized and then compared against to see if a change has occurred
if !strings.EqualFold(o.(string), utils.NormalizeJson(n)) {
return d.SetNewComputed("output_content")
}
}

return nil
},
}
Expand Down
Loading