pulumi/pkg/engine/config_delete.go
joeduffy 9f160a7f91 Configure providers at well-defined points
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.
2017-09-04 11:35:21 -07:00

27 lines
581 B
Go

// Copyright 2017, Pulumi Corporation. All rights reserved.
package engine
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi-fabric/pkg/tokens"
)
func (eng *Engine) DeleteConfig(envName string, key tokens.ModuleMember) error {
info, err := eng.initEnvCmdName(tokens.QName(envName), "")
if err != nil {
return err
}
config := info.Target.Config
if config != nil {
delete(config, key)
if err = eng.Environment.SaveEnvironment(info.Target, info.Snapshot); err != nil {
return errors.Wrap(err, "could not save configuration value")
}
}
return nil
}