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

Add provider mapping to json output of module - fixes issue #30113 #30284

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/command/jsonconfig/config.go
Expand Up @@ -50,6 +50,7 @@ type moduleCall struct {
Module module `json:"module,omitempty"`
VersionConstraint string `json:"version_constraint,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
Providers map[string]string `json:"providers,omitempty"`
}

// variables is the JSON representation of the variables provided to the current
Expand Down Expand Up @@ -336,6 +337,13 @@ func marshalModuleCall(c *configs.Config, mc *configs.ModuleCall, schemas *terra
ret.DependsOn = dependencies
}

if len(mc.Providers) > 0 {
ret.Providers = make(map[string]string, len(mc.Providers))
for _, ppc := range mc.Providers {
ret.Providers[ppc.InChild.String()] = ppc.InParent.String()
}
}

return ret
}

Expand Down