As explained in pulumi/pulumi-fabric#293, we were a little ad-hoc in how configuration was "applied" to resource providers. In fact, config wasn't ever communicated directly to providers; instead, the resource providers would simply ask the engine to read random heap locations (via tokens). Now that we're on a plan where configuration gets handed to the program at startup, and that's that, and where generally speaking resource providers never communicate directly with the language runtime, we need to take a different approach. As such, the resource provider interface now offers a Configure RPC method that the resource planning engine will invoke at the right times with the right subset of configuration variables filtered to just that provider's package. This fixes pulumi/pulumi#293.
33 lines
745 B
Go
33 lines
745 B
Go
// Copyright 2017, Pulumi Corporation. All rights reserved.
|
|
|
|
package engine
|
|
|
|
import (
|
|
"fmt"
|
|
"sort"
|
|
|
|
"github.com/pulumi/pulumi-fabric/pkg/tokens"
|
|
)
|
|
|
|
func (eng *Engine) ListConfig(envName string) error {
|
|
info, err := eng.initEnvCmdName(tokens.QName(envName), "")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
config := info.Target.Config
|
|
if config != nil {
|
|
fmt.Fprintf(eng.Stdout, "%-32s %-32s\n", "KEY", "VALUE")
|
|
var keys []string
|
|
for key := range info.Target.Config {
|
|
keys = append(keys, string(key))
|
|
}
|
|
sort.Strings(keys)
|
|
for _, key := range keys {
|
|
v := info.Target.Config[tokens.ModuleMember(key)]
|
|
// TODO[pulumi/pulumi-fabric#113]: print complex values.
|
|
fmt.Fprintf(eng.Stdout, "%-32s %-32s\n", key, v)
|
|
}
|
|
}
|
|
return nil
|
|
}
|