From 3c94027ca01da4880511ae798b71dbfd916c9152 Mon Sep 17 00:00:00 2001 From: Alisdair McDiarmid Date: Fri, 10 Dec 2021 12:48:32 -0500 Subject: [PATCH] jsonconfig: Add provider configs to module calls Work in progress, needs test coverage --- internal/command/jsonconfig/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/command/jsonconfig/config.go b/internal/command/jsonconfig/config.go index 617181ba608b..2290a292185a 100644 --- a/internal/command/jsonconfig/config.go +++ b/internal/command/jsonconfig/config.go @@ -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 @@ -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 }