Skip to content

Commit

Permalink
Add provider mapping to json output of module - fixes issue #30113
Browse files Browse the repository at this point in the history
  • Loading branch information
DaKaZ committed Jan 4, 2022
1 parent 74761b2 commit a6ceced
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit a6ceced

Please sign in to comment.