Skip to content

Commit

Permalink
backport of commit 64cf53b
Browse files Browse the repository at this point in the history
  • Loading branch information
alisdair committed Jun 21, 2022
1 parent fd45fb9 commit 9c189d0
Show file tree
Hide file tree
Showing 71 changed files with 1,919 additions and 3,399 deletions.
113 changes: 89 additions & 24 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions commands.go
Expand Up @@ -100,8 +100,6 @@ func initCommands(
ProviderSource: providerSrc,
ProviderDevOverrides: providerDevOverrides,
UnmanagedProviders: unmanagedProviders,

AllowExperimentalFeatures: ExperimentsAllowed(),
}

// The command list is included in the terraform -help
Expand Down
Binary file modified docs/images/resource-instance-change-lifecycle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
294 changes: 0 additions & 294 deletions docs/planning-behaviors.md

This file was deleted.

406 changes: 93 additions & 313 deletions docs/resource-instance-change-lifecycle.md

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions experiments.go

This file was deleted.

10 changes: 5 additions & 5 deletions go.mod
Expand Up @@ -4,7 +4,7 @@ require (
cloud.google.com/go/storage v1.10.0
github.com/Azure/azure-sdk-for-go v59.2.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.24
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2
github.com/Netflix/go-expect v0.0.0-20211003183012-e1a7c020ce25
github.com/agext/levenshtein v1.2.3
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1501
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190103054945-8205d1f41e70
Expand Down Expand Up @@ -83,13 +83,13 @@ require (
github.com/zclconf/go-cty-yaml v1.0.2
go.etcd.io/etcd v0.5.0-alpha.5.0.20210428180535-15715dcf1ace
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f
golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b
golang.org/x/text v0.3.7
golang.org/x/tools v0.1.11
golang.org/x/tools v0.1.11-0.20220316014157-77aa08bb151a
google.golang.org/api v0.44.0-impersonate-preview
google.golang.org/grpc v1.36.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0
Expand Down Expand Up @@ -128,7 +128,6 @@ require (
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/coreos/go-semver v0.2.0 // indirect
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d // indirect
github.com/creack/pty v1.1.18 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dylanmei/iso8601 v0.1.0 // indirect
github.com/fatih/color v1.9.0 // indirect
Expand Down Expand Up @@ -156,6 +155,7 @@ require (
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/klauspost/compress v1.11.2 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/pty v1.1.5 // indirect
github.com/manicminer/hamilton-autorest v0.2.0 // indirect
github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
Expand Down Expand Up @@ -206,4 +206,4 @@ replace github.com/golang/mock v1.5.0 => github.com/golang/mock v1.4.4
// replacement that includes a fix for CVE-2020-26160.
replace github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt v3.2.1+incompatible

go 1.18
go 1.17
80 changes: 71 additions & 9 deletions go.sum

Large diffs are not rendered by default.

128 changes: 0 additions & 128 deletions internal/addrs/map.go

This file was deleted.

83 changes: 0 additions & 83 deletions internal/addrs/map_test.go

This file was deleted.

32 changes: 8 additions & 24 deletions internal/addrs/set.go
@@ -1,37 +1,23 @@
package addrs

// Set represents a set of addresses of types that implement UniqueKeyer.
//
// Modify the set only by the methods on this type. This type exposes its
// internals for convenience during reading, such as iterating over set elements
// by ranging over the map values, but making direct modifications could
// potentially make the set data invalid or inconsistent, leading to undefined
// behavior elsewhere.
type Set[T UniqueKeyer] map[UniqueKey]T
type Set map[UniqueKey]UniqueKeyer

// Has returns true if and only if the set includes the given address.
func (s Set[T]) Has(addr T) bool {
func (s Set) Has(addr UniqueKeyer) bool {
_, exists := s[addr.UniqueKey()]
return exists
}

// Add inserts the given address into the set, if not already present. If
// an equivalent address is already in the set, this replaces that address
// with the new value.
func (s Set[T]) Add(addr T) {
func (s Set) Add(addr UniqueKeyer) {
s[addr.UniqueKey()] = addr
}

// Remove deletes the given address from the set, if present. If not present,
// this is a no-op.
func (s Set[T]) Remove(addr T) {
func (s Set) Remove(addr UniqueKeyer) {
delete(s, addr.UniqueKey())
}

// Union returns a new set which contains the union of all of the elements
// of both the reciever and the given other set.
func (s Set[T]) Union(other Set[T]) Set[T] {
ret := make(Set[T])
func (s Set) Union(other Set) Set {
ret := make(Set)
for k, addr := range s {
ret[k] = addr
}
Expand All @@ -41,10 +27,8 @@ func (s Set[T]) Union(other Set[T]) Set[T] {
return ret
}

// Intersection returns a new set which contains the intersection of all of the
// elements of both the reciever and the given other set.
func (s Set[T]) Intersection(other Set[T]) Set[T] {
ret := make(Set[T])
func (s Set) Intersection(other Set) Set {
ret := make(Set)
for k, addr := range s {
if _, exists := other[k]; exists {
ret[k] = addr
Expand Down
4 changes: 0 additions & 4 deletions internal/addrs/unique_key.go
Expand Up @@ -21,7 +21,3 @@ type UniqueKey interface {
type UniqueKeyer interface {
UniqueKey() UniqueKey
}

func Equivalent[T UniqueKeyer](a, b T) bool {
return a.UniqueKey() == b.UniqueKey()
}
20 changes: 4 additions & 16 deletions internal/command/jsonplan/plan.go
Expand Up @@ -442,8 +442,7 @@ func (p *plan) marshalOutputChanges(changes *plans.Changes) error {
changeV.After, _ = changeV.After.UnmarkDeep()

var before, after []byte
var afterUnknown cty.Value

afterUnknown := cty.False
if changeV.Before != cty.NilVal {
before, err = ctyjson.Marshal(changeV.Before, changeV.Before.Type())
if err != nil {
Expand All @@ -456,18 +455,8 @@ func (p *plan) marshalOutputChanges(changes *plans.Changes) error {
if err != nil {
return err
}
afterUnknown = cty.False
} else {
filteredAfter := omitUnknowns(changeV.After)
if filteredAfter.IsNull() {
after = nil
} else {
after, err = ctyjson.Marshal(filteredAfter, filteredAfter.Type())
if err != nil {
return err
}
}
afterUnknown = unknownAsBool(changeV.After)
afterUnknown = cty.True
}
}

Expand Down Expand Up @@ -577,9 +566,8 @@ func omitUnknowns(val cty.Value) cty.Value {
newVal := omitUnknowns(v)
if newVal != cty.NilVal {
vals = append(vals, newVal)
} else if newVal == cty.NilVal {
// element order is how we correlate unknownness, so we must
// replace unknowns with nulls
} else if newVal == cty.NilVal && ty.IsListType() {
// list length may be significant, so we will turn unknowns into nulls
vals = append(vals, cty.NullVal(v.Type()))
}
}
Expand Down

0 comments on commit 9c189d0

Please sign in to comment.