This change switches from child lists to parent pointers, in the way resource ancestries are represented. This cleans up a fair bit of the old parenting logic, including all notion of ambient parent scopes (and will notably address pulumi/pulumi#435). This lets us show a more parent/child display in the output when doing planning and updating. For instance, here is an update of a lambda's text, which is logically part of a cloud timer: * cloud:timer:Timer: (same) [urn=urn:pulumi:malta::lm-cloud:☁️timer:Timer::lm-cts-malta-job-CleanSnapshots] * cloud:function:Function: (same) [urn=urn:pulumi:malta::lm-cloud:☁️function:Function::lm-cts-malta-job-CleanSnapshots] * aws:serverless:Function: (same) [urn=urn:pulumi:malta::lm-cloud::aws:serverless:Function::lm-cts-malta-job-CleanSnapshots] ~ aws:lambda/function:Function: (modify) [id=lm-cts-malta-job-CleanSnapshots-fee4f3bf41280741] [urn=urn:pulumi:malta::lm-cloud::aws:lambda/function:Function::lm-cts-malta-job-CleanSnapshots] - code : archive(assets:2092f44) { // etc etc etc Note that we still get walls of text, but this will be actually quite nice when combined with pulumi/pulumi#454. I've also suppressed printing properties that didn't change during updates when --detailed was not passed, and also suppressed empty strings and zero-length arrays (since TF uses these as defaults in many places and it just makes creation and deletion quite verbose). Note that this is a far cry from everything we can possibly do here as part of pulumi/pulumi#340 (and even pulumi/pulumi#417). But it's a good start towards taming some of our output spew.
28 lines
799 B
Go
28 lines
799 B
Go
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
|
|
|
package resource
|
|
|
|
import (
|
|
"github.com/pulumi/pulumi/pkg/tokens"
|
|
)
|
|
|
|
// Goal is a desired state for a resource object.
|
|
type Goal struct {
|
|
Type tokens.Type // the type of resource.
|
|
Name tokens.QName // the name for the resource's URN.
|
|
Custom bool // true if this resource is custom, managed by a plugin.
|
|
Properties PropertyMap // the resource's property state.
|
|
Parent URN // an optional parent URN for this resource.
|
|
}
|
|
|
|
// NewGoal allocates a new resource goal state.
|
|
func NewGoal(t tokens.Type, name tokens.QName, custom bool, props PropertyMap, parent URN) *Goal {
|
|
return &Goal{
|
|
Type: t,
|
|
Name: name,
|
|
Custom: custom,
|
|
Properties: props,
|
|
Parent: parent,
|
|
}
|
|
}
|