Skip to content

Commit

Permalink
jsonconfig: Add provider configs to module calls
Browse files Browse the repository at this point in the history
Work in progress, needs test coverage
  • Loading branch information
alisdair committed Dec 10, 2021
1 parent 6530055 commit 3c94027
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 3c94027

Please sign in to comment.