diff --git a/Makefile b/Makefile index 6e90ee0eba7..e0047e20ad7 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,6 @@ generate: protobuf: bash scripts/protobuf-check.sh bash internal/tfplugin5/generate.sh - bash internal/plans/internal/planproto/generate.sh fmt: gofmt -w $(GOFMT_FILES) diff --git a/go.mod b/go.mod index 2571a39d0c0..2702279c510 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/davecgh/go-spew v1.1.1 github.com/go-test/deep v1.0.3 github.com/golang/mock v1.3.1 - github.com/golang/protobuf v1.3.2 + github.com/golang/protobuf v1.3.4 github.com/golang/snappy v0.0.1 github.com/google/go-cmp v0.3.1 github.com/hashicorp/errwrap v1.0.0 @@ -36,8 +36,9 @@ require ( github.com/vmihailenco/msgpack v4.0.1+incompatible // indirect github.com/zclconf/go-cty v1.2.1 golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 - golang.org/x/net v0.0.0-20191009170851-d66e71096ffb - golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect + golang.org/x/net v0.0.0-20200301022130-244492dfa37a + golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 - google.golang.org/grpc v1.23.0 + google.golang.org/genproto v0.0.0-20200310143817-43be25429f5a // indirect + google.golang.org/grpc v1.27.1 ) diff --git a/go.sum b/go.sum index 8e866c94e57..f66fad807c7 100644 --- a/go.sum +++ b/go.sum @@ -26,11 +26,14 @@ github.com/aws/aws-sdk-go v1.15.78 h1:LaXy6lWR0YK7LKyuU0QWy2ws/LWTPfYV/UgfiBu4tv github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= @@ -45,6 +48,9 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -133,6 +139,7 @@ github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -179,8 +186,8 @@ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb h1:TR699M2v0qoKTOHxeLgp6zPqaQNs74f01a/ob9W0qko= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -200,8 +207,8 @@ golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= @@ -239,12 +246,17 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200310143817-43be25429f5a h1:lRlI5zu6AFy3iU/F8YWyNrAmn/tPCnhiTxfwhWb76eU= +google.golang.org/genproto v0.0.0-20200310143817-43be25429f5a/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= diff --git a/helper/resource/testing_new.go b/helper/resource/testing_new.go index f16ead31452..a94ef6c6234 100644 --- a/helper/resource/testing_new.go +++ b/helper/resource/testing_new.go @@ -148,12 +148,12 @@ func testIDRefresh(c TestCase, t *testing.T, wd *tftest.WorkingDir, step TestSte expected := r.Primary.Attributes // Remove fields we're ignoring for _, v := range c.IDRefreshIgnore { - for k, _ := range actual { + for k := range actual { if strings.HasPrefix(k, v) { delete(actual, k) } } - for k, _ := range expected { + for k := range expected { if strings.HasPrefix(k, v) { delete(expected, k) } diff --git a/helper/resource/testing_test.go b/helper/resource/testing_test.go index 1e3eef2c395..eacc6ae52d2 100644 --- a/helper/resource/testing_test.go +++ b/helper/resource/testing_test.go @@ -50,7 +50,7 @@ func TestTest_factoryError(t *testing.T) { "test": factory, }, Steps: []TestStep{ - TestStep{ + { ExpectError: regexp.MustCompile("resource factory error"), }, }, @@ -198,7 +198,7 @@ func TestTest_Main(t *testing.T) { { Name: "basic passing", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, @@ -233,7 +233,7 @@ func TestFilterSweepers(t *testing.T) { { Name: "normal", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, @@ -243,16 +243,16 @@ func TestFilterSweepers(t *testing.T) { { Name: "with dep", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockSweeperFunc, }, @@ -262,16 +262,16 @@ func TestFilterSweepers(t *testing.T) { { Name: "with filter", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockSweeperFunc, }, @@ -282,16 +282,16 @@ func TestFilterSweepers(t *testing.T) { { Name: "with two filters", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockSweeperFunc, }, @@ -302,16 +302,16 @@ func TestFilterSweepers(t *testing.T) { { Name: "with dep and filter", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockSweeperFunc, }, @@ -322,16 +322,16 @@ func TestFilterSweepers(t *testing.T) { { Name: "with non-matching filter", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockSweeperFunc, }, @@ -341,21 +341,21 @@ func TestFilterSweepers(t *testing.T) { { Name: "with nested depenencies and top level filter", Sweepers: map[string]*Sweeper{ - "not_matching": &Sweeper{ + "not_matching": { Name: "not_matching", F: mockSweeperFunc, }, - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2"}, F: mockSweeperFunc, }, - "matching_level2": &Sweeper{ + "matching_level2": { Name: "matching_level2", Dependencies: []string{"matching_level3"}, F: mockSweeperFunc, }, - "matching_level3": &Sweeper{ + "matching_level3": { Name: "matching_level3", F: mockSweeperFunc, }, @@ -366,21 +366,21 @@ func TestFilterSweepers(t *testing.T) { { Name: "with nested depenencies and middle level filter", Sweepers: map[string]*Sweeper{ - "not_matching": &Sweeper{ + "not_matching": { Name: "not_matching", F: mockSweeperFunc, }, - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2"}, F: mockSweeperFunc, }, - "matching_level2": &Sweeper{ + "matching_level2": { Name: "matching_level2", Dependencies: []string{"matching_level3"}, F: mockSweeperFunc, }, - "matching_level3": &Sweeper{ + "matching_level3": { Name: "matching_level3", F: mockSweeperFunc, }, @@ -391,21 +391,21 @@ func TestFilterSweepers(t *testing.T) { { Name: "with nested depenencies and bottom level filter", Sweepers: map[string]*Sweeper{ - "not_matching": &Sweeper{ + "not_matching": { Name: "not_matching", F: mockSweeperFunc, }, - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2"}, F: mockSweeperFunc, }, - "matching_level2": &Sweeper{ + "matching_level2": { Name: "matching_level2", Dependencies: []string{"matching_level3"}, F: mockSweeperFunc, }, - "matching_level3": &Sweeper{ + "matching_level3": { Name: "matching_level3", F: mockSweeperFunc, }, @@ -423,7 +423,7 @@ func TestFilterSweepers(t *testing.T) { actualSweepers := filterSweepers(tc.Filter, tc.Sweepers) var keys []string - for k, _ := range actualSweepers { + for k := range actualSweepers { keys = append(keys, k) } @@ -446,11 +446,11 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "no dependencies", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", F: mockSweeperFunc, }, - "non_matching": &Sweeper{ + "non_matching": { Name: "non_matching", F: mockSweeperFunc, }, @@ -461,12 +461,12 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "one level one dependency", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2"}, F: mockSweeperFunc, }, - "matching_level2": &Sweeper{ + "matching_level2": { Name: "matching_level2", F: mockSweeperFunc, }, @@ -477,16 +477,16 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "one level multiple dependencies", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2a", "matching_level2b"}, F: mockSweeperFunc, }, - "matching_level2a": &Sweeper{ + "matching_level2a": { Name: "matching_level2a", F: mockSweeperFunc, }, - "matching_level2b": &Sweeper{ + "matching_level2b": { Name: "matching_level2b", F: mockSweeperFunc, }, @@ -497,17 +497,17 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "multiple level one dependency", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2"}, F: mockSweeperFunc, }, - "matching_level2": &Sweeper{ + "matching_level2": { Name: "matching_level2", Dependencies: []string{"matching_level3"}, F: mockSweeperFunc, }, - "matching_level3": &Sweeper{ + "matching_level3": { Name: "matching_level3", F: mockSweeperFunc, }, @@ -518,34 +518,34 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "multiple level multiple dependencies", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2a", "matching_level2b"}, F: mockSweeperFunc, }, - "matching_level2a": &Sweeper{ + "matching_level2a": { Name: "matching_level2a", Dependencies: []string{"matching_level3a", "matching_level3b"}, F: mockSweeperFunc, }, - "matching_level2b": &Sweeper{ + "matching_level2b": { Name: "matching_level2b", Dependencies: []string{"matching_level3c", "matching_level3d"}, F: mockSweeperFunc, }, - "matching_level3a": &Sweeper{ + "matching_level3a": { Name: "matching_level3a", F: mockSweeperFunc, }, - "matching_level3b": &Sweeper{ + "matching_level3b": { Name: "matching_level3b", F: mockSweeperFunc, }, - "matching_level3c": &Sweeper{ + "matching_level3c": { Name: "matching_level3c", F: mockSweeperFunc, }, - "matching_level3d": &Sweeper{ + "matching_level3d": { Name: "matching_level3d", F: mockSweeperFunc, }, @@ -556,17 +556,17 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "no parents one level", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2"}, F: mockSweeperFunc, }, - "matching_level2": &Sweeper{ + "matching_level2": { Name: "matching_level2", Dependencies: []string{"matching_level3"}, F: mockSweeperFunc, }, - "matching_level3": &Sweeper{ + "matching_level3": { Name: "matching_level3", F: mockSweeperFunc, }, @@ -577,17 +577,17 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "no parents multiple level", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2"}, F: mockSweeperFunc, }, - "matching_level2": &Sweeper{ + "matching_level2": { Name: "matching_level2", Dependencies: []string{"matching_level3"}, F: mockSweeperFunc, }, - "matching_level3": &Sweeper{ + "matching_level3": { Name: "matching_level3", F: mockSweeperFunc, }, @@ -598,16 +598,16 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "one level missing dependency", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2a", "matching_level2c"}, F: mockSweeperFunc, }, - "matching_level2a": &Sweeper{ + "matching_level2a": { Name: "matching_level2a", F: mockSweeperFunc, }, - "matching_level2b": &Sweeper{ + "matching_level2b": { Name: "matching_level2b", F: mockSweeperFunc, }, @@ -618,34 +618,34 @@ func TestFilterSweeperWithDependencies(t *testing.T) { { Name: "multiple level missing dependencies", Sweepers: map[string]*Sweeper{ - "matching_level1": &Sweeper{ + "matching_level1": { Name: "matching_level1", Dependencies: []string{"matching_level2a", "matching_level2b", "matching_level2c"}, F: mockSweeperFunc, }, - "matching_level2a": &Sweeper{ + "matching_level2a": { Name: "matching_level2a", Dependencies: []string{"matching_level3a", "matching_level3e"}, F: mockSweeperFunc, }, - "matching_level2b": &Sweeper{ + "matching_level2b": { Name: "matching_level2b", Dependencies: []string{"matching_level3c", "matching_level3f"}, F: mockSweeperFunc, }, - "matching_level3a": &Sweeper{ + "matching_level3a": { Name: "matching_level3a", F: mockSweeperFunc, }, - "matching_level3b": &Sweeper{ + "matching_level3b": { Name: "matching_level3b", F: mockSweeperFunc, }, - "matching_level3c": &Sweeper{ + "matching_level3c": { Name: "matching_level3c", F: mockSweeperFunc, }, - "matching_level3d": &Sweeper{ + "matching_level3d": { Name: "matching_level3d", F: mockSweeperFunc, }, @@ -663,7 +663,7 @@ func TestFilterSweeperWithDependencies(t *testing.T) { actualSweepers := filterSweeperWithDependencies(tc.StartingSweeper, tc.Sweepers) var keys []string - for k, _ := range actualSweepers { + for k := range actualSweepers { keys = append(keys, k) } @@ -688,7 +688,7 @@ func TestRunSweepers(t *testing.T) { { Name: "single", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, @@ -698,11 +698,11 @@ func TestRunSweepers(t *testing.T) { { Name: "multiple", Sweepers: map[string]*Sweeper{ - "aws_one": &Sweeper{ + "aws_one": { Name: "aws_one", F: mockSweeperFunc, }, - "aws_two": &Sweeper{ + "aws_two": { Name: "aws_two", F: mockSweeperFunc, }, @@ -712,16 +712,16 @@ func TestRunSweepers(t *testing.T) { { Name: "multiple with dep", Sweepers: map[string]*Sweeper{ - "aws_dummy": &Sweeper{ + "aws_dummy": { Name: "aws_dummy", F: mockSweeperFunc, }, - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockSweeperFunc, }, @@ -731,12 +731,12 @@ func TestRunSweepers(t *testing.T) { { Name: "failing dep", Sweepers: map[string]*Sweeper{ - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockFailingSweeperFunc, }, @@ -747,12 +747,12 @@ func TestRunSweepers(t *testing.T) { { Name: "failing dep allow failures", Sweepers: map[string]*Sweeper{ - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockFailingSweeperFunc, }, @@ -764,12 +764,12 @@ func TestRunSweepers(t *testing.T) { { Name: "failing top", Sweepers: map[string]*Sweeper{ - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockFailingSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockSweeperFunc, }, @@ -780,12 +780,12 @@ func TestRunSweepers(t *testing.T) { { Name: "failing top allow failures", Sweepers: map[string]*Sweeper{ - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockFailingSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockSweeperFunc, }, @@ -797,12 +797,12 @@ func TestRunSweepers(t *testing.T) { { Name: "failing top and dep", Sweepers: map[string]*Sweeper{ - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockFailingSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockFailingSweeperFunc, }, @@ -813,12 +813,12 @@ func TestRunSweepers(t *testing.T) { { Name: "failing top and dep allow failues", Sweepers: map[string]*Sweeper{ - "aws_top": &Sweeper{ + "aws_top": { Name: "aws_top", Dependencies: []string{"aws_sub"}, F: mockFailingSweeperFunc, }, - "aws_sub": &Sweeper{ + "aws_sub": { Name: "aws_sub", F: mockFailingSweeperFunc, }, @@ -847,7 +847,7 @@ func TestRunSweepers(t *testing.T) { // get list of tests ran from sweeperRunList keys var keys []string - for k, _ := range sweeperRunList["test"] { + for k := range sweeperRunList["test"] { keys = append(keys, k) } @@ -873,7 +873,7 @@ func TestCheckResourceAttr_empty(t *testing.T) { s.AddModuleState(&terraform.ModuleState{ Path: []string{"root"}, Resources: map[string]*terraform.ResourceState{ - "test_resource": &terraform.ResourceState{ + "test_resource": { Primary: &terraform.InstanceState{ Attributes: map[string]string{ "empty_list.#": "0", @@ -904,7 +904,7 @@ func TestCheckNoResourceAttr_empty(t *testing.T) { s.AddModuleState(&terraform.ModuleState{ Path: []string{"root"}, Resources: map[string]*terraform.ResourceState{ - "test_resource": &terraform.ResourceState{ + "test_resource": { Primary: &terraform.InstanceState{ Attributes: map[string]string{ "empty_list.#": "0", diff --git a/helper/schema/core_schema.go b/helper/schema/core_schema.go index 49a727e734e..7b458b81cc9 100644 --- a/helper/schema/core_schema.go +++ b/helper/schema/core_schema.go @@ -8,6 +8,26 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/configschema" ) +var ( + // DescriptionKind is the default StringKind of descriptions in this provider. + // It defaults to StringPlain but can be globally switched to StringMarkdown. + DescriptionKind = configschema.StringPlain + + // SchemaDescriptionBuilder converts helper/schema.Schema Descriptions to configschema.Attribute + // and Block Descriptions. This method can be used to modify the description text prior to it + // being returned in the schema. + SchemaDescriptionBuilder = func(s *Schema) string { + return s.Description + } + + // ResourceDescriptionBuilder converts helper/schema.Resource Descriptions to configschema.Block + // Descriptions at the resource top level. This method can be used to modify the description prior + // to it being returned in the schema. + ResourceDescriptionBuilder = func(r *Resource) string { + return r.Description + } +) + // The functions and methods in this file are concerned with the conversion // of this package's schema model into the slightly-lower-level schema model // used by Terraform core for configuration parsing. @@ -116,13 +136,22 @@ func (s *Schema) coreConfigSchemaAttribute() *configschema.Attribute { } } + desc := SchemaDescriptionBuilder(s) + descKind := DescriptionKind + if desc == "" { + // fallback to plain text if empty + descKind = configschema.StringPlain + } + return &configschema.Attribute{ - Type: s.coreConfigSchemaType(), - Optional: opt, - Required: reqd, - Computed: s.Computed, - Sensitive: s.Sensitive, - Description: s.Description, + Type: s.coreConfigSchemaType(), + Optional: opt, + Required: reqd, + Computed: s.Computed, + Sensitive: s.Sensitive, + Description: desc, + DescriptionKind: descKind, + Deprecated: s.Deprecated != "", } } @@ -133,6 +162,17 @@ func (s *Schema) coreConfigSchemaBlock() *configschema.NestedBlock { ret := &configschema.NestedBlock{} if nested := s.Elem.(*Resource).coreConfigSchema(); nested != nil { ret.Block = *nested + + desc := SchemaDescriptionBuilder(s) + descKind := DescriptionKind + if desc == "" { + // fallback to plain text if empty + descKind = configschema.StringPlain + } + // set these on the block from the attribute Schema + ret.Block.Description = desc + ret.Block.DescriptionKind = descKind + ret.Block.Deprecated = s.Deprecated != "" } switch s.Type { case TypeList: @@ -232,6 +272,18 @@ func (s *Schema) coreConfigSchemaType() cty.Type { func (r *Resource) CoreConfigSchema() *configschema.Block { block := r.coreConfigSchema() + desc := ResourceDescriptionBuilder(r) + descKind := DescriptionKind + if desc == "" { + // fallback to plain text if empty + descKind = configschema.StringPlain + } + + // Only apply Resource Description, Kind, Deprecation at top level + block.Description = desc + block.DescriptionKind = descKind + block.Deprecated = r.DeprecationMessage != "" + if block.Attributes == nil { block.Attributes = map[string]*configschema.Attribute{} } diff --git a/helper/schema/core_schema_test.go b/helper/schema/core_schema_test.go index a03f8331ec7..c70b99bba4c 100644 --- a/helper/schema/core_schema_test.go +++ b/helper/schema/core_schema_test.go @@ -31,6 +31,15 @@ func testResource(block *configschema.Block) *configschema.Block { } func TestSchemaMapCoreConfigSchema(t *testing.T) { + // these are global so if new tests are written we should probably employ a mutex + DescriptionKind = configschema.StringMarkdown + SchemaDescriptionBuilder = func(s *Schema) string { + if s.Required && s.Description != "" { + return fmt.Sprintf("**Required** %s", s.Description) + } + return s.Description + } + tests := map[string]struct { Schema map[string]*Schema Want *configschema.Block @@ -63,9 +72,10 @@ func TestSchemaMapCoreConfigSchema(t *testing.T) { testResource(&configschema.Block{ Attributes: map[string]*configschema.Attribute{ "int": { - Type: cty.Number, - Required: true, - Description: "foo bar baz", + Type: cty.Number, + Required: true, + Description: "**Required** foo bar baz", + DescriptionKind: configschema.StringMarkdown, }, "float": { Type: cty.Number, @@ -341,7 +351,7 @@ func TestSchemaMapCoreConfigSchema(t *testing.T) { testResource(&configschema.Block{ Attributes: map[string]*configschema.Attribute{}, BlockTypes: map[string]*configschema.NestedBlock{ - "foo": &configschema.NestedBlock{ + "foo": { Nesting: configschema.NestingList, Block: configschema.Block{ Attributes: map[string]*configschema.Attribute{ diff --git a/helper/schema/field_reader.go b/helper/schema/field_reader.go index 2a66a068fb6..622e9b13eb2 100644 --- a/helper/schema/field_reader.go +++ b/helper/schema/field_reader.go @@ -205,7 +205,7 @@ func readListField( // Go through each count, and get the item value out of it result := make([]interface{}, countResult.Value.(int)) - for i, _ := range result { + for i := range result { is := strconv.FormatInt(int64(i), 10) addrPadded[len(addrPadded)-1] = is rawResult, err := r.ReadField(addrPadded) diff --git a/helper/schema/field_reader_config_test.go b/helper/schema/field_reader_config_test.go index e3739187baa..69ef5cde9be 100644 --- a/helper/schema/field_reader_config_test.go +++ b/helper/schema/field_reader_config_test.go @@ -69,7 +69,7 @@ func TestConfigFieldReader(t *testing.T) { // This contains custom table tests for our ConfigFieldReader func TestConfigFieldReader_custom(t *testing.T) { schema := map[string]*Schema{ - "bool": &Schema{ + "bool": { Type: TypeBool, }, } @@ -128,11 +128,11 @@ func TestConfigFieldReader_custom(t *testing.T) { func TestConfigFieldReader_DefaultHandling(t *testing.T) { schema := map[string]*Schema{ - "strWithDefault": &Schema{ + "strWithDefault": { Type: TypeString, Default: "ImADefault", }, - "strWithDefaultFunc": &Schema{ + "strWithDefaultFunc": { Type: TypeString, DefaultFunc: func() (interface{}, error) { return "FuncDefault", nil @@ -213,16 +213,16 @@ func TestConfigFieldReader_DefaultHandling(t *testing.T) { func TestConfigFieldReader_ComputedMap(t *testing.T) { schema := map[string]*Schema{ - "map": &Schema{ + "map": { Type: TypeMap, Computed: true, }, - "listmap": &Schema{ + "listmap": { Type: TypeMap, Computed: true, Elem: TypeList, }, - "maplist": &Schema{ + "maplist": { Type: TypeList, Computed: true, Elem: TypeMap, @@ -390,7 +390,7 @@ func TestConfigFieldReader_ComputedMap(t *testing.T) { func TestConfigFieldReader_ComputedSet(t *testing.T) { schema := map[string]*Schema{ - "strSet": &Schema{ + "strSet": { Type: TypeSet, Elem: &Schema{Type: TypeString}, Set: HashString, @@ -464,7 +464,7 @@ func TestConfigFieldReader_computedComplexSet(t *testing.T) { } schema := map[string]*Schema{ - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ diff --git a/helper/schema/field_reader_diff_test.go b/helper/schema/field_reader_diff_test.go index 2101a7747c7..5af63bb62b1 100644 --- a/helper/schema/field_reader_diff_test.go +++ b/helper/schema/field_reader_diff_test.go @@ -18,15 +18,15 @@ func TestDiffFieldReader_NestedSetUpdate(t *testing.T) { } schema := map[string]*Schema{ - "list_of_sets_1": &Schema{ + "list_of_sets_1": { Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "nested_set": &Schema{ + "nested_set": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ - "val": &Schema{ + "val": { Type: TypeInt, }, }, @@ -36,15 +36,15 @@ func TestDiffFieldReader_NestedSetUpdate(t *testing.T) { }, }, }, - "list_of_sets_2": &Schema{ + "list_of_sets_2": { Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "nested_set": &Schema{ + "nested_set": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ - "val": &Schema{ + "val": { Type: TypeInt, }, }, @@ -60,12 +60,12 @@ func TestDiffFieldReader_NestedSetUpdate(t *testing.T) { Schema: schema, Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "list_of_sets_1.0.nested_set.1.val": &terraform.ResourceAttrDiff{ + "list_of_sets_1.0.nested_set.1.val": { Old: "1", New: "0", NewRemoved: true, }, - "list_of_sets_1.0.nested_set.2.val": &terraform.ResourceAttrDiff{ + "list_of_sets_1.0.nested_set.2.val": { New: "2", }, }, @@ -112,7 +112,7 @@ func TestDiffFieldReader_NestedSetUpdate(t *testing.T) { // https://github.com/hashicorp/terraform-plugin-sdk/issues/914 func TestDiffFieldReader_MapHandling(t *testing.T) { schema := map[string]*Schema{ - "tags": &Schema{ + "tags": { Type: TypeMap, }, } @@ -120,11 +120,11 @@ func TestDiffFieldReader_MapHandling(t *testing.T) { Schema: schema, Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.%": &terraform.ResourceAttrDiff{ + "tags.%": { Old: "1", New: "2", }, - "tags.baz": &terraform.ResourceAttrDiff{ + "tags.baz": { Old: "", New: "qux", }, @@ -156,28 +156,28 @@ func TestDiffFieldReader_MapHandling(t *testing.T) { func TestDiffFieldReader_extra(t *testing.T) { schema := map[string]*Schema{ - "stringComputed": &Schema{Type: TypeString}, + "stringComputed": {Type: TypeString}, - "listMap": &Schema{ + "listMap": { Type: TypeList, Elem: &Schema{ Type: TypeMap, }, }, - "mapRemove": &Schema{Type: TypeMap}, + "mapRemove": {Type: TypeMap}, - "setChange": &Schema{ + "setChange": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "value": &Schema{ + "value": { Type: TypeString, Required: true, }, @@ -189,17 +189,17 @@ func TestDiffFieldReader_extra(t *testing.T) { }, }, - "setEmpty": &Schema{ + "setEmpty": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "value": &Schema{ + "value": { Type: TypeString, Required: true, }, @@ -216,26 +216,26 @@ func TestDiffFieldReader_extra(t *testing.T) { Schema: schema, Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "stringComputed": &terraform.ResourceAttrDiff{ + "stringComputed": { Old: "foo", New: "bar", NewComputed: true, }, - "listMap.0.bar": &terraform.ResourceAttrDiff{ + "listMap.0.bar": { NewRemoved: true, }, - "mapRemove.bar": &terraform.ResourceAttrDiff{ + "mapRemove.bar": { NewRemoved: true, }, - "setChange.10.value": &terraform.ResourceAttrDiff{ + "setChange.10.value": { Old: "50", New: "80", }, - "setEmpty.#": &terraform.ResourceAttrDiff{ + "setEmpty.#": { Old: "2", New: "0", }, @@ -354,156 +354,156 @@ func TestDiffFieldReader(t *testing.T) { Schema: s, Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "bool": &terraform.ResourceAttrDiff{ + "bool": { Old: "", New: "true", }, - "int": &terraform.ResourceAttrDiff{ + "int": { Old: "", New: "42", }, - "float": &terraform.ResourceAttrDiff{ + "float": { Old: "", New: "3.1415", }, - "string": &terraform.ResourceAttrDiff{ + "string": { Old: "", New: "string", }, - "stringComputed": &terraform.ResourceAttrDiff{ + "stringComputed": { Old: "foo", New: "bar", NewComputed: true, }, - "list.#": &terraform.ResourceAttrDiff{ + "list.#": { Old: "0", New: "2", }, - "list.0": &terraform.ResourceAttrDiff{ + "list.0": { Old: "", New: "foo", }, - "list.1": &terraform.ResourceAttrDiff{ + "list.1": { Old: "", New: "bar", }, - "listInt.#": &terraform.ResourceAttrDiff{ + "listInt.#": { Old: "0", New: "2", }, - "listInt.0": &terraform.ResourceAttrDiff{ + "listInt.0": { Old: "", New: "21", }, - "listInt.1": &terraform.ResourceAttrDiff{ + "listInt.1": { Old: "", New: "42", }, - "map.foo": &terraform.ResourceAttrDiff{ + "map.foo": { Old: "", New: "bar", }, - "map.bar": &terraform.ResourceAttrDiff{ + "map.bar": { Old: "", New: "baz", }, - "mapInt.%": &terraform.ResourceAttrDiff{ + "mapInt.%": { Old: "", New: "2", }, - "mapInt.one": &terraform.ResourceAttrDiff{ + "mapInt.one": { Old: "", New: "1", }, - "mapInt.two": &terraform.ResourceAttrDiff{ + "mapInt.two": { Old: "", New: "2", }, - "mapIntNestedSchema.%": &terraform.ResourceAttrDiff{ + "mapIntNestedSchema.%": { Old: "", New: "2", }, - "mapIntNestedSchema.one": &terraform.ResourceAttrDiff{ + "mapIntNestedSchema.one": { Old: "", New: "1", }, - "mapIntNestedSchema.two": &terraform.ResourceAttrDiff{ + "mapIntNestedSchema.two": { Old: "", New: "2", }, - "mapFloat.%": &terraform.ResourceAttrDiff{ + "mapFloat.%": { Old: "", New: "1", }, - "mapFloat.oneDotTwo": &terraform.ResourceAttrDiff{ + "mapFloat.oneDotTwo": { Old: "", New: "1.2", }, - "mapBool.%": &terraform.ResourceAttrDiff{ + "mapBool.%": { Old: "", New: "2", }, - "mapBool.True": &terraform.ResourceAttrDiff{ + "mapBool.True": { Old: "", New: "true", }, - "mapBool.False": &terraform.ResourceAttrDiff{ + "mapBool.False": { Old: "", New: "false", }, - "set.#": &terraform.ResourceAttrDiff{ + "set.#": { Old: "0", New: "2", }, - "set.10": &terraform.ResourceAttrDiff{ + "set.10": { Old: "", New: "10", }, - "set.50": &terraform.ResourceAttrDiff{ + "set.50": { Old: "", New: "50", }, - "setDeep.#": &terraform.ResourceAttrDiff{ + "setDeep.#": { Old: "0", New: "2", }, - "setDeep.10.index": &terraform.ResourceAttrDiff{ + "setDeep.10.index": { Old: "", New: "10", }, - "setDeep.10.value": &terraform.ResourceAttrDiff{ + "setDeep.10.value": { Old: "", New: "foo", }, - "setDeep.50.index": &terraform.ResourceAttrDiff{ + "setDeep.50.index": { Old: "", New: "50", }, - "setDeep.50.value": &terraform.ResourceAttrDiff{ + "setDeep.50.value": { Old: "", New: "bar", }, diff --git a/helper/schema/field_reader_map_test.go b/helper/schema/field_reader_map_test.go index 2723674a326..a0fff5cb689 100644 --- a/helper/schema/field_reader_map_test.go +++ b/helper/schema/field_reader_map_test.go @@ -64,8 +64,8 @@ func TestMapFieldReader(t *testing.T) { func TestMapFieldReader_extra(t *testing.T) { r := &MapFieldReader{ Schema: map[string]*Schema{ - "mapDel": &Schema{Type: TypeMap}, - "mapEmpty": &Schema{Type: TypeMap}, + "mapDel": {Type: TypeMap}, + "mapEmpty": {Type: TypeMap}, }, Map: BasicMapReader(map[string]string{ diff --git a/helper/schema/field_reader_multi_test.go b/helper/schema/field_reader_multi_test.go index bde5dc1f949..a4239c3affe 100644 --- a/helper/schema/field_reader_multi_test.go +++ b/helper/schema/field_reader_multi_test.go @@ -21,7 +21,7 @@ func TestMultiLevelFieldReaderReadFieldExact(t *testing.T) { Readers: []FieldReader{ &MapFieldReader{ Schema: map[string]*Schema{ - "foo": &Schema{Type: TypeString}, + "foo": {Type: TypeString}, }, Map: BasicMapReader(map[string]string{ "foo": "bar", @@ -29,7 +29,7 @@ func TestMultiLevelFieldReaderReadFieldExact(t *testing.T) { }, &MapFieldReader{ Schema: map[string]*Schema{ - "foo": &Schema{Type: TypeString}, + "foo": {Type: TypeString}, }, Map: BasicMapReader(map[string]string{ "foo": "baz", @@ -37,7 +37,7 @@ func TestMultiLevelFieldReaderReadFieldExact(t *testing.T) { }, &MapFieldReader{ Schema: map[string]*Schema{ - "foo": &Schema{Type: TypeString}, + "foo": {Type: TypeString}, }, Map: BasicMapReader(map[string]string{}), }, @@ -88,12 +88,12 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { Readers: []FieldReader{ &DiffFieldReader{ Schema: map[string]*Schema{ - "availability_zone": &Schema{Type: TypeString}, + "availability_zone": {Type: TypeString}, }, Source: &MapFieldReader{ Schema: map[string]*Schema{ - "availability_zone": &Schema{Type: TypeString}, + "availability_zone": {Type: TypeString}, }, Map: BasicMapReader(map[string]string{ "availability_zone": "foo", @@ -102,7 +102,7 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "foo", New: "bar", RequiresNew: true, @@ -124,7 +124,7 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { Readers: []FieldReader{ &MapFieldReader{ Schema: map[string]*Schema{ - "availability_zone": &Schema{Type: TypeString}, + "availability_zone": {Type: TypeString}, }, Map: BasicMapReader(map[string]string{ @@ -134,12 +134,12 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { &DiffFieldReader{ Schema: map[string]*Schema{ - "availability_zone": &Schema{Type: TypeString}, + "availability_zone": {Type: TypeString}, }, Source: &MapFieldReader{ Schema: map[string]*Schema{ - "availability_zone": &Schema{Type: TypeString}, + "availability_zone": {Type: TypeString}, }, Map: BasicMapReader(map[string]string{ @@ -149,7 +149,7 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "foo", New: "bar", NewComputed: true, @@ -172,7 +172,7 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { Readers: []FieldReader{ &DiffFieldReader{ Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Elem: &Schema{Type: TypeMap}, }, @@ -180,7 +180,7 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { Source: &MapFieldReader{ Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Elem: &Schema{Type: TypeMap}, }, @@ -196,7 +196,7 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": { NewRemoved: true, }, }, @@ -223,7 +223,7 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { Readers: []FieldReader{ &MapFieldReader{ Schema: map[string]*Schema{ - "foo": &Schema{Type: TypeString}, + "foo": {Type: TypeString}, }, Map: BasicMapReader(map[string]string{ "foo": "bar", @@ -231,7 +231,7 @@ func TestMultiLevelFieldReaderReadFieldMerge(t *testing.T) { }, &MapFieldReader{ Schema: map[string]*Schema{ - "foo": &Schema{Type: TypeString}, + "foo": {Type: TypeString}, }, Map: BasicMapReader(map[string]string{}), }, diff --git a/helper/schema/field_reader_test.go b/helper/schema/field_reader_test.go index 2c62eb0a8a2..cbaf0fd1276 100644 --- a/helper/schema/field_reader_test.go +++ b/helper/schema/field_reader_test.go @@ -14,7 +14,7 @@ func TestAddrToSchema(t *testing.T) { "full object": { []string{}, map[string]*Schema{ - "list": &Schema{ + "list": { Type: TypeList, Elem: &Schema{Type: TypeInt}, }, @@ -25,7 +25,7 @@ func TestAddrToSchema(t *testing.T) { "list": { []string{"list"}, map[string]*Schema{ - "list": &Schema{ + "list": { Type: TypeList, Elem: &Schema{Type: TypeInt}, }, @@ -36,7 +36,7 @@ func TestAddrToSchema(t *testing.T) { "list.#": { []string{"list", "#"}, map[string]*Schema{ - "list": &Schema{ + "list": { Type: TypeList, Elem: &Schema{Type: TypeInt}, }, @@ -47,7 +47,7 @@ func TestAddrToSchema(t *testing.T) { "list.0": { []string{"list", "0"}, map[string]*Schema{ - "list": &Schema{ + "list": { Type: TypeList, Elem: &Schema{Type: TypeInt}, }, @@ -58,11 +58,11 @@ func TestAddrToSchema(t *testing.T) { "list.0 with resource": { []string{"list", "0"}, map[string]*Schema{ - "list": &Schema{ + "list": { Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "field": &Schema{Type: TypeString}, + "field": {Type: TypeString}, }, }, }, @@ -73,11 +73,11 @@ func TestAddrToSchema(t *testing.T) { "list.0.field": { []string{"list", "0", "field"}, map[string]*Schema{ - "list": &Schema{ + "list": { Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "field": &Schema{Type: TypeString}, + "field": {Type: TypeString}, }, }, }, @@ -88,7 +88,7 @@ func TestAddrToSchema(t *testing.T) { "set": { []string{"set"}, map[string]*Schema{ - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Set: func(a interface{}) int { @@ -102,7 +102,7 @@ func TestAddrToSchema(t *testing.T) { "set.#": { []string{"set", "#"}, map[string]*Schema{ - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Set: func(a interface{}) int { @@ -116,7 +116,7 @@ func TestAddrToSchema(t *testing.T) { "set.0": { []string{"set", "0"}, map[string]*Schema{ - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Set: func(a interface{}) int { @@ -130,11 +130,11 @@ func TestAddrToSchema(t *testing.T) { "set.0 with resource": { []string{"set", "0"}, map[string]*Schema{ - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ - "field": &Schema{Type: TypeString}, + "field": {Type: TypeString}, }, }, }, @@ -145,7 +145,7 @@ func TestAddrToSchema(t *testing.T) { "mapElem": { []string{"map", "foo"}, map[string]*Schema{ - "map": &Schema{Type: TypeMap}, + "map": {Type: TypeMap}, }, []ValueType{TypeMap, TypeString}, }, @@ -153,12 +153,12 @@ func TestAddrToSchema(t *testing.T) { "setDeep": { []string{"set", "50", "index"}, map[string]*Schema{ - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{Type: TypeInt}, - "value": &Schema{Type: TypeString}, + "index": {Type: TypeInt}, + "value": {Type: TypeString}, }, }, Set: func(a interface{}) int { @@ -188,21 +188,21 @@ func TestAddrToSchema(t *testing.T) { func testFieldReader(t *testing.T, f func(map[string]*Schema) FieldReader) { schema := map[string]*Schema{ // Primitives - "bool": &Schema{Type: TypeBool}, - "float": &Schema{Type: TypeFloat}, - "int": &Schema{Type: TypeInt}, - "string": &Schema{Type: TypeString}, + "bool": {Type: TypeBool}, + "float": {Type: TypeFloat}, + "int": {Type: TypeInt}, + "string": {Type: TypeString}, // Lists - "list": &Schema{ + "list": { Type: TypeList, Elem: &Schema{Type: TypeString}, }, - "listInt": &Schema{ + "listInt": { Type: TypeList, Elem: &Schema{Type: TypeInt}, }, - "listMap": &Schema{ + "listMap": { Type: TypeList, Elem: &Schema{ Type: TypeMap, @@ -210,48 +210,48 @@ func testFieldReader(t *testing.T, f func(map[string]*Schema) FieldReader) { }, // Maps - "map": &Schema{Type: TypeMap}, - "mapInt": &Schema{ + "map": {Type: TypeMap}, + "mapInt": { Type: TypeMap, Elem: TypeInt, }, // This is used to verify that the type of a Map can be specified using the // same syntax as for lists (as a nested *Schema passed to Elem) - "mapIntNestedSchema": &Schema{ + "mapIntNestedSchema": { Type: TypeMap, Elem: &Schema{Type: TypeInt}, }, - "mapFloat": &Schema{ + "mapFloat": { Type: TypeMap, Elem: TypeFloat, }, - "mapBool": &Schema{ + "mapBool": { Type: TypeMap, Elem: TypeBool, }, // Sets - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Set: func(a interface{}) int { return a.(int) }, }, - "setDeep": &Schema{ + "setDeep": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{Type: TypeInt}, - "value": &Schema{Type: TypeString}, + "index": {Type: TypeInt}, + "value": {Type: TypeString}, }, }, Set: func(a interface{}) int { return a.(map[string]interface{})["index"].(int) }, }, - "setEmpty": &Schema{ + "setEmpty": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Set: func(a interface{}) int { diff --git a/helper/schema/field_writer_map.go b/helper/schema/field_writer_map.go index c09358b1bb4..85d05be4c3b 100644 --- a/helper/schema/field_writer_map.go +++ b/helper/schema/field_writer_map.go @@ -146,7 +146,7 @@ func (w *MapFieldWriter) setList( } } if err != nil { - for i, _ := range vs { + for i := range vs { is := strconv.FormatInt(int64(i), 10) setElement(is, nil) } @@ -227,7 +227,7 @@ func (w *MapFieldWriter) setObject( } } if err != nil { - for k1, _ := range v { + for k1 := range v { w.set(append(addrCopy, k1), nil) } } diff --git a/helper/schema/field_writer_map_test.go b/helper/schema/field_writer_map_test.go index d1a7932aadc..4480b41fc1b 100644 --- a/helper/schema/field_writer_map_test.go +++ b/helper/schema/field_writer_map_test.go @@ -11,44 +11,44 @@ func TestMapFieldWriter_impl(t *testing.T) { func TestMapFieldWriter(t *testing.T) { schema := map[string]*Schema{ - "bool": &Schema{Type: TypeBool}, - "int": &Schema{Type: TypeInt}, - "string": &Schema{Type: TypeString}, - "list": &Schema{ + "bool": {Type: TypeBool}, + "int": {Type: TypeInt}, + "string": {Type: TypeString}, + "list": { Type: TypeList, Elem: &Schema{Type: TypeString}, }, - "listInt": &Schema{ + "listInt": { Type: TypeList, Elem: &Schema{Type: TypeInt}, }, - "listResource": &Schema{ + "listResource": { Type: TypeList, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "value": &Schema{ + "value": { Type: TypeInt, Optional: true, }, }, }, }, - "map": &Schema{Type: TypeMap}, - "set": &Schema{ + "map": {Type: TypeMap}, + "set": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Set: func(a interface{}) int { return a.(int) }, }, - "setDeep": &Schema{ + "setDeep": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{Type: TypeInt}, - "value": &Schema{Type: TypeString}, + "index": {Type: TypeInt}, + "value": {Type: TypeString}, }, }, Set: func(a interface{}) int { @@ -273,12 +273,12 @@ func TestMapFieldWriter(t *testing.T) { func TestMapFieldWriterCleanSet(t *testing.T) { schema := map[string]*Schema{ - "setDeep": &Schema{ + "setDeep": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{Type: TypeInt}, - "value": &Schema{Type: TypeString}, + "index": {Type: TypeInt}, + "value": {Type: TypeString}, }, }, Set: func(a interface{}) int { @@ -371,12 +371,12 @@ func TestMapFieldWriterCleanSet(t *testing.T) { func TestMapFieldWriterCleanList(t *testing.T) { schema := map[string]*Schema{ - "listDeep": &Schema{ + "listDeep": { Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "thing1": &Schema{Type: TypeString}, - "thing2": &Schema{Type: TypeString}, + "thing1": {Type: TypeString}, + "thing2": {Type: TypeString}, }, }, }, @@ -490,7 +490,7 @@ func TestMapFieldWriterCleanList(t *testing.T) { func TestMapFieldWriterCleanMap(t *testing.T) { schema := map[string]*Schema{ - "map": &Schema{ + "map": { Type: TypeMap, }, } diff --git a/helper/schema/provider.go b/helper/schema/provider.go index b58c103b124..ee0da4b04c3 100644 --- a/helper/schema/provider.go +++ b/helper/schema/provider.go @@ -96,7 +96,7 @@ func (p *Provider) InternalValidate() error { } // Provider-specific checks - for k, _ := range sm { + for k := range sm { if isReservedProviderFieldName(k) { return fmt.Errorf("%s is a reserved field name for a provider", k) } @@ -375,7 +375,7 @@ func (p *Provider) ValidateDataSource( // provider implements. func (p *Provider) DataSources() []terraform.DataSource { keys := make([]string, 0, len(p.DataSourcesMap)) - for k, _ := range p.DataSourcesMap { + for k := range p.DataSourcesMap { keys = append(keys, k) } sort.Strings(keys) diff --git a/helper/schema/provider_test.go b/helper/schema/provider_test.go index b732836144f..e09c6cbae09 100644 --- a/helper/schema/provider_test.go +++ b/helper/schema/provider_test.go @@ -26,7 +26,7 @@ func TestProviderGetSchema(t *testing.T) { }, }, ResourcesMap: map[string]*Resource{ - "foo": &Resource{ + "foo": { Schema: map[string]*Schema{ "bar": { Type: TypeString, @@ -36,7 +36,7 @@ func TestProviderGetSchema(t *testing.T) { }, }, DataSourcesMap: map[string]*Resource{ - "baz": &Resource{ + "baz": { Schema: map[string]*Schema{ "bur": { Type: TypeString, @@ -50,7 +50,7 @@ func TestProviderGetSchema(t *testing.T) { want := &terraform.ProviderSchema{ Provider: &configschema.Block{ Attributes: map[string]*configschema.Attribute{ - "bar": &configschema.Attribute{ + "bar": { Type: cty.String, Required: true, }, @@ -60,7 +60,7 @@ func TestProviderGetSchema(t *testing.T) { ResourceTypes: map[string]*configschema.Block{ "foo": testResource(&configschema.Block{ Attributes: map[string]*configschema.Attribute{ - "bar": &configschema.Attribute{ + "bar": { Type: cty.String, Required: true, }, @@ -71,7 +71,7 @@ func TestProviderGetSchema(t *testing.T) { DataSources: map[string]*configschema.Block{ "baz": testResource(&configschema.Block{ Attributes: map[string]*configschema.Attribute{ - "bur": &configschema.Attribute{ + "bur": { Type: cty.String, Required: true, }, @@ -108,7 +108,7 @@ func TestProviderConfigure(t *testing.T) { { P: &Provider{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -131,7 +131,7 @@ func TestProviderConfigure(t *testing.T) { { P: &Provider{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -154,7 +154,7 @@ func TestProviderConfigure(t *testing.T) { { P: &Provider{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -202,8 +202,8 @@ func TestProviderResources(t *testing.T) { }, }, Result: []terraform.ResourceType{ - terraform.ResourceType{Name: "bar", SchemaAvailable: true}, - terraform.ResourceType{Name: "foo", SchemaAvailable: true}, + {Name: "bar", SchemaAvailable: true}, + {Name: "foo", SchemaAvailable: true}, }, }, @@ -211,14 +211,14 @@ func TestProviderResources(t *testing.T) { P: &Provider{ ResourcesMap: map[string]*Resource{ "foo": nil, - "bar": &Resource{Importer: &ResourceImporter{}}, + "bar": {Importer: &ResourceImporter{}}, "baz": nil, }, }, Result: []terraform.ResourceType{ - terraform.ResourceType{Name: "bar", Importable: true, SchemaAvailable: true}, - terraform.ResourceType{Name: "baz", SchemaAvailable: true}, - terraform.ResourceType{Name: "foo", SchemaAvailable: true}, + {Name: "bar", Importable: true, SchemaAvailable: true}, + {Name: "baz", SchemaAvailable: true}, + {Name: "foo", SchemaAvailable: true}, }, }, } @@ -249,8 +249,8 @@ func TestProviderDataSources(t *testing.T) { }, }, Result: []terraform.DataSource{ - terraform.DataSource{Name: "bar", SchemaAvailable: true}, - terraform.DataSource{Name: "foo", SchemaAvailable: true}, + {Name: "bar", SchemaAvailable: true}, + {Name: "foo", SchemaAvailable: true}, }, }, } @@ -272,7 +272,7 @@ func TestProviderValidate(t *testing.T) { { P: &Provider{ Schema: map[string]*Schema{ - "foo": &Schema{}, + "foo": {}, }, }, Config: nil, @@ -292,7 +292,7 @@ func TestProviderValidate(t *testing.T) { func TestProviderDiff_legacyTimeoutType(t *testing.T) { p := &Provider{ ResourcesMap: map[string]*Resource{ - "blah": &Resource{ + "blah": { Schema: map[string]*Schema{ "foo": { Type: TypeInt, @@ -329,7 +329,7 @@ func TestProviderDiff_legacyTimeoutType(t *testing.T) { func TestProviderDiff_timeoutInvalidValue(t *testing.T) { p := &Provider{ ResourcesMap: map[string]*Resource{ - "blah": &Resource{ + "blah": { Schema: map[string]*Schema{ "foo": { Type: TypeInt, @@ -384,7 +384,7 @@ func TestProviderValidateResource(t *testing.T) { { P: &Provider{ ResourcesMap: map[string]*Resource{ - "foo": &Resource{}, + "foo": {}, }, }, Type: "foo", @@ -405,7 +405,7 @@ func TestProviderValidateResource(t *testing.T) { func TestProviderImportState_default(t *testing.T) { p := &Provider{ ResourcesMap: map[string]*Resource{ - "foo": &Resource{ + "foo": { Importer: &ResourceImporter{}, }, }, @@ -435,7 +435,7 @@ func TestProviderImportState_setsId(t *testing.T) { p := &Provider{ ResourcesMap: map[string]*Resource{ - "foo": &Resource{ + "foo": { Importer: &ResourceImporter{ State: stateFunc, }, @@ -465,7 +465,7 @@ func TestProviderImportState_setsType(t *testing.T) { p := &Provider{ ResourcesMap: map[string]*Resource{ - "foo": &Resource{ + "foo": { Importer: &ResourceImporter{ State: stateFunc, }, diff --git a/helper/schema/resource.go b/helper/schema/resource.go index c502a8b6a53..f4c5052721b 100644 --- a/helper/schema/resource.go +++ b/helper/schema/resource.go @@ -184,6 +184,11 @@ type Resource struct { // actions (Create, Read, Update, Delete, Default) to the Resource struct, and // accessing them in the matching methods. Timeouts *ResourceTimeout + + // Description is used as the description for docs, the language server and + // other user facing usage. It can be plain-text or markdown depending on the + // global DescriptionKind setting. + Description string } // ShimInstanceStateFromValue converts a cty.Value to a @@ -787,7 +792,7 @@ func (r *Resource) InternalValidate(topSchemaMap schemaMap, writable bool) error // Data source if r.isTopLevel() && !writable { tsm = schemaMap(r.Schema) - for k, _ := range tsm { + for k := range tsm { if isReservedDataSourceFieldName(k) { return fmt.Errorf("%s is a reserved field name", k) } diff --git a/helper/schema/resource_data.go b/helper/schema/resource_data.go index 8f0194bd4e7..a9a5ada78f8 100644 --- a/helper/schema/resource_data.go +++ b/helper/schema/resource_data.go @@ -267,7 +267,7 @@ func (d *ResourceData) State() *terraform.InstanceState { // integrity check of fields existing in the schema, allowing dynamic // keys to be created. hasDynamicAttributes := false - for k, _ := range d.schema { + for k := range d.schema { if k == "__has_dynamic_attributes" { hasDynamicAttributes = true log.Printf("[INFO] Resource %s has dynamic attributes", result.ID) diff --git a/helper/schema/resource_data_test.go b/helper/schema/resource_data_test.go index 5908bfe1b00..dae276b823a 100644 --- a/helper/schema/resource_data_test.go +++ b/helper/schema/resource_data_test.go @@ -22,7 +22,7 @@ func TestResourceDataGet(t *testing.T) { // #0 { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -34,7 +34,7 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "foo", New: "bar", NewComputed: true, @@ -49,7 +49,7 @@ func TestResourceDataGet(t *testing.T) { // #1 { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -61,7 +61,7 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -77,7 +77,7 @@ func TestResourceDataGet(t *testing.T) { // #2 { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -89,7 +89,7 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo!", NewExtra: "foo", @@ -104,7 +104,7 @@ func TestResourceDataGet(t *testing.T) { // #3 { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -128,7 +128,7 @@ func TestResourceDataGet(t *testing.T) { // #4 { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -144,7 +144,7 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "foo", New: "bar", NewComputed: true, @@ -159,7 +159,7 @@ func TestResourceDataGet(t *testing.T) { // #5 { Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, Computed: true, @@ -183,7 +183,7 @@ func TestResourceDataGet(t *testing.T) { // #6 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -207,7 +207,7 @@ func TestResourceDataGet(t *testing.T) { // #7 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -231,7 +231,7 @@ func TestResourceDataGet(t *testing.T) { // #8 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -248,7 +248,7 @@ func TestResourceDataGet(t *testing.T) { // #9 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -272,12 +272,12 @@ func TestResourceDataGet(t *testing.T) { // #10 { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Required: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -290,11 +290,11 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + "ingress.#": { Old: "", New: "1", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": { Old: "", New: "8080", }, @@ -311,12 +311,12 @@ func TestResourceDataGet(t *testing.T) { // #11 { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Required: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -329,11 +329,11 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + "ingress.#": { Old: "", New: "1", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": { Old: "", New: "8080", }, @@ -352,7 +352,7 @@ func TestResourceDataGet(t *testing.T) { // #12 Computed get { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Computed: true, }, @@ -372,7 +372,7 @@ func TestResourceDataGet(t *testing.T) { // #13 Full object { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -384,7 +384,7 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -402,7 +402,7 @@ func TestResourceDataGet(t *testing.T) { // #14 List of maps { Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Optional: true, Computed: true, @@ -416,15 +416,15 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + "config_vars.#": { Old: "0", New: "2", }, - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + "config_vars.0.foo": { Old: "", New: "bar", }, - "config_vars.1.bar": &terraform.ResourceAttrDiff{ + "config_vars.1.bar": { Old: "", New: "baz", }, @@ -446,7 +446,7 @@ func TestResourceDataGet(t *testing.T) { // #15 List of maps in state { Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Optional: true, Computed: true, @@ -481,7 +481,7 @@ func TestResourceDataGet(t *testing.T) { // #16 List of maps with removal in diff { Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Optional: true, Computed: true, @@ -500,11 +500,11 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + "config_vars.#": { Old: "1", New: "0", }, - "config_vars.0.FOO": &terraform.ResourceAttrDiff{ + "config_vars.0.FOO": { Old: "bar", NewRemoved: true, }, @@ -519,7 +519,7 @@ func TestResourceDataGet(t *testing.T) { // #17 Sets { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -547,17 +547,17 @@ func TestResourceDataGet(t *testing.T) { // #18 { Schema: map[string]*Schema{ - "data": &Schema{ + "data": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "value": &Schema{ + "value": { Type: TypeString, Required: true, }, @@ -580,7 +580,7 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "data.10.value": &terraform.ResourceAttrDiff{ + "data.10.value": { Old: "50", New: "80", }, @@ -600,7 +600,7 @@ func TestResourceDataGet(t *testing.T) { // #19 Empty Set { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -623,7 +623,7 @@ func TestResourceDataGet(t *testing.T) { // #20 Float zero { Schema: map[string]*Schema{ - "ratio": &Schema{ + "ratio": { Type: TypeFloat, Optional: true, Computed: true, @@ -642,7 +642,7 @@ func TestResourceDataGet(t *testing.T) { // #21 Float given { Schema: map[string]*Schema{ - "ratio": &Schema{ + "ratio": { Type: TypeFloat, Optional: true, Computed: true, @@ -665,7 +665,7 @@ func TestResourceDataGet(t *testing.T) { // #22 Float diff { Schema: map[string]*Schema{ - "ratio": &Schema{ + "ratio": { Type: TypeFloat, Optional: true, Computed: true, @@ -680,7 +680,7 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ratio": &terraform.ResourceAttrDiff{ + "ratio": { Old: "-0.5", New: "33.0", }, @@ -695,7 +695,7 @@ func TestResourceDataGet(t *testing.T) { // #23 Sets with removed elements { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -715,15 +715,15 @@ func TestResourceDataGet(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "2", New: "1", }, - "ports.80": &terraform.ResourceAttrDiff{ + "ports.80": { Old: "80", New: "80", }, - "ports.8080": &terraform.ResourceAttrDiff{ + "ports.8080": { Old: "8080", New: "0", NewRemoved: true, @@ -765,7 +765,7 @@ func TestResourceDataGetChange(t *testing.T) { }{ { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -777,7 +777,7 @@ func TestResourceDataGetChange(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -793,7 +793,7 @@ func TestResourceDataGetChange(t *testing.T) { { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -809,7 +809,7 @@ func TestResourceDataGetChange(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -854,7 +854,7 @@ func TestResourceDataGetOk(t *testing.T) { */ { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -866,7 +866,7 @@ func TestResourceDataGetOk(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "", }, @@ -880,7 +880,7 @@ func TestResourceDataGetOk(t *testing.T) { { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -892,7 +892,7 @@ func TestResourceDataGetOk(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "", NewComputed: true, @@ -907,7 +907,7 @@ func TestResourceDataGetOk(t *testing.T) { { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -930,7 +930,7 @@ func TestResourceDataGetOk(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -952,7 +952,7 @@ func TestResourceDataGetOk(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeMap, Optional: true, }, @@ -973,7 +973,7 @@ func TestResourceDataGetOk(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -992,7 +992,7 @@ func TestResourceDataGetOk(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -1011,7 +1011,7 @@ func TestResourceDataGetOk(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -1023,7 +1023,7 @@ func TestResourceDataGetOk(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "0", }, @@ -1040,7 +1040,7 @@ func TestResourceDataGetOk(t *testing.T) { // indistinguishable from unset config. { Schema: map[string]*Schema{ - "from_port": &Schema{ + "from_port": { Type: TypeInt, Optional: true, }, @@ -1050,7 +1050,7 @@ func TestResourceDataGetOk(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "from_port": &terraform.ResourceAttrDiff{ + "from_port": { Old: "", New: "0", }, @@ -1437,10 +1437,10 @@ func TestResourceDataHasChanges(t *testing.T) { // neither has change { Schema: map[string]*Schema{ - "a": &Schema{ + "a": { Type: TypeString, }, - "b": &Schema{ + "b": { Type: TypeString, }, }, @@ -1454,11 +1454,11 @@ func TestResourceDataHasChanges(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "a": &terraform.ResourceAttrDiff{ + "a": { Old: "", New: "foo", }, - "b": &terraform.ResourceAttrDiff{ + "b": { Old: "", New: "foo", }, @@ -1472,10 +1472,10 @@ func TestResourceDataHasChanges(t *testing.T) { // one key has change { Schema: map[string]*Schema{ - "a": &Schema{ + "a": { Type: TypeString, }, - "b": &Schema{ + "b": { Type: TypeString, }, }, @@ -1489,11 +1489,11 @@ func TestResourceDataHasChanges(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "a": &terraform.ResourceAttrDiff{ + "a": { Old: "", New: "bar", }, - "b": &terraform.ResourceAttrDiff{ + "b": { Old: "", New: "foo", }, @@ -1529,7 +1529,7 @@ func TestResourceDataHasChange(t *testing.T) { }{ { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -1541,7 +1541,7 @@ func TestResourceDataHasChange(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -1556,7 +1556,7 @@ func TestResourceDataHasChange(t *testing.T) { { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -1572,7 +1572,7 @@ func TestResourceDataHasChange(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -1587,7 +1587,7 @@ func TestResourceDataHasChange(t *testing.T) { { Schema: map[string]*Schema{ - "tags": &Schema{ + "tags": { Type: TypeMap, Optional: true, Computed: true, @@ -1598,7 +1598,7 @@ func TestResourceDataHasChange(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.Name": &terraform.ResourceAttrDiff{ + "tags.Name": { Old: "foo", New: "foo", }, @@ -1612,7 +1612,7 @@ func TestResourceDataHasChange(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -1629,7 +1629,7 @@ func TestResourceDataHasChange(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "1", New: "0", }, @@ -1644,7 +1644,7 @@ func TestResourceDataHasChange(t *testing.T) { // https://github.com/hashicorp/terraform/issues/927 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -1661,7 +1661,7 @@ func TestResourceDataHasChange(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.foo": &terraform.ResourceAttrDiff{ + "tags.foo": { Old: "", New: "bar", }, @@ -1707,7 +1707,7 @@ func TestResourceDataSet(t *testing.T) { // #0: Basic good { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -1729,7 +1729,7 @@ func TestResourceDataSet(t *testing.T) { // #1: Basic int { Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, Computed: true, @@ -1751,7 +1751,7 @@ func TestResourceDataSet(t *testing.T) { // #2: Basic bool { Schema: map[string]*Schema{ - "vpc": &Schema{ + "vpc": { Type: TypeBool, Optional: true, }, @@ -1771,7 +1771,7 @@ func TestResourceDataSet(t *testing.T) { // #3 { Schema: map[string]*Schema{ - "vpc": &Schema{ + "vpc": { Type: TypeBool, Optional: true, }, @@ -1791,7 +1791,7 @@ func TestResourceDataSet(t *testing.T) { // #4: Invalid type { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -1814,7 +1814,7 @@ func TestResourceDataSet(t *testing.T) { // #5: List of primitives, set list { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Computed: true, Elem: &Schema{Type: TypeInt}, @@ -1835,7 +1835,7 @@ func TestResourceDataSet(t *testing.T) { // #6: List of primitives, set list with error { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Computed: true, Elem: &Schema{Type: TypeInt}, @@ -1857,7 +1857,7 @@ func TestResourceDataSet(t *testing.T) { // #7: Set a list of maps { Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Optional: true, Computed: true, @@ -1896,7 +1896,7 @@ func TestResourceDataSet(t *testing.T) { // #8: Set, with list { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -1926,7 +1926,7 @@ func TestResourceDataSet(t *testing.T) { // #9: Set, with Set { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -1961,7 +1961,7 @@ func TestResourceDataSet(t *testing.T) { // #10: Set single item { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -1991,15 +1991,15 @@ func TestResourceDataSet(t *testing.T) { // #11: Set with nested set { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Elem: &Resource{ Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeInt, }, - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Set: func(a interface{}) int { @@ -2059,7 +2059,7 @@ func TestResourceDataSet(t *testing.T) { // #12: List of floats, set list { Schema: map[string]*Schema{ - "ratios": &Schema{ + "ratios": { Type: TypeList, Computed: true, Elem: &Schema{Type: TypeFloat}, @@ -2080,7 +2080,7 @@ func TestResourceDataSet(t *testing.T) { // #12: Set of floats, set list { Schema: map[string]*Schema{ - "ratios": &Schema{ + "ratios": { Type: TypeSet, Computed: true, Elem: &Schema{Type: TypeFloat}, @@ -2104,7 +2104,7 @@ func TestResourceDataSet(t *testing.T) { // #13: Basic pointer { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2126,7 +2126,7 @@ func TestResourceDataSet(t *testing.T) { // #14: Basic nil value { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2148,7 +2148,7 @@ func TestResourceDataSet(t *testing.T) { // #15: Basic nil pointer { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2170,11 +2170,11 @@ func TestResourceDataSet(t *testing.T) { // #16: Set in a list { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "set": &Schema{ + "set": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Set: func(a interface{}) int { @@ -2272,7 +2272,7 @@ func TestResourceDataState_schema(t *testing.T) { // #0 Basic primitive in diff { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2284,7 +2284,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -2302,7 +2302,7 @@ func TestResourceDataState_schema(t *testing.T) { // #1 Basic primitive set override { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2314,7 +2314,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -2336,7 +2336,7 @@ func TestResourceDataState_schema(t *testing.T) { // #2 { Schema: map[string]*Schema{ - "vpc": &Schema{ + "vpc": { Type: TypeBool, Optional: true, }, @@ -2360,7 +2360,7 @@ func TestResourceDataState_schema(t *testing.T) { // #3 Basic primitive with StateFunc set { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2372,7 +2372,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", NewExtra: "foo!", @@ -2390,7 +2390,7 @@ func TestResourceDataState_schema(t *testing.T) { // #4 List { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -2406,11 +2406,11 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "1", New: "2", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "100", }, @@ -2429,12 +2429,12 @@ func TestResourceDataState_schema(t *testing.T) { // #5 List of resources { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Required: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -2452,15 +2452,15 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + "ingress.#": { Old: "1", New: "2", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": { Old: "80", New: "150", }, - "ingress.1.from": &terraform.ResourceAttrDiff{ + "ingress.1.from": { Old: "", New: "100", }, @@ -2479,7 +2479,7 @@ func TestResourceDataState_schema(t *testing.T) { // #6 List of maps { Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Optional: true, Computed: true, @@ -2502,7 +2502,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": { NewRemoved: true, }, }, @@ -2510,10 +2510,10 @@ func TestResourceDataState_schema(t *testing.T) { Set: map[string]interface{}{ "config_vars": []map[string]interface{}{ - map[string]interface{}{ + { "foo": "bar", }, - map[string]interface{}{ + { "baz": "bang", }, }, @@ -2533,7 +2533,7 @@ func TestResourceDataState_schema(t *testing.T) { // #7 List of maps with removal in diff { Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Optional: true, Computed: true, @@ -2552,11 +2552,11 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + "config_vars.#": { Old: "1", New: "0", }, - "config_vars.0.FOO": &terraform.ResourceAttrDiff{ + "config_vars.0.FOO": { Old: "bar", NewRemoved: true, }, @@ -2573,7 +2573,7 @@ func TestResourceDataState_schema(t *testing.T) { // #8 Basic state with other keys { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2590,7 +2590,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -2610,7 +2610,7 @@ func TestResourceDataState_schema(t *testing.T) { // #9 Sets { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -2645,7 +2645,7 @@ func TestResourceDataState_schema(t *testing.T) { // #10 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -2676,22 +2676,22 @@ func TestResourceDataState_schema(t *testing.T) { // #11 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "order": &Schema{ + "order": { Type: TypeInt, }, - "a": &Schema{ + "a": { Type: TypeList, Elem: &Schema{Type: TypeInt}, }, - "b": &Schema{ + "b": { Type: TypeList, Elem: &Schema{Type: TypeInt}, }, @@ -2747,7 +2747,7 @@ func TestResourceDataState_schema(t *testing.T) { // #12 Maps { Schema: map[string]*Schema{ - "tags": &Schema{ + "tags": { Type: TypeMap, Optional: true, Computed: true, @@ -2758,7 +2758,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.Name": &terraform.ResourceAttrDiff{ + "tags.Name": { Old: "", New: "foo", }, @@ -2776,7 +2776,7 @@ func TestResourceDataState_schema(t *testing.T) { // #13 empty computed map { Schema: map[string]*Schema{ - "tags": &Schema{ + "tags": { Type: TypeMap, Optional: true, Computed: true, @@ -2787,7 +2787,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "tags.Name": &terraform.ResourceAttrDiff{ + "tags.Name": { Old: "", New: "foo", }, @@ -2808,7 +2808,7 @@ func TestResourceDataState_schema(t *testing.T) { // #14 { Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -2819,7 +2819,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { NewComputed: true, }, }, @@ -2833,7 +2833,7 @@ func TestResourceDataState_schema(t *testing.T) { // #15 { Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -2844,7 +2844,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { NewComputed: true, }, }, @@ -2864,14 +2864,14 @@ func TestResourceDataState_schema(t *testing.T) { // #16 Set of maps { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{Type: TypeInt}, - "uuids": &Schema{Type: TypeMap}, + "index": {Type: TypeInt}, + "uuids": {Type: TypeMap}, }, }, Set: func(a interface{}) int { @@ -2885,7 +2885,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.10.uuids.#": &terraform.ResourceAttrDiff{ + "ports.10.uuids.#": { NewComputed: true, }, }, @@ -2915,7 +2915,7 @@ func TestResourceDataState_schema(t *testing.T) { // #17 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -2937,7 +2937,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "3", New: "0", }, @@ -2954,7 +2954,7 @@ func TestResourceDataState_schema(t *testing.T) { // #18 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -2983,7 +2983,7 @@ func TestResourceDataState_schema(t *testing.T) { // #19 { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Optional: true, Computed: true, @@ -3009,14 +3009,14 @@ func TestResourceDataState_schema(t *testing.T) { // #20 Set lists { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{Type: TypeInt}, - "uuids": &Schema{Type: TypeMap}, + "index": {Type: TypeInt}, + "uuids": {Type: TypeMap}, }, }, }, @@ -3026,7 +3026,7 @@ func TestResourceDataState_schema(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { NewComputed: true, }, }, @@ -3097,7 +3097,7 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { }{ { Schema: map[string]*Schema{ - "boolMap": &Schema{ + "boolMap": { Type: TypeMap, Elem: TypeBool, Optional: true, @@ -3105,11 +3105,11 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { }, Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "boolMap.%": &terraform.ResourceAttrDiff{ + "boolMap.%": { Old: "", New: "1", }, - "boolMap.boolField": &terraform.ResourceAttrDiff{ + "boolMap.boolField": { Old: "", New: "true", }, @@ -3121,7 +3121,7 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { }, { Schema: map[string]*Schema{ - "intMap": &Schema{ + "intMap": { Type: TypeMap, Elem: TypeInt, Optional: true, @@ -3129,11 +3129,11 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { }, Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "intMap.%": &terraform.ResourceAttrDiff{ + "intMap.%": { Old: "", New: "1", }, - "intMap.intField": &terraform.ResourceAttrDiff{ + "intMap.intField": { Old: "", New: "8", }, @@ -3145,7 +3145,7 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { }, { Schema: map[string]*Schema{ - "floatMap": &Schema{ + "floatMap": { Type: TypeMap, Elem: TypeFloat, Optional: true, @@ -3153,11 +3153,11 @@ func TestResourceData_nonStringValuesInMap(t *testing.T) { }, Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "floatMap.%": &terraform.ResourceAttrDiff{ + "floatMap.%": { Old: "", New: "1", }, - "floatMap.floatField": &terraform.ResourceAttrDiff{ + "floatMap.floatField": { Old: "", New: "8.22", }, diff --git a/helper/schema/resource_diff_test.go b/helper/schema/resource_diff_test.go index 9f65334516e..5a0b0e0a6bc 100644 --- a/helper/schema/resource_diff_test.go +++ b/helper/schema/resource_diff_test.go @@ -40,10 +40,10 @@ type resourceDiffTestCase struct { // testDiffCases produces a list of test cases for use with SetNew and SetDiff. func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) []resourceDiffTestCase { return []resourceDiffTestCase{ - resourceDiffTestCase{ + { Name: "basic primitive diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -59,7 +59,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -69,7 +69,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) NewValue: "qux", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: func() string { if computed { @@ -82,10 +82,10 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, }, }, - resourceDiffTestCase{ + { Name: "basic set diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeSet, Optional: true, Computed: true, @@ -104,12 +104,12 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.1996459178": &terraform.ResourceAttrDiff{ + "foo.1996459178": { Old: "bar", New: "", NewRemoved: true, }, - "foo.2015626392": &terraform.ResourceAttrDiff{ + "foo.2015626392": { Old: "", New: "baz", }, @@ -141,10 +141,10 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }(), }, }, - resourceDiffTestCase{ + { Name: "basic list diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Optional: true, Computed: true, @@ -162,7 +162,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0": &terraform.ResourceAttrDiff{ + "foo.0": { Old: "bar", New: "baz", }, @@ -189,10 +189,10 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }(), }, }, - resourceDiffTestCase{ + { Name: "basic map diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeMap, Optional: true, Computed: true, @@ -209,7 +209,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.bar": &terraform.ResourceAttrDiff{ + "foo.bar": { Old: "baz", New: "qux", }, @@ -241,14 +241,14 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }(), }, }, - resourceDiffTestCase{ + { Name: "additional diff with primitive", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, }, - "one": &Schema{ + "one": { Type: TypeString, Optional: true, Computed: true, @@ -265,7 +265,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -275,11 +275,11 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) NewValue: "four", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, - "one": &terraform.ResourceAttrDiff{ + "one": { Old: "two", New: func() string { if computed { @@ -292,14 +292,14 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, }, }, - resourceDiffTestCase{ + { Name: "additional diff with primitive computed only", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, }, - "one": &Schema{ + "one": { Type: TypeString, Computed: true, }, @@ -315,7 +315,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -325,11 +325,11 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) NewValue: "three", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, - "one": &terraform.ResourceAttrDiff{ + "one": { Old: "two", New: func() string { if computed { @@ -342,21 +342,21 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, }, }, - resourceDiffTestCase{ + { Name: "complex-ish set diff", Schema: map[string]*Schema{ - "top": &Schema{ + "top": { Type: TypeSet, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, Computed: true, }, - "bar": &Schema{ + "bar": { Type: TypeInt, Optional: true, Computed: true, @@ -389,19 +389,19 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "top.4.foo": &terraform.ResourceAttrDiff{ + "top.4.foo": { Old: "", New: "1", }, - "top.4.bar": &terraform.ResourceAttrDiff{ + "top.4.bar": { Old: "", New: "3", }, - "top.24.foo": &terraform.ResourceAttrDiff{ + "top.24.foo": { Old: "", New: "12", }, - "top.24.bar": &terraform.ResourceAttrDiff{ + "top.24.bar": { Old: "", New: "12", }, @@ -465,10 +465,10 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }(), }, }, - resourceDiffTestCase{ + { Name: "primitive, no diff, no refresh", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Computed: true, }, @@ -484,7 +484,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) NewValue: "baz", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: func() string { if computed { @@ -497,10 +497,10 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, }, }, - resourceDiffTestCase{ + { Name: "non-computed key, should error", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -515,7 +515,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -525,10 +525,10 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) NewValue: "qux", ExpectedError: true, }, - resourceDiffTestCase{ + { Name: "bad key, should error", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -543,7 +543,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -553,7 +553,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) NewValue: "qux", ExpectedError: true, }, - resourceDiffTestCase{ + { // NOTE: This case is technically impossible in the current // implementation, because optional+computed values never show up in the // diff, and we actually clear existing diffs when SetNew or @@ -561,7 +561,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) // these behaviors change that we don't introduce regressions. Name: "NewRemoved in diff for Optional and Computed, should be fully overridden", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -575,7 +575,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Config: testConfig(t, map[string]interface{}{}), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "", NewRemoved: true, @@ -586,7 +586,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) NewValue: "qux", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: func() string { if computed { @@ -599,10 +599,10 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) }, }, }, - resourceDiffTestCase{ + { Name: "NewComputed should always propagate", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Computed: true, }, @@ -621,7 +621,7 @@ func testDiffCases(t *testing.T, oldPrefix string, oldOffset int, computed bool) Attributes: func() map[string]*terraform.ResourceAttrDiff { if computed { return map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { NewComputed: computed, }, } @@ -689,10 +689,10 @@ func TestSetNewComputed(t *testing.T) { func TestForceNew(t *testing.T) { cases := []resourceDiffTestCase{ - resourceDiffTestCase{ + { Name: "basic primitive diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -708,7 +708,7 @@ func TestForceNew(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -717,7 +717,7 @@ func TestForceNew(t *testing.T) { Key: "foo", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", RequiresNew: true, @@ -725,10 +725,10 @@ func TestForceNew(t *testing.T) { }, }, }, - resourceDiffTestCase{ + { Name: "no change, should error", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -744,10 +744,10 @@ func TestForceNew(t *testing.T) { }), ExpectedError: true, }, - resourceDiffTestCase{ + { Name: "basic primitive, non-computed key", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -762,7 +762,7 @@ func TestForceNew(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -771,7 +771,7 @@ func TestForceNew(t *testing.T) { Key: "foo", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", RequiresNew: true, @@ -779,10 +779,10 @@ func TestForceNew(t *testing.T) { }, }, }, - resourceDiffTestCase{ + { Name: "nested field", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Required: true, MaxItems: 1, @@ -817,11 +817,11 @@ func TestForceNew(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + "foo.0.bar": { Old: "abc", New: "abcdefg", }, - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": { Old: "xyz", New: "changed", }, @@ -830,11 +830,11 @@ func TestForceNew(t *testing.T) { Key: "foo.0.baz", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + "foo.0.bar": { Old: "abc", New: "abcdefg", }, - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": { Old: "xyz", New: "changed", RequiresNew: true, @@ -842,10 +842,10 @@ func TestForceNew(t *testing.T) { }, }, }, - resourceDiffTestCase{ + { Name: "preserve NewRemoved on existing diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, }, @@ -858,7 +858,7 @@ func TestForceNew(t *testing.T) { Config: testConfig(t, map[string]interface{}{}), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "", NewRemoved: true, @@ -868,7 +868,7 @@ func TestForceNew(t *testing.T) { Key: "foo", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "", RequiresNew: true, @@ -877,10 +877,10 @@ func TestForceNew(t *testing.T) { }, }, }, - resourceDiffTestCase{ + { Name: "nested field, preserve original diff without zero values", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Required: true, MaxItems: 1, @@ -913,7 +913,7 @@ func TestForceNew(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + "foo.0.bar": { Old: "abc", New: "abcdefg", }, @@ -922,7 +922,7 @@ func TestForceNew(t *testing.T) { Key: "foo.0.bar", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + "foo.0.bar": { Old: "abc", New: "abcdefg", RequiresNew: true, @@ -958,10 +958,10 @@ func TestForceNew(t *testing.T) { func TestClear(t *testing.T) { cases := []resourceDiffTestCase{ - resourceDiffTestCase{ + { Name: "basic primitive diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -977,7 +977,7 @@ func TestClear(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -986,10 +986,10 @@ func TestClear(t *testing.T) { Key: "foo", Expected: &terraform.InstanceDiff{Attributes: map[string]*terraform.ResourceAttrDiff{}}, }, - resourceDiffTestCase{ + { Name: "non-computed key, should error", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -1004,7 +1004,7 @@ func TestClear(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -1013,15 +1013,15 @@ func TestClear(t *testing.T) { Key: "foo", ExpectedError: true, }, - resourceDiffTestCase{ + { Name: "multi-value, one removed", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, }, - "one": &Schema{ + "one": { Type: TypeString, Optional: true, Computed: true, @@ -1039,11 +1039,11 @@ func TestClear(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, - "one": &terraform.ResourceAttrDiff{ + "one": { Old: "two", New: "three", }, @@ -1052,28 +1052,28 @@ func TestClear(t *testing.T) { Key: "one", Expected: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, }, }, }, - resourceDiffTestCase{ + { Name: "basic sub-block diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "bar": &Schema{ + "bar": { Type: TypeString, Optional: true, Computed: true, }, - "baz": &Schema{ + "baz": { Type: TypeString, Optional: true, Computed: true, @@ -1098,7 +1098,7 @@ func TestClear(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + "foo.0.bar": { Old: "bar1", New: "bar2", }, @@ -1107,21 +1107,21 @@ func TestClear(t *testing.T) { Key: "foo.0.bar", Expected: &terraform.InstanceDiff{Attributes: map[string]*terraform.ResourceAttrDiff{}}, }, - resourceDiffTestCase{ + { Name: "sub-block diff only partial clear", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "bar": &Schema{ + "bar": { Type: TypeString, Optional: true, Computed: true, }, - "baz": &Schema{ + "baz": { Type: TypeString, Optional: true, Computed: true, @@ -1146,11 +1146,11 @@ func TestClear(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.bar": &terraform.ResourceAttrDiff{ + "foo.0.bar": { Old: "bar1", New: "bar2", }, - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": { Old: "baz1", New: "baz2", }, @@ -1158,7 +1158,7 @@ func TestClear(t *testing.T) { }, Key: "foo.0.bar", Expected: &terraform.InstanceDiff{Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": { Old: "baz1", New: "baz2", }, @@ -1192,10 +1192,10 @@ func TestClear(t *testing.T) { func TestGetChangedKeysPrefix(t *testing.T) { cases := []resourceDiffTestCase{ - resourceDiffTestCase{ + { Name: "basic primitive diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -1211,7 +1211,7 @@ func TestGetChangedKeysPrefix(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, @@ -1222,14 +1222,14 @@ func TestGetChangedKeysPrefix(t *testing.T) { "foo", }, }, - resourceDiffTestCase{ + { Name: "nested field filtering", Schema: map[string]*Schema{ - "testfield": &Schema{ + "testfield": { Type: TypeString, Required: true, }, - "foo": &Schema{ + "foo": { Type: TypeList, Required: true, MaxItems: 1, @@ -1266,15 +1266,15 @@ func TestGetChangedKeysPrefix(t *testing.T) { }), Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "testfield": &terraform.ResourceAttrDiff{ + "testfield": { Old: "blablah", New: "modified", }, - "foo.0.bar": &terraform.ResourceAttrDiff{ + "foo.0.bar": { Old: "abc", New: "abcdefg", }, - "foo.0.baz": &terraform.ResourceAttrDiff{ + "foo.0.baz": { Old: "xyz", New: "changed", }, diff --git a/helper/schema/resource_test.go b/helper/schema/resource_test.go index a5862b3ed42..77b51f8c098 100644 --- a/helper/schema/resource_test.go +++ b/helper/schema/resource_test.go @@ -21,7 +21,7 @@ func TestResourceApply_create(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -39,7 +39,7 @@ func TestResourceApply_create(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "42", }, }, @@ -74,7 +74,7 @@ func TestResourceApply_Timeout_state(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -97,7 +97,7 @@ func TestResourceApply_Timeout_state(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "42", }, }, @@ -151,7 +151,7 @@ func TestResourceApply_Timeout_destroy(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -200,7 +200,7 @@ func TestResourceApply_Timeout_destroy(t *testing.T) { func TestResourceDiff_Timeout_diff(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -234,7 +234,7 @@ func TestResourceDiff_Timeout_diff(t *testing.T) { expected := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "42", }, }, @@ -258,7 +258,7 @@ func TestResourceDiff_Timeout_diff(t *testing.T) { func TestResourceDiff_CustomizeFunc(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -293,7 +293,7 @@ func TestResourceDiff_CustomizeFunc(t *testing.T) { func TestResourceApply_destroy(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -331,12 +331,12 @@ func TestResourceApply_destroy(t *testing.T) { func TestResourceApply_destroyCreate(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, - "tags": &Schema{ + "tags": { Type: TypeMap, Optional: true, Computed: true, @@ -364,11 +364,11 @@ func TestResourceApply_destroyCreate(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "42", RequiresNew: true, }, - "tags.Name": &terraform.ResourceAttrDiff{ + "tags.Name": { Old: "foo", New: "foo", RequiresNew: true, @@ -403,7 +403,7 @@ func TestResourceApply_destroyCreate(t *testing.T) { func TestResourceApply_destroyPartial(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -451,7 +451,7 @@ func TestResourceApply_destroyPartial(t *testing.T) { func TestResourceApply_update(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -472,7 +472,7 @@ func TestResourceApply_update(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "13", }, }, @@ -499,7 +499,7 @@ func TestResourceApply_update(t *testing.T) { func TestResourceApply_updateNoCallback(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -517,7 +517,7 @@ func TestResourceApply_updateNoCallback(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "13", }, }, @@ -543,7 +543,7 @@ func TestResourceApply_updateNoCallback(t *testing.T) { func TestResourceApply_isNewResource(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, }, @@ -566,7 +566,7 @@ func TestResourceApply_isNewResource(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "bla-blah", }, }, @@ -637,7 +637,7 @@ func TestResourceInternalValidate(t *testing.T) { 1: { &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, Required: true, @@ -653,7 +653,7 @@ func TestResourceInternalValidate(t *testing.T) { &Resource{ Create: Noop, Schema: map[string]*Schema{ - "boo": &Schema{ + "boo": { Type: TypeInt, Optional: true, }, @@ -669,7 +669,7 @@ func TestResourceInternalValidate(t *testing.T) { Create: Noop, Update: Noop, Schema: map[string]*Schema{ - "goo": &Schema{ + "goo": { Type: TypeInt, Optional: true, ForceNew: true, @@ -684,7 +684,7 @@ func TestResourceInternalValidate(t *testing.T) { 4: { &Resource{ Schema: map[string]*Schema{ - "goo": &Schema{ + "goo": { Type: TypeInt, Optional: true, }, @@ -699,7 +699,7 @@ func TestResourceInternalValidate(t *testing.T) { &Resource{ Create: Noop, Schema: map[string]*Schema{ - "goo": &Schema{ + "goo": { Type: TypeInt, Optional: true, }, @@ -716,7 +716,7 @@ func TestResourceInternalValidate(t *testing.T) { Update: Noop, Delete: Noop, Schema: map[string]*Schema{ - "goo": &Schema{ + "goo": { Type: TypeInt, Optional: true, }, @@ -733,7 +733,7 @@ func TestResourceInternalValidate(t *testing.T) { Read: Noop, Update: Noop, Schema: map[string]*Schema{ - "goo": &Schema{ + "goo": { Type: TypeInt, Optional: true, }, @@ -767,7 +767,7 @@ func TestResourceInternalValidate(t *testing.T) { Update: Noop, Delete: Noop, Schema: map[string]*Schema{ - "parent_list": &Schema{ + "parent_list": { Type: TypeString, Optional: true, Elem: &Resource{ @@ -792,7 +792,7 @@ func TestResourceInternalValidate(t *testing.T) { Update: Noop, Delete: Noop, Schema: map[string]*Schema{ - "alias": &Schema{ + "alias": { Type: TypeString, Optional: true, }, @@ -806,7 +806,7 @@ func TestResourceInternalValidate(t *testing.T) { &Resource{ Read: Noop, Schema: map[string]*Schema{ - "id": &Schema{ + "id": { Type: TypeString, Optional: true, }, @@ -823,7 +823,7 @@ func TestResourceInternalValidate(t *testing.T) { Update: Noop, Delete: Noop, Schema: map[string]*Schema{ - "id": &Schema{ + "id": { Type: TypeString, Optional: true, Deprecated: "Use x_id instead", @@ -838,7 +838,7 @@ func TestResourceInternalValidate(t *testing.T) { &Resource{ Read: Noop, Schema: map[string]*Schema{ - "goo": &Schema{ + "goo": { Type: TypeInt, Optional: true, }, @@ -852,7 +852,7 @@ func TestResourceInternalValidate(t *testing.T) { &Resource{ Read: Noop, Schema: map[string]*Schema{ - "goo": &Schema{ + "goo": { Type: TypeInt, Optional: true, }, @@ -870,7 +870,7 @@ func TestResourceInternalValidate(t *testing.T) { Update: Noop, Delete: Noop, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -887,7 +887,7 @@ func TestResourceInternalValidate(t *testing.T) { Update: Noop, Delete: Noop, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -904,7 +904,7 @@ func TestResourceInternalValidate(t *testing.T) { UpdateContext: NoopContext, Delete: Noop, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -921,7 +921,7 @@ func TestResourceInternalValidate(t *testing.T) { Delete: Noop, DeleteContext: NoopContext, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -939,7 +939,7 @@ func TestResourceInternalValidate(t *testing.T) { Exists: func(*ResourceData, interface{}) (bool, error) { return false, nil }, ExistsContext: func(context.Context, *ResourceData, interface{}) (bool, error) { return false, nil }, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -971,7 +971,7 @@ func TestResourceRefresh(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1017,7 +1017,7 @@ func TestResourceRefresh(t *testing.T) { func TestResourceRefresh_blankId(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1046,7 +1046,7 @@ func TestResourceRefresh_blankId(t *testing.T) { func TestResourceRefresh_delete(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1078,7 +1078,7 @@ func TestResourceRefresh_delete(t *testing.T) { func TestResourceRefresh_existsError(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1112,7 +1112,7 @@ func TestResourceRefresh_existsError(t *testing.T) { func TestResourceRefresh_noExists(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1148,7 +1148,7 @@ func TestResourceRefresh_needsMigration(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "newfoo": &Schema{ + "newfoo": { Type: TypeInt, Optional: true, }, @@ -1220,7 +1220,7 @@ func TestResourceRefresh_noMigrationNeeded(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "newfoo": &Schema{ + "newfoo": { Type: TypeInt, Optional: true, }, @@ -1275,7 +1275,7 @@ func TestResourceRefresh_stateSchemaVersionUnset(t *testing.T) { // Version 1 > Version 0 SchemaVersion: 1, Schema: map[string]*Schema{ - "newfoo": &Schema{ + "newfoo": { Type: TypeInt, Optional: true, }, @@ -1326,7 +1326,7 @@ func TestResourceRefresh_migrateStateErr(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "newfoo": &Schema{ + "newfoo": { Type: TypeInt, Optional: true, }, @@ -1362,7 +1362,7 @@ func TestResourceData(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1400,7 +1400,7 @@ func TestResourceData_blank(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1434,7 +1434,7 @@ func TestResourceData_timeouts(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1459,7 +1459,7 @@ func TestResource_UpgradeState(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "newfoo": &Schema{ + "newfoo": { Type: TypeInt, Optional: true, }, @@ -1528,7 +1528,7 @@ func TestResource_ValidateUpgradeState(t *testing.T) { r := &Resource{ SchemaVersion: 3, Schema: map[string]*Schema{ - "newfoo": &Schema{ + "newfoo": { Type: TypeInt, Optional: true, }, @@ -1775,7 +1775,7 @@ func TestResource_migrateAndUpgrade(t *testing.T) { func TestResource_ContextTimeout(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -1796,7 +1796,7 @@ func TestResource_ContextTimeout(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "42", }, }, diff --git a/helper/schema/schema.go b/helper/schema/schema.go index c726551f1af..331c524582e 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -115,9 +115,9 @@ type Schema struct { Default interface{} DefaultFunc SchemaDefaultFunc - // Description is used as the description for docs or asking for user - // input. It should be relatively short (a few sentences max) and should - // be formatted to fit a CLI. + // Description is used as the description for docs, the language server and + // other user facing usage. It can be plain-text or markdown depending on the + // global DescriptionKind setting. Description string // InputDefault is the default value to use for when inputs are requested. @@ -1546,7 +1546,7 @@ func (m schemaMap) validateList( // Now build the []interface{} raws := make([]interface{}, rawV.Len()) - for i, _ := range raws { + for i := range raws { raws[i] = rawV.Index(i).Interface() } @@ -1632,7 +1632,7 @@ func (m schemaMap) validateMap( // It is a slice, verify that all the elements are maps raws := make([]interface{}, rawV.Len()) - for i, _ := range raws { + for i := range raws { raws[i] = rawV.Index(i).Interface() } @@ -1756,7 +1756,7 @@ func (m schemaMap) validateObject( // Detect any extra/unknown keys and report those as errors. if m, ok := raw.(map[string]interface{}); ok { - for subk, _ := range m { + for subk := range m { if _, ok := schema[subk]; !ok { if subk == TimeoutsConfigKey { continue diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 9d4e01e7a02..1f9f773ec40 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -138,7 +138,7 @@ func TestSchemaMap_Diff(t *testing.T) { }{ { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -154,7 +154,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -167,7 +167,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -181,7 +181,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", NewComputed: true, RequiresNew: true, @@ -194,7 +194,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -216,7 +216,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Computed, but set in config", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -235,7 +235,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "foo", New: "bar", }, @@ -248,7 +248,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Default", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Default: "foo", @@ -261,7 +261,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", }, @@ -274,7 +274,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "DefaultFunc, value", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, DefaultFunc: func() (interface{}, error) { @@ -289,7 +289,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", }, @@ -302,7 +302,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "DefaultFunc, configuration set", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, DefaultFunc: func() (interface{}, error) { @@ -319,7 +319,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "bar", }, @@ -332,7 +332,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "String with StateFunc", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -350,7 +350,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo!", NewExtra: "foo", @@ -364,7 +364,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "StateFunc not called with nil value", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -381,7 +381,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "", NewComputed: true, @@ -395,7 +395,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Variable computed", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, }, @@ -409,7 +409,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -423,7 +423,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Int decode", Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, Computed: true, @@ -439,7 +439,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + "port": { Old: "", New: "27", RequiresNew: true, @@ -453,7 +453,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "bool decode", Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeBool, Optional: true, Computed: true, @@ -469,7 +469,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + "port": { Old: "", New: "false", RequiresNew: true, @@ -483,7 +483,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Bool", Schema: map[string]*Schema{ - "delete": &Schema{ + "delete": { Type: TypeBool, Optional: true, Default: false, @@ -506,7 +506,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "List decode", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -521,19 +521,19 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": { Old: "", New: "1", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "2", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "5", }, @@ -545,7 +545,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -560,19 +560,19 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": { Old: "", New: "1", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "2", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "5", }, @@ -584,7 +584,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -599,7 +599,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "", NewComputed: true, @@ -612,7 +612,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -640,7 +640,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -661,11 +661,11 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "2", New: "3", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "5", }, @@ -678,7 +678,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -694,22 +694,22 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", RequiresNew: true, }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": { Old: "", New: "1", RequiresNew: true, }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "2", RequiresNew: true, }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "5", RequiresNew: true, @@ -723,7 +723,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Optional: true, Computed: true, @@ -737,7 +737,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "", NewComputed: true, }, @@ -750,7 +750,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "List with computed set", Schema: map[string]*Schema{ - "config": &Schema{ + "config": { Type: TypeList, Optional: true, ForceNew: true, @@ -785,18 +785,18 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config.#": &terraform.ResourceAttrDiff{ + "config.#": { Old: "0", New: "1", RequiresNew: true, }, - "config.0.name": &terraform.ResourceAttrDiff{ + "config.0.name": { Old: "", New: "hello", }, - "config.0.rules.#": &terraform.ResourceAttrDiff{ + "config.0.rules.#": { Old: "", NewComputed: true, }, @@ -809,7 +809,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -827,19 +827,19 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", }, @@ -852,7 +852,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Computed: true, Required: true, @@ -879,7 +879,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -896,7 +896,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "", NewComputed: true, }, @@ -909,7 +909,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -927,19 +927,19 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", }, @@ -952,7 +952,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -970,7 +970,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "", New: "", NewComputed: true, @@ -984,7 +984,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1008,19 +1008,19 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "2", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", }, @@ -1033,7 +1033,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1055,16 +1055,16 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "2", New: "0", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "1", New: "0", NewRemoved: true, }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "2", New: "0", NewRemoved: true, @@ -1078,7 +1078,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -1107,12 +1107,12 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeSet, Required: true, Elem: &Resource{ Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -1160,12 +1160,12 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "List of structure decode", Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Required: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -1186,11 +1186,11 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + "ingress.#": { Old: "0", New: "1", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": { Old: "", New: "8080", }, @@ -1203,13 +1203,13 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "ComputedWhen", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Computed: true, ComputedWhen: []string{"port"}, }, - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, }, @@ -1234,13 +1234,13 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Computed: true, ComputedWhen: []string{"port"}, }, - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, }, @@ -1258,7 +1258,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { NewComputed: true, }, }, @@ -1313,7 +1313,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Maps", Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeMap, }, }, @@ -1330,12 +1330,12 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.%": &terraform.ResourceAttrDiff{ + "config_vars.%": { Old: "0", New: "1", }, - "config_vars.bar": &terraform.ResourceAttrDiff{ + "config_vars.bar": { Old: "", New: "baz", }, @@ -1348,7 +1348,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Maps", Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeMap, }, }, @@ -1369,11 +1369,11 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.foo": &terraform.ResourceAttrDiff{ + "config_vars.foo": { Old: "bar", NewRemoved: true, }, - "config_vars.bar": &terraform.ResourceAttrDiff{ + "config_vars.bar": { Old: "", New: "baz", }, @@ -1386,7 +1386,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Maps", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, Optional: true, Computed: true, @@ -1409,12 +1409,12 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.foo": &terraform.ResourceAttrDiff{ + "vars.foo": { Old: "bar", New: "", NewRemoved: true, }, - "vars.bar": &terraform.ResourceAttrDiff{ + "vars.bar": { Old: "", New: "baz", }, @@ -1427,7 +1427,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Maps", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, Computed: true, }, @@ -1449,7 +1449,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Maps", Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Elem: &Schema{Type: TypeMap}, }, @@ -1472,11 +1472,11 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + "config_vars.0.foo": { Old: "bar", NewRemoved: true, }, - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": { Old: "", New: "baz", }, @@ -1489,7 +1489,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Maps", Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Elem: &Schema{Type: TypeMap}, }, @@ -1507,19 +1507,19 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + "config_vars.#": { Old: "1", New: "0", }, - "config_vars.0.%": &terraform.ResourceAttrDiff{ + "config_vars.0.%": { Old: "2", New: "0", }, - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + "config_vars.0.foo": { Old: "bar", NewRemoved: true, }, - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": { Old: "baz", NewRemoved: true, }, @@ -1532,13 +1532,13 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "ForceNews", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, ForceNew: true, }, - "address": &Schema{ + "address": { Type: TypeString, Optional: true, Computed: true, @@ -1558,13 +1558,13 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "bar", New: "foo", RequiresNew: true, }, - "address": &terraform.ResourceAttrDiff{ + "address": { Old: "foo", New: "", NewComputed: true, @@ -1578,13 +1578,13 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, ForceNew: true, }, - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -1609,13 +1609,13 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "bar", New: "foo", RequiresNew: true, }, - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "1", New: "", NewComputed: true, @@ -1629,7 +1629,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "instances": &Schema{ + "instances": { Type: TypeSet, Elem: &Schema{Type: TypeString}, Optional: true, @@ -1652,7 +1652,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + "instances.#": { NewComputed: true, }, }, @@ -1664,17 +1664,17 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "route": &Schema{ + "route": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "gateway": &Schema{ + "gateway": { Type: TypeString, Optional: true, }, @@ -1700,15 +1700,15 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + "route.#": { Old: "0", New: "1", }, - "route.~1.index": &terraform.ResourceAttrDiff{ + "route.~1.index": { Old: "", New: "1", }, - "route.~1.gateway": &terraform.ResourceAttrDiff{ + "route.~1.gateway": { Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -1722,17 +1722,17 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set", Schema: map[string]*Schema{ - "route": &Schema{ + "route": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "gateway": &Schema{ + "gateway": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -1764,15 +1764,15 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + "route.#": { Old: "0", New: "1", }, - "route.~1.index": &terraform.ResourceAttrDiff{ + "route.~1.index": { Old: "", New: "1", }, - "route.~1.gateway.#": &terraform.ResourceAttrDiff{ + "route.~1.gateway.#": { NewComputed: true, }, }, @@ -1784,7 +1784,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Computed maps", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, Computed: true, }, @@ -1796,7 +1796,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + "vars.%": { Old: "", NewComputed: true, }, @@ -1809,7 +1809,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Computed maps", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, Computed: true, }, @@ -1829,7 +1829,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + "vars.%": { Old: "", NewComputed: true, }, @@ -1855,7 +1855,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Float", Schema: map[string]*Schema{ - "some_threshold": &Schema{ + "some_threshold": { Type: TypeFloat, }, }, @@ -1872,7 +1872,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "some_threshold": &terraform.ResourceAttrDiff{ + "some_threshold": { Old: "567.8", New: "12.34", }, @@ -1885,17 +1885,17 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "https://github.com/hashicorp/terraform-plugin-sdk/issues/824", Schema: map[string]*Schema{ - "block_device": &Schema{ + "block_device": { Type: TypeSet, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "device_name": &Schema{ + "device_name": { Type: TypeString, Required: true, }, - "delete_on_termination": &Schema{ + "delete_on_termination": { Type: TypeBool, Optional: true, Default: true, @@ -1939,7 +1939,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Zero value in state shouldn't result in diff", Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeBool, Optional: true, ForceNew: true, @@ -1962,17 +1962,17 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Same as prev, but for sets", Schema: map[string]*Schema{ - "route": &Schema{ + "route": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "gateway": &Schema{ + "gateway": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -2005,7 +2005,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "A set computed element shouldn't cause a diff", Schema: map[string]*Schema{ - "active": &Schema{ + "active": { Type: TypeBool, Computed: true, ForceNew: true, @@ -2028,7 +2028,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "An empty set should show up in the diff", Schema: map[string]*Schema{ - "instances": &Schema{ + "instances": { Type: TypeSet, Elem: &Schema{Type: TypeString}, Optional: true, @@ -2050,12 +2050,12 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + "instances.#": { Old: "1", New: "0", RequiresNew: true, }, - "instances.3": &terraform.ResourceAttrDiff{ + "instances.3": { Old: "foo", New: "", NewRemoved: true, @@ -2070,7 +2070,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Map with empty value", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, }, }, @@ -2085,11 +2085,11 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + "vars.%": { Old: "0", New: "1", }, - "vars.foo": &terraform.ResourceAttrDiff{ + "vars.foo": { Old: "", New: "", }, @@ -2102,7 +2102,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Unset bool, not in state", Schema: map[string]*Schema{ - "force": &Schema{ + "force": { Type: TypeBool, Optional: true, ForceNew: true, @@ -2121,7 +2121,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Unset set, not in state", Schema: map[string]*Schema{ - "metadata_keys": &Schema{ + "metadata_keys": { Type: TypeSet, Optional: true, ForceNew: true, @@ -2142,7 +2142,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Unset list in state, should not show up computed", Schema: map[string]*Schema{ - "metadata_keys": &Schema{ + "metadata_keys": { Type: TypeList, Optional: true, Computed: true, @@ -2167,7 +2167,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set element computed element", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -2185,7 +2185,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "", New: "", NewComputed: true, @@ -2199,7 +2199,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Computed map without config that's known to be empty does not generate diff", Schema: map[string]*Schema{ - "tags": &Schema{ + "tags": { Type: TypeMap, Computed: true, }, @@ -2221,17 +2221,17 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set with hyphen keys", Schema: map[string]*Schema{ - "route": &Schema{ + "route": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "gateway-name": &Schema{ + "gateway-name": { Type: TypeString, Optional: true, }, @@ -2257,15 +2257,15 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + "route.#": { Old: "0", New: "1", }, - "route.1.index": &terraform.ResourceAttrDiff{ + "route.1.index": { Old: "", New: "1", }, - "route.1.gateway-name": &terraform.ResourceAttrDiff{ + "route.1.gateway-name": { Old: "", New: "hello", }, @@ -2278,13 +2278,13 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: ": StateFunc in nested set (#1759)", Schema: map[string]*Schema{ - "service_account": &Schema{ + "service_account": { Type: TypeList, Optional: true, ForceNew: true, Elem: &Resource{ Schema: map[string]*Schema{ - "scopes": &Schema{ + "scopes": { Type: TypeSet, Required: true, ForceNew: true, @@ -2319,17 +2319,17 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "service_account.#": &terraform.ResourceAttrDiff{ + "service_account.#": { Old: "0", New: "1", RequiresNew: true, }, - "service_account.0.scopes.#": &terraform.ResourceAttrDiff{ + "service_account.0.scopes.#": { Old: "0", New: "1", RequiresNew: true, }, - "service_account.0.scopes.123": &terraform.ResourceAttrDiff{ + "service_account.0.scopes.123": { Old: "", New: "123!", NewExtra: "123", @@ -2344,7 +2344,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Removing set elements", Schema: map[string]*Schema{ - "instances": &Schema{ + "instances": { Type: TypeSet, Elem: &Schema{Type: TypeString}, Optional: true, @@ -2369,21 +2369,21 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + "instances.#": { Old: "2", New: "2", }, - "instances.2": &terraform.ResourceAttrDiff{ + "instances.2": { Old: "22", New: "", NewRemoved: true, RequiresNew: true, }, - "instances.3": &terraform.ResourceAttrDiff{ + "instances.3": { Old: "333", New: "333", }, - "instances.4": &terraform.ResourceAttrDiff{ + "instances.4": { Old: "", New: "4444", RequiresNew: true, @@ -2397,15 +2397,15 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Bools can be set with 0/1 in config, still get true/false", Schema: map[string]*Schema{ - "one": &Schema{ + "one": { Type: TypeBool, Optional: true, }, - "two": &Schema{ + "two": { Type: TypeBool, Optional: true, }, - "three": &Schema{ + "three": { Type: TypeBool, Optional: true, }, @@ -2426,15 +2426,15 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "one": &terraform.ResourceAttrDiff{ + "one": { Old: "false", New: "true", }, - "two": &terraform.ResourceAttrDiff{ + "two": { Old: "true", New: "false", }, - "three": &terraform.ResourceAttrDiff{ + "three": { Old: "true", New: "false", NewRemoved: true, @@ -2469,7 +2469,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set ForceNew only marks the changing element as ForceNew", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, ForceNew: true, @@ -2495,24 +2495,24 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "3", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", RequiresNew: true, }, - "ports.4": &terraform.ResourceAttrDiff{ + "ports.4": { Old: "4", New: "0", NewRemoved: true, @@ -2525,7 +2525,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "removed optional items should trigger ForceNew", Schema: map[string]*Schema{ - "description": &Schema{ + "description": { Type: TypeString, ForceNew: true, Optional: true, @@ -2542,7 +2542,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "description": &terraform.ResourceAttrDiff{ + "description": { Old: "foo", New: "", RequiresNew: true, @@ -2558,7 +2558,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "computed value for boolean field", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeBool, ForceNew: true, Computed: true, @@ -2574,7 +2574,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "", New: "false", NewComputed: true, @@ -2589,7 +2589,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set ForceNew marks count as ForceNew if computed", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, ForceNew: true, @@ -2615,7 +2615,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "3", New: "", NewComputed: true, @@ -2628,7 +2628,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "List with computed schema and ForceNew", Schema: map[string]*Schema{ - "config": &Schema{ + "config": { Type: TypeList, Optional: true, ForceNew: true, @@ -2652,7 +2652,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config.#": &terraform.ResourceAttrDiff{ + "config.#": { Old: "2", New: "", RequiresNew: true, @@ -2667,7 +2667,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "overridden diff with a CustomizeDiff function, ForceNew not in schema", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2692,7 +2692,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "bar", RequiresNew: true, @@ -2710,7 +2710,7 @@ func TestSchemaMap_Diff(t *testing.T) { // intended diff still shows up. Name: "overridden removed attribute diff with a CustomizeDiff function, ForceNew not in schema", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2733,7 +2733,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "bar", RequiresNew: true, @@ -2748,7 +2748,7 @@ func TestSchemaMap_Diff(t *testing.T) { Name: "overridden diff with a CustomizeDiff function, ForceNew in schema", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2771,7 +2771,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "bar", RequiresNew: true, @@ -2785,11 +2785,11 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "required field with computed diff added with CustomizeDiff function", Schema: map[string]*Schema{ - "ami_id": &Schema{ + "ami_id": { Type: TypeString, Required: true, }, - "instance_id": &Schema{ + "instance_id": { Type: TypeString, Computed: true, }, @@ -2810,11 +2810,11 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ami_id": &terraform.ResourceAttrDiff{ + "ami_id": { Old: "", New: "foo", }, - "instance_id": &terraform.ResourceAttrDiff{ + "instance_id": { Old: "", New: "bar", }, @@ -2827,7 +2827,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "Set ForceNew only marks the changing element as ForceNew - CustomizeDiffFunc edition", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -2863,24 +2863,24 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "3", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", RequiresNew: true, }, - "ports.4": &terraform.ResourceAttrDiff{ + "ports.4": { Old: "4", New: "0", NewRemoved: true, @@ -2918,12 +2918,12 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "NewComputed based on a conditional with CustomizeDiffFunc", Schema: map[string]*Schema{ - "etag": &Schema{ + "etag": { Type: TypeString, Optional: true, Computed: true, }, - "version_id": &Schema{ + "version_id": { Type: TypeString, Computed: true, }, @@ -2949,11 +2949,11 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "etag": &terraform.ResourceAttrDiff{ + "etag": { Old: "foo", New: "bar", }, - "version_id": &terraform.ResourceAttrDiff{ + "version_id": { Old: "1", New: "", NewComputed: true, @@ -2967,7 +2967,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "NewComputed should always propagate with CustomizeDiff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Computed: true, }, @@ -2989,7 +2989,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { NewComputed: true, }, }, @@ -3001,7 +3001,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "vetoing a diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -3032,7 +3032,7 @@ func TestSchemaMap_Diff(t *testing.T) { { Name: "optional, computed, empty string", Schema: map[string]*Schema{ - "attr": &Schema{ + "attr": { Type: TypeString, Optional: true, Computed: true, @@ -3126,7 +3126,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Both optional and required": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, Required: true, @@ -3137,7 +3137,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "No optional and no required": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, }, }, @@ -3146,7 +3146,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Missing Type": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Required: true, }, }, @@ -3155,7 +3155,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Required but computed": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Required: true, Computed: true, @@ -3166,7 +3166,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Looks good": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Required: true, }, @@ -3176,7 +3176,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed but has default": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, Computed: true, @@ -3188,7 +3188,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Required but has default": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, Required: true, @@ -3200,7 +3200,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "List element not set": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, }, }, @@ -3209,7 +3209,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "List default": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Elem: &Schema{Type: TypeInt}, Default: "foo", @@ -3220,7 +3220,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "List element computed": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Optional: true, Elem: &Schema{ @@ -3234,7 +3234,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "List element with Set set": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Elem: &Schema{Type: TypeInt}, Set: func(interface{}) int { return 0 }, @@ -3246,7 +3246,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Set element with no Set set": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeSet, Elem: &Schema{Type: TypeInt}, Optional: true, @@ -3257,7 +3257,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Required but computedWhen": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Required: true, ComputedWhen: []string{"foo"}, @@ -3268,11 +3268,11 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Conflicting attributes cannot be required": { map[string]*Schema{ - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Required: true, }, - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ConflictsWith: []string{"blacklist"}, @@ -3283,7 +3283,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Attribute with conflicts cannot be required": { map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Required: true, ConflictsWith: []string{"blacklist"}, @@ -3294,11 +3294,11 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "ConflictsWith cannot be used w/ ComputedWhen": { map[string]*Schema{ - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, ComputedWhen: []string{"foor"}, }, - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Required: true, ConflictsWith: []string{"blacklist"}, @@ -3309,7 +3309,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Sub-resource invalid": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Optional: true, Elem: &Resource{ @@ -3324,12 +3324,12 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Sub-resource valid": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeList, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -3342,7 +3342,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "ValidateFunc on non-primitive": { map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeSet, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { @@ -3355,7 +3355,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with AtLeastOneOf": { map[string]*Schema{ - "string_one": &Schema{ + "string_one": { Type: TypeString, Computed: true, AtLeastOneOf: []string{ @@ -3363,7 +3363,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "string_two", }, }, - "string_two": &Schema{ + "string_two": { Type: TypeString, Computed: true, AtLeastOneOf: []string{ @@ -3377,14 +3377,14 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with ConflictsWith": { map[string]*Schema{ - "string_one": &Schema{ + "string_one": { Type: TypeString, Computed: true, ConflictsWith: []string{ "string_two", }, }, - "string_two": &Schema{ + "string_two": { Type: TypeString, Computed: true, ConflictsWith: []string{ @@ -3397,7 +3397,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with Default": { map[string]*Schema{ - "string": &Schema{ + "string": { Type: TypeString, Computed: true, Default: "test", @@ -3408,7 +3408,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with DefaultFunc": { map[string]*Schema{ - "string": &Schema{ + "string": { Type: TypeString, Computed: true, DefaultFunc: func() (interface{}, error) { return nil, nil }, @@ -3419,7 +3419,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with DiffSuppressFunc": { map[string]*Schema{ - "string": &Schema{ + "string": { Type: TypeString, Computed: true, DiffSuppressFunc: func(k, old, new string, d *ResourceData) bool { return false }, @@ -3430,7 +3430,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with ExactlyOneOf": { map[string]*Schema{ - "string_one": &Schema{ + "string_one": { Type: TypeString, Computed: true, ExactlyOneOf: []string{ @@ -3438,7 +3438,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "string_two", }, }, - "string_two": &Schema{ + "string_two": { Type: TypeString, Computed: true, ExactlyOneOf: []string{ @@ -3452,7 +3452,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with InputDefault": { map[string]*Schema{ - "string": &Schema{ + "string": { Type: TypeString, Computed: true, InputDefault: "test", @@ -3463,7 +3463,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with MaxItems": { map[string]*Schema{ - "string": &Schema{ + "string": { Type: TypeList, Elem: &Schema{Type: TypeString}, Computed: true, @@ -3475,7 +3475,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with MinItems": { map[string]*Schema{ - "string": &Schema{ + "string": { Type: TypeList, Elem: &Schema{Type: TypeString}, Computed: true, @@ -3487,7 +3487,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with StateFunc": { map[string]*Schema{ - "string": &Schema{ + "string": { Type: TypeString, Computed: true, StateFunc: func(v interface{}) string { return "" }, @@ -3498,7 +3498,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "Computed-only with ValidateFunc": { map[string]*Schema{ - "string": &Schema{ + "string": { Type: TypeString, Computed: true, ValidateFunc: func(v interface{}, k string) ([]string, []error) { return nil, nil }, @@ -3509,7 +3509,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "invalid field name format #1": { map[string]*Schema{ - "with space": &Schema{ + "with space": { Type: TypeString, Optional: true, }, @@ -3519,7 +3519,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "invalid field name format #2": { map[string]*Schema{ - "WithCapitals": &Schema{ + "WithCapitals": { Type: TypeString, Optional: true, }, @@ -3529,7 +3529,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "invalid field name format of a Deprecated field": { map[string]*Schema{ - "WithCapitals": &Schema{ + "WithCapitals": { Type: TypeString, Optional: true, Deprecated: "Use with_underscores instead", @@ -3540,7 +3540,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "invalid field name format of a Removed field": { map[string]*Schema{ - "WithCapitals": &Schema{ + "WithCapitals": { Type: TypeString, Optional: true, Removed: "Use with_underscores instead", @@ -3551,7 +3551,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "ConfigModeBlock with Elem *Resource": { map[string]*Schema{ - "block": &Schema{ + "block": { Type: TypeList, ConfigMode: SchemaConfigModeBlock, Optional: true, @@ -3563,7 +3563,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "ConfigModeBlock Computed with Elem *Resource": { map[string]*Schema{ - "block": &Schema{ + "block": { Type: TypeList, ConfigMode: SchemaConfigModeBlock, Computed: true, @@ -3575,7 +3575,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "ConfigModeBlock with Elem *Schema": { map[string]*Schema{ - "block": &Schema{ + "block": { Type: TypeList, ConfigMode: SchemaConfigModeBlock, Optional: true, @@ -3589,7 +3589,7 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "ConfigModeBlock with no Elem": { map[string]*Schema{ - "block": &Schema{ + "block": { Type: TypeString, ConfigMode: SchemaConfigModeBlock, Optional: true, @@ -3600,13 +3600,13 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "ConfigModeBlock inside ConfigModeAttr": { map[string]*Schema{ - "block": &Schema{ + "block": { Type: TypeList, ConfigMode: SchemaConfigModeAttr, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "sub": &Schema{ + "sub": { Type: TypeList, ConfigMode: SchemaConfigModeBlock, Elem: &Resource{}, @@ -3620,13 +3620,13 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "ConfigModeAuto with *Resource inside ConfigModeAttr": { map[string]*Schema{ - "block": &Schema{ + "block": { Type: TypeList, ConfigMode: SchemaConfigModeAttr, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "sub": &Schema{ + "sub": { Type: TypeList, Elem: &Resource{}, }, @@ -3639,12 +3639,12 @@ func TestSchemaMap_InternalValidate(t *testing.T) { "TypeMap with Elem *Resource": { map[string]*Schema{ - "map": &Schema{ + "map": { Type: TypeMap, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "keynothandled": &Schema{ + "keynothandled": { Type: TypeString, Optional: true, }, @@ -3782,21 +3782,21 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { "Complex structure with set of computed string should mark root set as computed": { Schema: map[string]*Schema{ - "outer": &Schema{ + "outer": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "outer_str": &Schema{ + "outer_str": { Type: TypeString, Optional: true, }, - "inner": &Schema{ + "inner": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "inner_str": &Schema{ + "inner_str": { Type: TypeString, Optional: true, }, @@ -3831,19 +3831,19 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { ExpectedDiff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "outer.#": &terraform.ResourceAttrDiff{ + "outer.#": { Old: "0", New: "1", }, - "outer.~1.outer_str": &terraform.ResourceAttrDiff{ + "outer.~1.outer_str": { Old: "", New: "foo", }, - "outer.~1.inner.#": &terraform.ResourceAttrDiff{ + "outer.~1.inner.#": { Old: "0", New: "1", }, - "outer.~1.inner.~2.inner_str": &terraform.ResourceAttrDiff{ + "outer.~1.inner.~2.inner_str": { Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -3856,21 +3856,21 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { "Complex structure with complex list of computed string should mark root set as computed": { Schema: map[string]*Schema{ - "outer": &Schema{ + "outer": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "outer_str": &Schema{ + "outer_str": { Type: TypeString, Optional: true, }, - "inner": &Schema{ + "inner": { Type: TypeList, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "inner_str": &Schema{ + "inner_str": { Type: TypeString, Optional: true, }, @@ -3902,19 +3902,19 @@ func TestSchemaMap_DiffSuppress(t *testing.T) { ExpectedDiff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "outer.#": &terraform.ResourceAttrDiff{ + "outer.#": { Old: "0", New: "1", }, - "outer.~1.outer_str": &terraform.ResourceAttrDiff{ + "outer.~1.outer_str": { Old: "", New: "foo", }, - "outer.~1.inner.#": &terraform.ResourceAttrDiff{ + "outer.~1.inner.#": { Old: "0", New: "1", }, - "outer.~1.inner.0.inner_str": &terraform.ResourceAttrDiff{ + "outer.~1.inner.0.inner_str": { Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -3952,7 +3952,7 @@ func TestSchemaMap_Validate(t *testing.T) { }{ "Good": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -3967,7 +3967,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Good, because the var is not set and that error will come elsewhere": { Schema: map[string]*Schema{ - "size": &Schema{ + "size": { Type: TypeInt, Required: true, }, @@ -3980,7 +3980,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Required field not set": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Required: true, }, @@ -3993,7 +3993,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Invalid basic type": { Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeInt, Required: true, }, @@ -4008,7 +4008,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Invalid complex type": { Schema: map[string]*Schema{ - "user_data": &Schema{ + "user_data": { Type: TypeString, Optional: true, }, @@ -4027,7 +4027,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Bad type": { Schema: map[string]*Schema{ - "size": &Schema{ + "size": { Type: TypeInt, Required: true, }, @@ -4042,7 +4042,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Required but has DefaultFunc": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Required: true, DefaultFunc: func() (interface{}, error) { @@ -4056,7 +4056,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Required but has DefaultFunc return nil": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Required: true, DefaultFunc: func() (interface{}, error) { @@ -4072,11 +4072,11 @@ func TestSchemaMap_Validate(t *testing.T) { "Optional sub-resource": { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -4092,12 +4092,12 @@ func TestSchemaMap_Validate(t *testing.T) { "Sub-resource is the wrong type": { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Required: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -4115,12 +4115,12 @@ func TestSchemaMap_Validate(t *testing.T) { "Not a list nested block": { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -4141,7 +4141,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Not a list primitive": { Schema: map[string]*Schema{ - "strings": &Schema{ + "strings": { Type: TypeList, Optional: true, Elem: &Schema{ @@ -4162,7 +4162,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Unknown list": { Schema: map[string]*Schema{ - "strings": &Schema{ + "strings": { Type: TypeList, Optional: true, Elem: &Schema{ @@ -4180,7 +4180,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Unknown + Deprecation": { Schema: map[string]*Schema{ - "old_news": &Schema{ + "old_news": { Type: TypeString, Optional: true, Deprecated: "please use 'new_news' instead", @@ -4198,11 +4198,11 @@ func TestSchemaMap_Validate(t *testing.T) { "Required sub-resource field": { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -4222,12 +4222,12 @@ func TestSchemaMap_Validate(t *testing.T) { "Good sub-resource": { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -4249,12 +4249,12 @@ func TestSchemaMap_Validate(t *testing.T) { "Good sub-resource, computed value": { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Optional: true, }, @@ -4276,7 +4276,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Invalid/unknown field": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -4293,7 +4293,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Invalid/unknown field with computed value": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -4310,7 +4310,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Computed field set": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Computed: true, }, @@ -4325,7 +4325,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Not a set": { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -4344,7 +4344,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Maps": { Schema: map[string]*Schema{ - "user_data": &Schema{ + "user_data": { Type: TypeMap, Optional: true, }, @@ -4359,7 +4359,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Good map: data surrounded by extra slice": { Schema: map[string]*Schema{ - "user_data": &Schema{ + "user_data": { Type: TypeMap, Optional: true, }, @@ -4376,7 +4376,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Good map": { Schema: map[string]*Schema{ - "user_data": &Schema{ + "user_data": { Type: TypeMap, Optional: true, }, @@ -4391,7 +4391,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Map with type specified as value type": { Schema: map[string]*Schema{ - "user_data": &Schema{ + "user_data": { Type: TypeMap, Optional: true, Elem: TypeBool, @@ -4409,7 +4409,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Map with type specified as nested Schema": { Schema: map[string]*Schema{ - "user_data": &Schema{ + "user_data": { Type: TypeMap, Optional: true, Elem: &Schema{Type: TypeBool}, @@ -4427,7 +4427,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Bad map: just a slice": { Schema: map[string]*Schema{ - "user_data": &Schema{ + "user_data": { Type: TypeMap, Optional: true, }, @@ -4444,7 +4444,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Good set: config has slice with single interpolated value": { Schema: map[string]*Schema{ - "security_groups": &Schema{ + "security_groups": { Type: TypeSet, Optional: true, Computed: true, @@ -4465,7 +4465,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Bad set: config has single interpolated value": { Schema: map[string]*Schema{ - "security_groups": &Schema{ + "security_groups": { Type: TypeSet, Optional: true, Computed: true, @@ -4483,12 +4483,12 @@ func TestSchemaMap_Validate(t *testing.T) { "Bad, subresource should not allow unknown elements": { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeInt, Required: true, }, @@ -4511,12 +4511,12 @@ func TestSchemaMap_Validate(t *testing.T) { "Bad, subresource should not allow invalid types": { Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeInt, Required: true, }, @@ -4538,7 +4538,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Bad, should not allow lists to be assigned to string attributes": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Required: true, }, @@ -4553,7 +4553,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Bad, should not allow maps to be assigned to string attributes": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Required: true, }, @@ -4568,7 +4568,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Deprecated attribute usage generates warning, but not error": { Schema: map[string]*Schema{ - "old_news": &Schema{ + "old_news": { Type: TypeString, Optional: true, Deprecated: "please use 'new_news' instead", @@ -4588,7 +4588,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Deprecated generates no warnings if attr not used": { Schema: map[string]*Schema{ - "old_news": &Schema{ + "old_news": { Type: TypeString, Optional: true, Deprecated: "please use 'new_news' instead", @@ -4602,7 +4602,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Removed attribute usage generates error": { Schema: map[string]*Schema{ - "long_gone": &Schema{ + "long_gone": { Type: TypeString, Optional: true, Removed: "no longer supported by Cloud API", @@ -4621,7 +4621,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Removed generates no errors if attr not used": { Schema: map[string]*Schema{ - "long_gone": &Schema{ + "long_gone": { Type: TypeString, Optional: true, Removed: "no longer supported by Cloud API", @@ -4633,11 +4633,11 @@ func TestSchemaMap_Validate(t *testing.T) { "Conflicting attributes generate error": { Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeString, Optional: true, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeString, Optional: true, ConflictsWith: []string{"whitelist"}, @@ -4657,11 +4657,11 @@ func TestSchemaMap_Validate(t *testing.T) { "Conflicting attributes okay when unknown 1": { Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeString, Optional: true, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeString, Optional: true, ConflictsWith: []string{"whitelist"}, @@ -4678,12 +4678,12 @@ func TestSchemaMap_Validate(t *testing.T) { "Conflicting list attributes okay when unknown 1": { Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, @@ -4701,11 +4701,11 @@ func TestSchemaMap_Validate(t *testing.T) { "Conflicting attributes okay when unknown 2": { Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeString, Optional: true, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeString, Optional: true, ConflictsWith: []string{"whitelist"}, @@ -4722,17 +4722,17 @@ func TestSchemaMap_Validate(t *testing.T) { "Conflicting attributes generate error even if one is unknown": { Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeString, Optional: true, ConflictsWith: []string{"blacklist", "greenlist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeString, Optional: true, ConflictsWith: []string{"whitelist", "greenlist"}, }, - "greenlist": &Schema{ + "greenlist": { Type: TypeString, Optional: true, ConflictsWith: []string{"whitelist", "blacklist"}, @@ -4754,11 +4754,11 @@ func TestSchemaMap_Validate(t *testing.T) { "Required attribute & undefined conflicting optional are good": { Schema: map[string]*Schema{ - "required_att": &Schema{ + "required_att": { Type: TypeString, Required: true, }, - "optional_att": &Schema{ + "optional_att": { Type: TypeString, Optional: true, ConflictsWith: []string{"required_att"}, @@ -4774,11 +4774,11 @@ func TestSchemaMap_Validate(t *testing.T) { "Required conflicting attribute & defined optional generate error": { Schema: map[string]*Schema{ - "required_att": &Schema{ + "required_att": { Type: TypeString, Required: true, }, - "optional_att": &Schema{ + "optional_att": { Type: TypeString, Optional: true, ConflictsWith: []string{"required_att"}, @@ -4798,13 +4798,13 @@ func TestSchemaMap_Validate(t *testing.T) { "Computed + Optional fields conflicting with each other": { Schema: map[string]*Schema{ - "foo_att": &Schema{ + "foo_att": { Type: TypeString, Optional: true, Computed: true, ConflictsWith: []string{"bar_att"}, }, - "bar_att": &Schema{ + "bar_att": { Type: TypeString, Optional: true, Computed: true, @@ -4826,13 +4826,13 @@ func TestSchemaMap_Validate(t *testing.T) { "Computed + Optional fields NOT conflicting with each other": { Schema: map[string]*Schema{ - "foo_att": &Schema{ + "foo_att": { Type: TypeString, Optional: true, Computed: true, ConflictsWith: []string{"bar_att"}, }, - "bar_att": &Schema{ + "bar_att": { Type: TypeString, Optional: true, Computed: true, @@ -4849,13 +4849,13 @@ func TestSchemaMap_Validate(t *testing.T) { "Computed + Optional fields that conflict with none set": { Schema: map[string]*Schema{ - "foo_att": &Schema{ + "foo_att": { Type: TypeString, Optional: true, Computed: true, ConflictsWith: []string{"bar_att"}, }, - "bar_att": &Schema{ + "bar_att": { Type: TypeString, Optional: true, Computed: true, @@ -4870,7 +4870,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Good with ValidateFunc": { Schema: map[string]*Schema{ - "validate_me": &Schema{ + "validate_me": { Type: TypeString, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { @@ -4886,7 +4886,7 @@ func TestSchemaMap_Validate(t *testing.T) { "Bad with ValidateFunc": { Schema: map[string]*Schema{ - "validate_me": &Schema{ + "validate_me": { Type: TypeString, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { @@ -4906,7 +4906,7 @@ func TestSchemaMap_Validate(t *testing.T) { "ValidateFunc not called when type does not match": { Schema: map[string]*Schema{ - "number": &Schema{ + "number": { Type: TypeInt, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { @@ -4923,7 +4923,7 @@ func TestSchemaMap_Validate(t *testing.T) { "ValidateFunc gets decoded type": { Schema: map[string]*Schema{ - "maybe": &Schema{ + "maybe": { Type: TypeBool, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { @@ -4941,7 +4941,7 @@ func TestSchemaMap_Validate(t *testing.T) { "ValidateFunc is not called with a computed value": { Schema: map[string]*Schema{ - "validate_me": &Schema{ + "validate_me": { Type: TypeString, Required: true, ValidateFunc: func(v interface{}, k string) (ws []string, es []error) { @@ -4959,7 +4959,7 @@ func TestSchemaMap_Validate(t *testing.T) { "special timeouts field": { Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -5014,7 +5014,7 @@ func TestSchemaMap_Validate(t *testing.T) { // Invalid map values "invalid bool map value": { Schema: map[string]*Schema{ - "boolMap": &Schema{ + "boolMap": { Type: TypeMap, Elem: TypeBool, Optional: true, @@ -5029,7 +5029,7 @@ func TestSchemaMap_Validate(t *testing.T) { }, "invalid int map value": { Schema: map[string]*Schema{ - "intMap": &Schema{ + "intMap": { Type: TypeMap, Elem: TypeInt, Optional: true, @@ -5044,7 +5044,7 @@ func TestSchemaMap_Validate(t *testing.T) { }, "invalid float map value": { Schema: map[string]*Schema{ - "floatMap": &Schema{ + "floatMap": { Type: TypeMap, Elem: TypeFloat, Optional: true, @@ -5060,7 +5060,7 @@ func TestSchemaMap_Validate(t *testing.T) { "map with positive validate function": { Schema: map[string]*Schema{ - "floatInt": &Schema{ + "floatInt": { Type: TypeMap, Elem: TypeInt, Optional: true, @@ -5079,7 +5079,7 @@ func TestSchemaMap_Validate(t *testing.T) { }, "map with negative validate function": { Schema: map[string]*Schema{ - "floatInt": &Schema{ + "floatInt": { Type: TypeMap, Elem: TypeInt, Optional: true, @@ -5102,13 +5102,13 @@ func TestSchemaMap_Validate(t *testing.T) { // non-computed values. "set with partially computed list and map": { Schema: map[string]*Schema{ - "outer": &Schema{ + "outer": { Type: TypeSet, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "list": &Schema{ + "list": { Type: TypeList, Optional: true, Elem: &Schema{ @@ -5136,19 +5136,19 @@ func TestSchemaMap_Validate(t *testing.T) { }, "unexpected nils values": { Schema: map[string]*Schema{ - "strings": &Schema{ + "strings": { Type: TypeList, Optional: true, Elem: &Schema{ Type: TypeString, }, }, - "block": &Schema{ + "block": { Type: TypeList, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "int": &Schema{ + "int": { Type: TypeInt, Required: true, }, @@ -5215,7 +5215,7 @@ func TestSchemaSet_ValidateMaxItems(t *testing.T) { }{ "#0": { Schema: map[string]*Schema{ - "aliases": &Schema{ + "aliases": { Type: TypeSet, Optional: true, MaxItems: 1, @@ -5234,7 +5234,7 @@ func TestSchemaSet_ValidateMaxItems(t *testing.T) { }, "#1": { Schema: map[string]*Schema{ - "aliases": &Schema{ + "aliases": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeString}, @@ -5250,7 +5250,7 @@ func TestSchemaSet_ValidateMaxItems(t *testing.T) { }, "#2": { Schema: map[string]*Schema{ - "aliases": &Schema{ + "aliases": { Type: TypeSet, Optional: true, MaxItems: 1, @@ -5303,7 +5303,7 @@ func TestSchemaSet_ValidateMinItems(t *testing.T) { }{ "#0": { Schema: map[string]*Schema{ - "aliases": &Schema{ + "aliases": { Type: TypeSet, Optional: true, MinItems: 2, @@ -5320,7 +5320,7 @@ func TestSchemaSet_ValidateMinItems(t *testing.T) { }, "#1": { Schema: map[string]*Schema{ - "aliases": &Schema{ + "aliases": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeString}, @@ -5336,7 +5336,7 @@ func TestSchemaSet_ValidateMinItems(t *testing.T) { }, "#2": { Schema: map[string]*Schema{ - "aliases": &Schema{ + "aliases": { Type: TypeSet, Optional: true, MinItems: 2, @@ -5390,7 +5390,7 @@ func (e errorSort) Less(i, j int) bool { func TestSchemaMapDeepCopy(t *testing.T) { schema := map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, }, } @@ -5413,12 +5413,12 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "two attributes specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"blacklist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist"}, @@ -5435,12 +5435,12 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "one attributes specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"blacklist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist"}, @@ -5456,17 +5456,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "two attributes of three specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "blacklist"}, @@ -5483,17 +5483,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "one attributes of three specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "blacklist"}, @@ -5509,17 +5509,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "no attributes of three specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "blacklist"}, @@ -5533,17 +5533,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "Only Unknown Variable Value": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "blacklist"}, @@ -5559,17 +5559,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "Unknown Variable Value and Known Value": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "blacklist"}, @@ -5586,17 +5586,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "Unknown Variable Value and 2 Known Value": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, ExactlyOneOf: []string{"whitelist", "blacklist"}, @@ -5614,7 +5614,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "unknown list values": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeList, Optional: true, Elem: &Resource{ @@ -5634,7 +5634,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, Elem: &Resource{ @@ -5654,7 +5654,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeString, Optional: true, }, @@ -5678,7 +5678,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "partially known list values": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeList, Optional: true, Elem: &Resource{ @@ -5698,7 +5698,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, Elem: &Resource{ @@ -5718,7 +5718,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeString, Optional: true, }, @@ -5740,7 +5740,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "known list values": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeList, Optional: true, Elem: &Resource{ @@ -5760,7 +5760,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, Elem: &Resource{ @@ -5797,7 +5797,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "wholly unknown set values": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeSet, Optional: true, Elem: &Resource{ @@ -5817,7 +5817,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeSet, Optional: true, Elem: &Resource{ @@ -5837,7 +5837,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeString, Optional: true, }, @@ -5861,7 +5861,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "partially known set values": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeSet, Optional: true, Elem: &Resource{ @@ -5881,7 +5881,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeSet, Optional: true, Elem: &Resource{ @@ -5918,7 +5918,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "known set values": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeSet, Optional: true, Elem: &Resource{ @@ -5938,7 +5938,7 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { }, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeSet, Optional: true, Elem: &Resource{ @@ -5975,19 +5975,19 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "wholly unknown simple lists": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, ExactlyOneOf: []string{"allow", "deny"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeString, Optional: true, }, @@ -6011,13 +6011,13 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "partially known simple lists": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, @@ -6040,13 +6040,13 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "known simple lists": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, @@ -6068,17 +6068,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "wholly unknown map keys and values": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeMap, Optional: true, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, ExactlyOneOf: []string{"allow", "deny"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeString, Optional: true, }, @@ -6100,17 +6100,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "wholly unknown map values": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeMap, Optional: true, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, ExactlyOneOf: []string{"allow", "deny"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeString, Optional: true, }, @@ -6132,17 +6132,17 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "partially known maps": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeMap, Optional: true, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, ExactlyOneOf: []string{"allow", "deny"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeString, Optional: true, }, @@ -6164,12 +6164,12 @@ func TestValidateExactlyOneOfAttributes(t *testing.T) { "known maps": { Key: "allow", Schema: map[string]*Schema{ - "allow": &Schema{ + "allow": { Type: TypeMap, Optional: true, ExactlyOneOf: []string{"allow", "deny"}, }, - "deny": &Schema{ + "deny": { Type: TypeList, Optional: true, ExactlyOneOf: []string{"allow", "deny"}, @@ -6217,12 +6217,12 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "two attributes specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"blacklist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist"}, @@ -6239,12 +6239,12 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "one attributes specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"blacklist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist"}, @@ -6260,17 +6260,17 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "two attributes of three specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist"}, @@ -6287,17 +6287,17 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "three attributes of three specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist"}, @@ -6315,17 +6315,17 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "one attributes of three specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist"}, @@ -6341,17 +6341,17 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "no attributes of three specified": { Key: "whitelist", Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, @@ -6364,17 +6364,17 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "Only Unknown Variable Value": { Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, @@ -6390,13 +6390,13 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "only unknown list value": { Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, AtLeastOneOf: []string{"whitelist", "blacklist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeString}, @@ -6413,17 +6413,17 @@ func TestValidateAtLeastOneOfAttributes(t *testing.T) { "Unknown Variable Value and Known Value": { Schema: map[string]*Schema{ - "whitelist": &Schema{ + "whitelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, }, - "blacklist": &Schema{ + "blacklist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, }, - "purplelist": &Schema{ + "purplelist": { Type: TypeBool, Optional: true, AtLeastOneOf: []string{"whitelist", "blacklist", "purplelist"}, diff --git a/helper/schema/serialize_test.go b/helper/schema/serialize_test.go index c5480272038..efa01c95006 100644 --- a/helper/schema/serialize_test.go +++ b/helper/schema/serialize_test.go @@ -13,7 +13,7 @@ func TestSerializeForHash(t *testing.T) { } tests := []testCase{ - testCase{ + { Schema: &Schema{ Type: TypeInt, }, @@ -21,7 +21,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "0;", }, - testCase{ + { Schema: &Schema{ Type: TypeInt, }, @@ -29,7 +29,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "200;", }, - testCase{ + { Schema: &Schema{ Type: TypeBool, }, @@ -37,7 +37,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "1;", }, - testCase{ + { Schema: &Schema{ Type: TypeBool, }, @@ -45,7 +45,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "0;", }, - testCase{ + { Schema: &Schema{ Type: TypeFloat, }, @@ -53,7 +53,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "1;", }, - testCase{ + { Schema: &Schema{ Type: TypeFloat, }, @@ -61,7 +61,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "1.54;", }, - testCase{ + { Schema: &Schema{ Type: TypeFloat, }, @@ -69,7 +69,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "0.1;", }, - testCase{ + { Schema: &Schema{ Type: TypeString, }, @@ -77,7 +77,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "hello;", }, - testCase{ + { Schema: &Schema{ Type: TypeString, }, @@ -85,7 +85,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "1;", }, - testCase{ + { Schema: &Schema{ Type: TypeList, Elem: &Schema{ @@ -96,7 +96,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "();", }, - testCase{ + { Schema: &Schema{ Type: TypeList, Elem: &Schema{ @@ -107,16 +107,16 @@ func TestSerializeForHash(t *testing.T) { Expected: "(hello;world;);", }, - testCase{ + { Schema: &Schema{ Type: TypeList, Elem: &Resource{ Schema: map[string]*Schema{ - "fo": &Schema{ + "fo": { Type: TypeString, Required: true, }, - "fum": &Schema{ + "fum": { Type: TypeString, Required: true, }, @@ -135,7 +135,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "(;;);", }, - testCase{ + { Schema: &Schema{ Type: TypeSet, Elem: &Schema{ @@ -149,7 +149,7 @@ func TestSerializeForHash(t *testing.T) { Expected: "{woo;hello;};", }, - testCase{ + { Schema: &Schema{ Type: TypeMap, Elem: &Schema{ @@ -163,23 +163,23 @@ func TestSerializeForHash(t *testing.T) { Expected: "[baz:foo;foo:bar;];", }, - testCase{ + { Schema: &Resource{ Schema: map[string]*Schema{ - "name": &Schema{ + "name": { Type: TypeString, Required: true, }, - "size": &Schema{ + "size": { Type: TypeInt, Optional: true, }, - "green": &Schema{ + "green": { Type: TypeBool, Optional: true, Computed: true, }, - "upside_down": &Schema{ + "upside_down": { Type: TypeBool, Computed: true, }, @@ -194,10 +194,10 @@ func TestSerializeForHash(t *testing.T) { }, // test TypeMap nested in Schema: GH-7091 - testCase{ + { Schema: &Resource{ Schema: map[string]*Schema{ - "outer": &Schema{ + "outer": { Type: TypeSet, Required: true, Elem: &Schema{ @@ -218,14 +218,14 @@ func TestSerializeForHash(t *testing.T) { Expected: "outer:{[baz:foo;foo:bar;];};", }, - testCase{ + { Schema: &Resource{ Schema: map[string]*Schema{ - "attr1": &Schema{ + "attr1": { Type: TypeString, Computed: true, }, - "attr2": &Schema{ + "attr2": { Type: TypeString, Computed: true, }, diff --git a/helper/schema/shims_test.go b/helper/schema/shims_test.go index 40822942439..cb54eb10bdd 100644 --- a/helper/schema/shims_test.go +++ b/helper/schema/shims_test.go @@ -85,7 +85,7 @@ func TestShimResourcePlan_destroyCreate(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, ForceNew: true, @@ -95,7 +95,7 @@ func TestShimResourcePlan_destroyCreate(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { RequiresNew: true, Old: "3", New: "42", @@ -125,7 +125,7 @@ func TestShimResourceApply_create(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -143,7 +143,7 @@ func TestShimResourceApply_create(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "42", }, }, @@ -189,7 +189,7 @@ func TestShimResourceApply_Timeout_state(t *testing.T) { r := &Resource{ SchemaVersion: 2, Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -212,7 +212,7 @@ func TestShimResourceApply_Timeout_state(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "42", }, }, @@ -266,7 +266,7 @@ func TestShimResourceApply_Timeout_state(t *testing.T) { func TestShimResourceDiff_Timeout_diff(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -298,7 +298,7 @@ func TestShimResourceDiff_Timeout_diff(t *testing.T) { expected := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { New: "42", }, }, @@ -358,7 +358,7 @@ func TestShimResourceDiff_Timeout_diff(t *testing.T) { func TestShimResourceApply_destroy(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, }, @@ -401,13 +401,13 @@ func TestShimResourceApply_destroy(t *testing.T) { func TestShimResourceApply_destroyCreate(t *testing.T) { r := &Resource{ Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeInt, Optional: true, ForceNew: true, }, - "tags": &Schema{ + "tags": { Type: TypeMap, Optional: true, Computed: true, @@ -435,15 +435,15 @@ func TestShimResourceApply_destroyCreate(t *testing.T) { d := &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "id": &terraform.ResourceAttrDiff{ + "id": { New: "foo", }, - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "7", New: "42", RequiresNew: true, }, - "tags.Name": &terraform.ResourceAttrDiff{ + "tags.Name": { Old: "foo", New: "foo", RequiresNew: true, @@ -504,7 +504,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "diff-1", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -520,7 +520,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", RequiresNew: true, @@ -534,7 +534,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "diff-2", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -548,7 +548,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", NewComputed: true, RequiresNew: true, @@ -562,7 +562,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "diff-3", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -584,7 +584,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Computed, but set in config", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -604,7 +604,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "foo", New: "bar", }, @@ -617,7 +617,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Default", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Default: "foo", @@ -630,7 +630,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", }, @@ -643,7 +643,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "DefaultFunc, value", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, DefaultFunc: func() (interface{}, error) { @@ -658,7 +658,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo", }, @@ -671,7 +671,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "DefaultFunc, configuration set", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, DefaultFunc: func() (interface{}, error) { @@ -688,7 +688,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "bar", }, @@ -701,7 +701,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "String with StateFunc", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -719,7 +719,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "foo!", NewExtra: "foo", @@ -733,7 +733,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "StateFunc not called with nil value", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -750,7 +750,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "", NewComputed: true, @@ -764,7 +764,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Variable computed", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, }, @@ -778,7 +778,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -792,7 +792,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Int decode", Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, Computed: true, @@ -808,7 +808,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + "port": { Old: "", New: "27", RequiresNew: true, @@ -822,7 +822,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "bool decode", Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeBool, Optional: true, Computed: true, @@ -838,7 +838,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + "port": { Old: "", New: "false", RequiresNew: true, @@ -852,7 +852,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Bool", Schema: map[string]*Schema{ - "delete": &Schema{ + "delete": { Type: TypeBool, Optional: true, Default: false, @@ -876,7 +876,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "List decode", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -891,19 +891,19 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": { Old: "", New: "1", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "2", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "5", }, @@ -915,7 +915,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -930,19 +930,19 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": { Old: "", New: "1", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "2", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "5", }, @@ -954,7 +954,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -969,7 +969,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "", NewComputed: true, @@ -982,7 +982,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1011,7 +1011,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1033,11 +1033,11 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "2", New: "3", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "5", }, @@ -1050,7 +1050,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1066,22 +1066,22 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", RequiresNew: true, }, - "ports.0": &terraform.ResourceAttrDiff{ + "ports.0": { Old: "", New: "1", RequiresNew: true, }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "2", RequiresNew: true, }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "5", RequiresNew: true, @@ -1095,7 +1095,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Optional: true, Computed: true, @@ -1109,7 +1109,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "", NewComputed: true, }, @@ -1122,7 +1122,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "List with computed set", Schema: map[string]*Schema{ - "config": &Schema{ + "config": { Type: TypeList, Optional: true, ForceNew: true, @@ -1157,18 +1157,18 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config.#": &terraform.ResourceAttrDiff{ + "config.#": { Old: "0", New: "1", RequiresNew: true, }, - "config.0.name": &terraform.ResourceAttrDiff{ + "config.0.name": { Old: "", New: "hello", }, - "config.0.rules.#": &terraform.ResourceAttrDiff{ + "config.0.rules.#": { Old: "", NewComputed: true, }, @@ -1181,7 +1181,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-1", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1199,19 +1199,19 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", }, @@ -1224,7 +1224,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-2", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Computed: true, Required: true, @@ -1252,7 +1252,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-3", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -1269,7 +1269,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "", NewComputed: true, }, @@ -1282,7 +1282,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-4", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1300,19 +1300,19 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "0", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", }, @@ -1325,7 +1325,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-5", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1343,7 +1343,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "", New: "", NewComputed: true, @@ -1357,7 +1357,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-6", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, Elem: &Schema{Type: TypeInt}, @@ -1382,19 +1382,19 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { Old: "2", New: "3", }, - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", }, @@ -1407,7 +1407,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-8", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -1437,12 +1437,12 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-9", Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeSet, Required: true, Elem: &Resource{ Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeList, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -1491,12 +1491,12 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "List of structure decode", Schema: map[string]*Schema{ - "ingress": &Schema{ + "ingress": { Type: TypeList, Required: true, Elem: &Resource{ Schema: map[string]*Schema{ - "from": &Schema{ + "from": { Type: TypeInt, Required: true, }, @@ -1517,11 +1517,11 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ingress.#": &terraform.ResourceAttrDiff{ + "ingress.#": { Old: "0", New: "1", }, - "ingress.0.from": &terraform.ResourceAttrDiff{ + "ingress.0.from": { Old: "", New: "8080", }, @@ -1534,13 +1534,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "ComputedWhen", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Computed: true, ComputedWhen: []string{"port"}, }, - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, }, @@ -1566,13 +1566,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "computed", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Computed: true, ComputedWhen: []string{"port"}, }, - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, }, @@ -1586,10 +1586,10 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { NewComputed: true, }, - "port": &terraform.ResourceAttrDiff{ + "port": { New: "80", }, }, @@ -1601,13 +1601,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "computed, exists", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Computed: true, ComputedWhen: []string{"port"}, }, - "port": &Schema{ + "port": { Type: TypeInt, Optional: true, }, @@ -1633,7 +1633,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Maps-1", Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeMap, }, }, @@ -1648,12 +1648,12 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.%": &terraform.ResourceAttrDiff{ + "config_vars.%": { Old: "0", New: "1", }, - "config_vars.bar": &terraform.ResourceAttrDiff{ + "config_vars.bar": { Old: "", New: "baz", }, @@ -1666,7 +1666,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Maps-2", Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeMap, }, }, @@ -1687,11 +1687,11 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.foo": &terraform.ResourceAttrDiff{ + "config_vars.foo": { Old: "bar", NewRemoved: true, }, - "config_vars.bar": &terraform.ResourceAttrDiff{ + "config_vars.bar": { Old: "", New: "baz", }, @@ -1704,7 +1704,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Maps-3", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, Optional: true, Computed: true, @@ -1727,12 +1727,12 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.foo": &terraform.ResourceAttrDiff{ + "vars.foo": { Old: "bar", New: "", NewRemoved: true, }, - "vars.bar": &terraform.ResourceAttrDiff{ + "vars.bar": { Old: "", New: "baz", }, @@ -1745,7 +1745,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Maps-4", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, Computed: true, }, @@ -1769,7 +1769,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Maps-5", Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Elem: &Schema{Type: TypeMap}, }, @@ -1794,11 +1794,11 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + "config_vars.0.foo": { Old: "bar", NewRemoved: true, }, - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": { Old: "", New: "baz", }, @@ -1811,7 +1811,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Maps-6", Schema: map[string]*Schema{ - "config_vars": &Schema{ + "config_vars": { Type: TypeList, Elem: &Schema{Type: TypeMap}, Optional: true, @@ -1832,19 +1832,19 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config_vars.#": &terraform.ResourceAttrDiff{ + "config_vars.#": { Old: "1", New: "0", }, - "config_vars.0.%": &terraform.ResourceAttrDiff{ + "config_vars.0.%": { Old: "2", New: "0", }, - "config_vars.0.foo": &terraform.ResourceAttrDiff{ + "config_vars.0.foo": { Old: "bar", NewRemoved: true, }, - "config_vars.0.bar": &terraform.ResourceAttrDiff{ + "config_vars.0.bar": { Old: "baz", NewRemoved: true, }, @@ -1857,13 +1857,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "ForceNews", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, ForceNew: true, }, - "address": &Schema{ + "address": { Type: TypeString, Optional: true, Computed: true, @@ -1884,7 +1884,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "bar", New: "foo", RequiresNew: true, @@ -1898,13 +1898,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-10", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, ForceNew: true, }, - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -1930,7 +1930,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "bar", New: "foo", RequiresNew: true, @@ -1944,7 +1944,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-11", Schema: map[string]*Schema{ - "instances": &Schema{ + "instances": { Type: TypeSet, Elem: &Schema{Type: TypeString}, Optional: true, @@ -1968,7 +1968,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + "instances.#": { NewComputed: true, }, }, @@ -1980,17 +1980,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-12", Schema: map[string]*Schema{ - "route": &Schema{ + "route": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "gateway": &Schema{ + "gateway": { Type: TypeString, Optional: true, }, @@ -2016,15 +2016,15 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + "route.#": { Old: "0", New: "1", }, - "route.~1.index": &terraform.ResourceAttrDiff{ + "route.~1.index": { Old: "", New: "1", }, - "route.~1.gateway": &terraform.ResourceAttrDiff{ + "route.~1.gateway": { Old: "", New: hcl2shim.UnknownVariableValue, NewComputed: true, @@ -2038,17 +2038,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set-13", Schema: map[string]*Schema{ - "route": &Schema{ + "route": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "gateway": &Schema{ + "gateway": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -2080,15 +2080,15 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + "route.#": { Old: "0", New: "1", }, - "route.~1.index": &terraform.ResourceAttrDiff{ + "route.~1.index": { Old: "", New: "1", }, - "route.~1.gateway.#": &terraform.ResourceAttrDiff{ + "route.~1.gateway.#": { NewComputed: true, }, }, @@ -2100,7 +2100,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Computed maps", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, Computed: true, }, @@ -2112,7 +2112,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + "vars.%": { Old: "", NewComputed: true, }, @@ -2125,7 +2125,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Computed maps", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, Computed: true, }, @@ -2146,7 +2146,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + "vars.%": { Old: "", NewComputed: true, }, @@ -2172,7 +2172,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Float", Schema: map[string]*Schema{ - "some_threshold": &Schema{ + "some_threshold": { Type: TypeFloat, }, }, @@ -2190,7 +2190,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "some_threshold": &terraform.ResourceAttrDiff{ + "some_threshold": { Old: "567.8", New: "12.34", }, @@ -2203,17 +2203,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "https://github.com/hashicorp/terraform-plugin-sdk/issues/824", Schema: map[string]*Schema{ - "block_device": &Schema{ + "block_device": { Type: TypeSet, Optional: true, Computed: true, Elem: &Resource{ Schema: map[string]*Schema{ - "device_name": &Schema{ + "device_name": { Type: TypeString, Required: true, }, - "delete_on_termination": &Schema{ + "delete_on_termination": { Type: TypeBool, Optional: true, Default: true, @@ -2258,7 +2258,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Zero value in state shouldn't result in diff", Schema: map[string]*Schema{ - "port": &Schema{ + "port": { Type: TypeBool, Optional: true, ForceNew: true, @@ -2282,17 +2282,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Same as prev, but for sets", Schema: map[string]*Schema{ - "route": &Schema{ + "route": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "gateway": &Schema{ + "gateway": { Type: TypeSet, Optional: true, Elem: &Schema{Type: TypeInt}, @@ -2326,7 +2326,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "A set computed element shouldn't cause a diff", Schema: map[string]*Schema{ - "active": &Schema{ + "active": { Type: TypeBool, Computed: true, ForceNew: true, @@ -2350,7 +2350,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "An empty set should show up in the diff", Schema: map[string]*Schema{ - "instances": &Schema{ + "instances": { Type: TypeSet, Elem: &Schema{Type: TypeString}, Optional: true, @@ -2373,12 +2373,12 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.#": &terraform.ResourceAttrDiff{ + "instances.#": { Old: "1", New: "0", RequiresNew: true, }, - "instances.3": &terraform.ResourceAttrDiff{ + "instances.3": { Old: "foo", New: "", NewRemoved: true, @@ -2393,7 +2393,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Map with empty value", Schema: map[string]*Schema{ - "vars": &Schema{ + "vars": { Type: TypeMap, }, }, @@ -2408,11 +2408,11 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "vars.%": &terraform.ResourceAttrDiff{ + "vars.%": { Old: "0", New: "1", }, - "vars.foo": &terraform.ResourceAttrDiff{ + "vars.foo": { Old: "", New: "", }, @@ -2425,7 +2425,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Unset bool, not in state", Schema: map[string]*Schema{ - "force": &Schema{ + "force": { Type: TypeBool, Optional: true, ForceNew: true, @@ -2444,7 +2444,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Unset set, not in state", Schema: map[string]*Schema{ - "metadata_keys": &Schema{ + "metadata_keys": { Type: TypeSet, Optional: true, ForceNew: true, @@ -2465,7 +2465,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Unset list in state, should not show up computed", Schema: map[string]*Schema{ - "metadata_keys": &Schema{ + "metadata_keys": { Type: TypeList, Optional: true, Computed: true, @@ -2491,7 +2491,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Computed map without config that's known to be empty does not generate diff", Schema: map[string]*Schema{ - "tags": &Schema{ + "tags": { Type: TypeMap, Computed: true, }, @@ -2514,17 +2514,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set with hyphen keys", Schema: map[string]*Schema{ - "route": &Schema{ + "route": { Type: TypeSet, Optional: true, Elem: &Resource{ Schema: map[string]*Schema{ - "index": &Schema{ + "index": { Type: TypeInt, Required: true, }, - "gateway-name": &Schema{ + "gateway-name": { Type: TypeString, Optional: true, }, @@ -2550,15 +2550,15 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "route.#": &terraform.ResourceAttrDiff{ + "route.#": { Old: "0", New: "1", }, - "route.1.index": &terraform.ResourceAttrDiff{ + "route.1.index": { Old: "", New: "1", }, - "route.1.gateway-name": &terraform.ResourceAttrDiff{ + "route.1.gateway-name": { Old: "", New: "hello", }, @@ -2571,13 +2571,13 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "StateFunc in nested set (#1759)", Schema: map[string]*Schema{ - "service_account": &Schema{ + "service_account": { Type: TypeList, Optional: true, ForceNew: true, Elem: &Resource{ Schema: map[string]*Schema{ - "scopes": &Schema{ + "scopes": { Type: TypeSet, Required: true, ForceNew: true, @@ -2612,17 +2612,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "service_account.#": &terraform.ResourceAttrDiff{ + "service_account.#": { Old: "0", New: "1", RequiresNew: true, }, - "service_account.0.scopes.#": &terraform.ResourceAttrDiff{ + "service_account.0.scopes.#": { Old: "0", New: "1", RequiresNew: true, }, - "service_account.0.scopes.123": &terraform.ResourceAttrDiff{ + "service_account.0.scopes.123": { Old: "", New: "123!", NewExtra: "123", @@ -2637,7 +2637,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Removing set elements", Schema: map[string]*Schema{ - "instances": &Schema{ + "instances": { Type: TypeSet, Elem: &Schema{Type: TypeString}, Optional: true, @@ -2663,17 +2663,17 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "instances.2": &terraform.ResourceAttrDiff{ + "instances.2": { Old: "22", New: "", NewRemoved: true, RequiresNew: true, }, - "instances.3": &terraform.ResourceAttrDiff{ + "instances.3": { Old: "333", New: "333", }, - "instances.4": &terraform.ResourceAttrDiff{ + "instances.4": { Old: "", New: "4444", RequiresNew: true, @@ -2687,15 +2687,15 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Bools can be set with 0/1 in config, still get true/false", Schema: map[string]*Schema{ - "one": &Schema{ + "one": { Type: TypeBool, Optional: true, }, - "two": &Schema{ + "two": { Type: TypeBool, Optional: true, }, - "three": &Schema{ + "three": { Type: TypeBool, Optional: true, }, @@ -2717,15 +2717,15 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "one": &terraform.ResourceAttrDiff{ + "one": { Old: "false", New: "true", }, - "two": &terraform.ResourceAttrDiff{ + "two": { Old: "true", New: "false", }, - "three": &terraform.ResourceAttrDiff{ + "three": { Old: "true", New: "false", NewRemoved: true, @@ -2759,7 +2759,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set ForceNew only marks the changing element as ForceNew", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, ForceNew: true, @@ -2786,20 +2786,20 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", RequiresNew: true, }, - "ports.4": &terraform.ResourceAttrDiff{ + "ports.4": { Old: "4", New: "0", NewRemoved: true, @@ -2812,7 +2812,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "removed optional items should trigger ForceNew", Schema: map[string]*Schema{ - "description": &Schema{ + "description": { Type: TypeString, ForceNew: true, Optional: true, @@ -2830,7 +2830,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "description": &terraform.ResourceAttrDiff{ + "description": { Old: "foo", New: "", RequiresNew: true, @@ -2846,7 +2846,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "computed value for boolean field", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeBool, ForceNew: true, Computed: true, @@ -2864,7 +2864,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "foo": &terraform.ResourceAttrDiff{ + "foo": { Old: "", New: "false", NewComputed: true, @@ -2879,7 +2879,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set ForceNew marks count as ForceNew if computed", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Required: true, ForceNew: true, @@ -2906,7 +2906,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.#": &terraform.ResourceAttrDiff{ + "ports.#": { NewComputed: true, RequiresNew: true, }, @@ -2917,7 +2917,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "List with computed schema and ForceNew", Schema: map[string]*Schema{ - "config": &Schema{ + "config": { Type: TypeList, Optional: true, ForceNew: true, @@ -2942,7 +2942,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "config.#": &terraform.ResourceAttrDiff{ + "config.#": { Old: "2", New: "", RequiresNew: true, @@ -2957,7 +2957,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "overridden diff with a CustomizeDiff function, ForceNew not in schema", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -2982,7 +2982,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "bar", RequiresNew: true, @@ -3000,7 +3000,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { // intended diff still shows up. Name: "overridden removed attribute diff with a CustomizeDiff function, ForceNew not in schema", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -3023,7 +3023,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "bar", RequiresNew: true, @@ -3038,7 +3038,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Name: "overridden diff with a CustomizeDiff function, ForceNew in schema", Schema: map[string]*Schema{ - "availability_zone": &Schema{ + "availability_zone": { Type: TypeString, Optional: true, Computed: true, @@ -3061,7 +3061,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "availability_zone": &terraform.ResourceAttrDiff{ + "availability_zone": { Old: "", New: "bar", RequiresNew: true, @@ -3075,11 +3075,11 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "required field with computed diff added with CustomizeDiff function", Schema: map[string]*Schema{ - "ami_id": &Schema{ + "ami_id": { Type: TypeString, Required: true, }, - "instance_id": &Schema{ + "instance_id": { Type: TypeString, Computed: true, }, @@ -3100,11 +3100,11 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ami_id": &terraform.ResourceAttrDiff{ + "ami_id": { Old: "", New: "foo", }, - "instance_id": &terraform.ResourceAttrDiff{ + "instance_id": { Old: "", New: "bar", }, @@ -3117,7 +3117,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "Set ForceNew only marks the changing element as ForceNew - CustomizeDiffFunc edition", Schema: map[string]*Schema{ - "ports": &Schema{ + "ports": { Type: TypeSet, Optional: true, Computed: true, @@ -3154,20 +3154,20 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "ports.1": &terraform.ResourceAttrDiff{ + "ports.1": { Old: "1", New: "1", }, - "ports.2": &terraform.ResourceAttrDiff{ + "ports.2": { Old: "2", New: "2", }, - "ports.5": &terraform.ResourceAttrDiff{ + "ports.5": { Old: "", New: "5", RequiresNew: true, }, - "ports.4": &terraform.ResourceAttrDiff{ + "ports.4": { Old: "4", New: "0", NewRemoved: true, @@ -3206,12 +3206,12 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "NewComputed based on a conditional with CustomizeDiffFunc", Schema: map[string]*Schema{ - "etag": &Schema{ + "etag": { Type: TypeString, Optional: true, Computed: true, }, - "version_id": &Schema{ + "version_id": { Type: TypeString, Computed: true, }, @@ -3238,11 +3238,11 @@ func TestShimSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "etag": &terraform.ResourceAttrDiff{ + "etag": { Old: "foo", New: "bar", }, - "version_id": &terraform.ResourceAttrDiff{ + "version_id": { Old: "1", New: "", NewComputed: true, @@ -3256,7 +3256,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "vetoing a diff", Schema: map[string]*Schema{ - "foo": &Schema{ + "foo": { Type: TypeString, Optional: true, Computed: true, @@ -3286,7 +3286,7 @@ func TestShimSchemaMap_Diff(t *testing.T) { { Name: "optional, computed, empty string", Schema: map[string]*Schema{ - "attr": &Schema{ + "attr": { Type: TypeString, Optional: true, Computed: true, diff --git a/internal/configs/configschema/decoder_spec_test.go b/internal/configs/configschema/decoder_spec_test.go index 8189160b8fe..3bffc553591 100644 --- a/internal/configs/configschema/decoder_spec_test.go +++ b/internal/configs/configschema/decoder_spec_test.go @@ -204,13 +204,13 @@ func TestBlockDecoderSpec(t *testing.T) { &hcl.Block{ Type: "map", Labels: []string{"foo"}, - LabelRanges: []hcl.Range{hcl.Range{}}, + LabelRanges: []hcl.Range{{}}, Body: hcl.EmptyBody(), }, &hcl.Block{ Type: "map", Labels: []string{"bar"}, - LabelRanges: []hcl.Range{hcl.Range{}}, + LabelRanges: []hcl.Range{{}}, Body: hcl.EmptyBody(), }, &hcl.Block{ @@ -291,13 +291,13 @@ func TestBlockDecoderSpec(t *testing.T) { &hcl.Block{ Type: "map", Labels: []string{"foo"}, - LabelRanges: []hcl.Range{hcl.Range{}}, + LabelRanges: []hcl.Range{{}}, Body: hcl.EmptyBody(), }, &hcl.Block{ Type: "map", Labels: []string{"bar"}, - LabelRanges: []hcl.Range{hcl.Range{}}, + LabelRanges: []hcl.Range{{}}, Body: hcl.EmptyBody(), }, }, diff --git a/internal/configs/configschema/implied_type_test.go b/internal/configs/configschema/implied_type_test.go index 85e4a88d552..b7bdd1d92ed 100644 --- a/internal/configs/configschema/implied_type_test.go +++ b/internal/configs/configschema/implied_type_test.go @@ -50,7 +50,7 @@ func TestBlockImpliedType(t *testing.T) { "blocks": { &Block{ BlockTypes: map[string]*NestedBlock{ - "single": &NestedBlock{ + "single": { Nesting: NestingSingle, Block: Block{ Attributes: map[string]*Attribute{ @@ -61,13 +61,13 @@ func TestBlockImpliedType(t *testing.T) { }, }, }, - "list": &NestedBlock{ + "list": { Nesting: NestingList, }, - "set": &NestedBlock{ + "set": { Nesting: NestingSet, }, - "map": &NestedBlock{ + "map": { Nesting: NestingMap, }, }, @@ -84,15 +84,15 @@ func TestBlockImpliedType(t *testing.T) { "deep block nesting": { &Block{ BlockTypes: map[string]*NestedBlock{ - "single": &NestedBlock{ + "single": { Nesting: NestingSingle, Block: Block{ BlockTypes: map[string]*NestedBlock{ - "list": &NestedBlock{ + "list": { Nesting: NestingList, Block: Block{ BlockTypes: map[string]*NestedBlock{ - "set": &NestedBlock{ + "set": { Nesting: NestingSet, }, }, diff --git a/internal/configs/configschema/internal_validate_test.go b/internal/configs/configschema/internal_validate_test.go index 93ac7f6872e..1e1a5198fbb 100644 --- a/internal/configs/configschema/internal_validate_test.go +++ b/internal/configs/configschema/internal_validate_test.go @@ -19,54 +19,54 @@ func TestBlockInternalValidate(t *testing.T) { "valid": { &Block{ Attributes: map[string]*Attribute{ - "foo": &Attribute{ + "foo": { Type: cty.String, Required: true, }, - "bar": &Attribute{ + "bar": { Type: cty.String, Optional: true, }, - "baz": &Attribute{ + "baz": { Type: cty.String, Computed: true, }, - "baz_maybe": &Attribute{ + "baz_maybe": { Type: cty.String, Optional: true, Computed: true, }, }, BlockTypes: map[string]*NestedBlock{ - "single": &NestedBlock{ + "single": { Nesting: NestingSingle, Block: Block{}, }, - "single_required": &NestedBlock{ + "single_required": { Nesting: NestingSingle, Block: Block{}, MinItems: 1, MaxItems: 1, }, - "list": &NestedBlock{ + "list": { Nesting: NestingList, Block: Block{}, }, - "list_required": &NestedBlock{ + "list_required": { Nesting: NestingList, Block: Block{}, MinItems: 1, }, - "set": &NestedBlock{ + "set": { Nesting: NestingSet, Block: Block{}, }, - "set_required": &NestedBlock{ + "set_required": { Nesting: NestingSet, Block: Block{}, MinItems: 1, }, - "map": &NestedBlock{ + "map": { Nesting: NestingMap, Block: Block{}, }, @@ -77,7 +77,7 @@ func TestBlockInternalValidate(t *testing.T) { "attribute with no flags set": { &Block{ Attributes: map[string]*Attribute{ - "foo": &Attribute{ + "foo": { Type: cty.String, }, }, @@ -87,7 +87,7 @@ func TestBlockInternalValidate(t *testing.T) { "attribute required and optional": { &Block{ Attributes: map[string]*Attribute{ - "foo": &Attribute{ + "foo": { Type: cty.String, Required: true, Optional: true, @@ -99,7 +99,7 @@ func TestBlockInternalValidate(t *testing.T) { "attribute required and computed": { &Block{ Attributes: map[string]*Attribute{ - "foo": &Attribute{ + "foo": { Type: cty.String, Required: true, Computed: true, @@ -111,7 +111,7 @@ func TestBlockInternalValidate(t *testing.T) { "attribute optional and computed": { &Block{ Attributes: map[string]*Attribute{ - "foo": &Attribute{ + "foo": { Type: cty.String, Optional: true, Computed: true, @@ -123,7 +123,7 @@ func TestBlockInternalValidate(t *testing.T) { "attribute with missing type": { &Block{ Attributes: map[string]*Attribute{ - "foo": &Attribute{ + "foo": { Optional: true, }, }, @@ -133,7 +133,7 @@ func TestBlockInternalValidate(t *testing.T) { "attribute with invalid name": { &Block{ Attributes: map[string]*Attribute{ - "fooBar": &Attribute{ + "fooBar": { Type: cty.String, Optional: true, }, @@ -144,7 +144,7 @@ func TestBlockInternalValidate(t *testing.T) { "block type with invalid name": { &Block{ BlockTypes: map[string]*NestedBlock{ - "fooBar": &NestedBlock{ + "fooBar": { Nesting: NestingSingle, }, }, @@ -154,13 +154,13 @@ func TestBlockInternalValidate(t *testing.T) { "colliding names": { &Block{ Attributes: map[string]*Attribute{ - "foo": &Attribute{ + "foo": { Type: cty.String, Optional: true, }, }, BlockTypes: map[string]*NestedBlock{ - "foo": &NestedBlock{ + "foo": { Nesting: NestingSingle, }, }, @@ -170,11 +170,11 @@ func TestBlockInternalValidate(t *testing.T) { "nested block with badness": { &Block{ BlockTypes: map[string]*NestedBlock{ - "bad": &NestedBlock{ + "bad": { Nesting: NestingSingle, Block: Block{ Attributes: map[string]*Attribute{ - "nested_bad": &Attribute{ + "nested_bad": { Type: cty.String, Required: true, Optional: true, @@ -189,11 +189,11 @@ func TestBlockInternalValidate(t *testing.T) { "nested list block with dynamically-typed attribute": { &Block{ BlockTypes: map[string]*NestedBlock{ - "bad": &NestedBlock{ + "bad": { Nesting: NestingList, Block: Block{ Attributes: map[string]*Attribute{ - "nested_bad": &Attribute{ + "nested_bad": { Type: cty.DynamicPseudoType, Optional: true, }, @@ -207,11 +207,11 @@ func TestBlockInternalValidate(t *testing.T) { "nested set block with dynamically-typed attribute": { &Block{ BlockTypes: map[string]*NestedBlock{ - "bad": &NestedBlock{ + "bad": { Nesting: NestingSet, Block: Block{ Attributes: map[string]*Attribute{ - "nested_bad": &Attribute{ + "nested_bad": { Type: cty.DynamicPseudoType, Optional: true, }, diff --git a/internal/configs/configschema/schema.go b/internal/configs/configschema/schema.go index f4702d369ed..b41a3096889 100644 --- a/internal/configs/configschema/schema.go +++ b/internal/configs/configschema/schema.go @@ -4,6 +4,17 @@ import ( "github.com/zclconf/go-cty/cty" ) +// StringKind represents the format a string is in. +type StringKind int + +const ( + // StringPlain indicates a string is plain-text and requires no processing for display. + StringPlain StringKind = iota + // StringMarkdown indicates a string is in markdown format and may + // require additional processing to display. + StringMarkdown +) + // Block represents a configuration block. // // "Block" here is a logical grouping construct, though it happens to map @@ -21,6 +32,15 @@ type Block struct { // BlockTypes describes any nested block types that may appear directly // inside the block. BlockTypes map[string]*NestedBlock + + // Description and DescriptionKind contain a user facing description of the block + // and the format of that string. + Description string + DescriptionKind StringKind + + // Deprecated indicates whether the block has been marked as deprecated in the + // provider and usage should be discouraged. + Deprecated bool } // Attribute represents a configuration attribute, within a block. @@ -32,7 +52,8 @@ type Attribute struct { // usage of the attribute. A description should be concise and use only // one or two sentences, leaving full definition to longer-form // documentation defined elsewhere. - Description string + Description string + DescriptionKind StringKind // Required, if set to true, specifies that an omitted or null value is // not permitted. @@ -55,6 +76,10 @@ type Attribute struct { // future to help Terraform mask sensitive information. (Terraform // currently achieves this in a limited sense via other mechanisms.) Sensitive bool + + // Deprecated indicates whether the attribute has been marked as deprecated in the + // provider and usage should be discouraged. + Deprecated bool } // NestedBlock represents the embedding of one block within another. diff --git a/internal/configs/hcl2shim/paths_test.go b/internal/configs/hcl2shim/paths_test.go index 4933fa691c8..d9cf3712a47 100644 --- a/internal/configs/hcl2shim/paths_test.go +++ b/internal/configs/hcl2shim/paths_test.go @@ -246,7 +246,7 @@ func TestRequiresReplace(t *testing.T) { "foo": cty.String, }), expected: []cty.Path{ - cty.Path{cty.GetAttrStep{Name: "foo"}}, + {cty.GetAttrStep{Name: "foo"}}, }, }, { @@ -260,8 +260,8 @@ func TestRequiresReplace(t *testing.T) { "bar": cty.String, }), expected: []cty.Path{ - cty.Path{cty.GetAttrStep{Name: "foo"}}, - cty.Path{cty.GetAttrStep{Name: "bar"}}, + {cty.GetAttrStep{Name: "foo"}}, + {cty.GetAttrStep{Name: "bar"}}, }, }, { @@ -275,7 +275,7 @@ func TestRequiresReplace(t *testing.T) { }), }), expected: []cty.Path{ - cty.Path{cty.GetAttrStep{Name: "foo"}, cty.GetAttrStep{Name: "bar"}}, + {cty.GetAttrStep{Name: "foo"}, cty.GetAttrStep{Name: "bar"}}, }, }, { @@ -291,7 +291,7 @@ func TestRequiresReplace(t *testing.T) { }), }), expected: []cty.Path{ - cty.Path{cty.GetAttrStep{Name: "foo"}, cty.GetAttrStep{Name: "bar"}, cty.GetAttrStep{Name: "baz"}}, + {cty.GetAttrStep{Name: "foo"}, cty.GetAttrStep{Name: "bar"}, cty.GetAttrStep{Name: "baz"}}, }, }, { @@ -304,7 +304,7 @@ func TestRequiresReplace(t *testing.T) { "foo": cty.Map(cty.String), }), expected: []cty.Path{ - cty.Path{cty.GetAttrStep{Name: "foo"}}, + {cty.GetAttrStep{Name: "foo"}}, }, }, { @@ -317,7 +317,7 @@ func TestRequiresReplace(t *testing.T) { "foo": cty.Map(cty.String), }), expected: []cty.Path{ - cty.Path{cty.GetAttrStep{Name: "foo"}}, + {cty.GetAttrStep{Name: "foo"}}, }, }, { @@ -333,7 +333,7 @@ func TestRequiresReplace(t *testing.T) { )), }), expected: []cty.Path{ - cty.Path{cty.GetAttrStep{Name: "foo"}, cty.IndexStep{Key: cty.StringVal("bar")}, cty.GetAttrStep{Name: "baz"}}, + {cty.GetAttrStep{Name: "foo"}, cty.IndexStep{Key: cty.StringVal("bar")}, cty.GetAttrStep{Name: "baz"}}, }, }, { @@ -349,7 +349,7 @@ func TestRequiresReplace(t *testing.T) { )), }), expected: []cty.Path{ - cty.Path{cty.GetAttrStep{Name: "foo"}, cty.IndexStep{Key: cty.NumberIntVal(1)}, cty.GetAttrStep{Name: "baz"}}, + {cty.GetAttrStep{Name: "foo"}, cty.IndexStep{Key: cty.NumberIntVal(1)}, cty.GetAttrStep{Name: "baz"}}, }, }, } { diff --git a/internal/helper/plugin/grpc_provider_test.go b/internal/helper/plugin/grpc_provider_test.go index 7fb2cb2e13c..8204a014be8 100644 --- a/internal/helper/plugin/grpc_provider_test.go +++ b/internal/helper/plugin/grpc_provider_test.go @@ -660,7 +660,7 @@ func TestPrepareProviderConfig(t *testing.T) { { Name: "test prepare", Schema: map[string]*schema.Schema{ - "foo": &schema.Schema{ + "foo": { Type: schema.TypeString, Optional: true, }, @@ -675,7 +675,7 @@ func TestPrepareProviderConfig(t *testing.T) { { Name: "test default", Schema: map[string]*schema.Schema{ - "foo": &schema.Schema{ + "foo": { Type: schema.TypeString, Optional: true, Default: "default", @@ -691,7 +691,7 @@ func TestPrepareProviderConfig(t *testing.T) { { Name: "test defaultfunc", Schema: map[string]*schema.Schema{ - "foo": &schema.Schema{ + "foo": { Type: schema.TypeString, Optional: true, DefaultFunc: func() (interface{}, error) { @@ -709,7 +709,7 @@ func TestPrepareProviderConfig(t *testing.T) { { Name: "test default required", Schema: map[string]*schema.Schema{ - "foo": &schema.Schema{ + "foo": { Type: schema.TypeString, Required: true, DefaultFunc: func() (interface{}, error) { @@ -727,7 +727,7 @@ func TestPrepareProviderConfig(t *testing.T) { { Name: "test incorrect type", Schema: map[string]*schema.Schema{ - "foo": &schema.Schema{ + "foo": { Type: schema.TypeString, Required: true, }, @@ -742,7 +742,7 @@ func TestPrepareProviderConfig(t *testing.T) { { Name: "test incorrect default type", Schema: map[string]*schema.Schema{ - "foo": &schema.Schema{ + "foo": { Type: schema.TypeString, Optional: true, Default: true, @@ -758,7 +758,7 @@ func TestPrepareProviderConfig(t *testing.T) { { Name: "test incorrect default bool type", Schema: map[string]*schema.Schema{ - "foo": &schema.Schema{ + "foo": { Type: schema.TypeBool, Optional: true, Default: "", @@ -774,7 +774,7 @@ func TestPrepareProviderConfig(t *testing.T) { { Name: "test deprecated default", Schema: map[string]*schema.Schema{ - "foo": &schema.Schema{ + "foo": { Type: schema.TypeString, Optional: true, Default: "do not use", diff --git a/internal/helper/plugin/unknown_test.go b/internal/helper/plugin/unknown_test.go index 5ed9f79626c..a0d2782b1ad 100644 --- a/internal/helper/plugin/unknown_test.go +++ b/internal/helper/plugin/unknown_test.go @@ -68,7 +68,7 @@ func TestSetUnknowns(t *testing.T) { // if the object has no computed attributes, it should stay null &configschema.Block{ Attributes: map[string]*configschema.Attribute{ - "foo": &configschema.Attribute{ + "foo": { Type: cty.String, }, }, @@ -104,7 +104,7 @@ func TestSetUnknowns(t *testing.T) { // the set value should remain null &configschema.Block{ Attributes: map[string]*configschema.Attribute{ - "foo": &configschema.Attribute{ + "foo": { Type: cty.String, Computed: true, }, diff --git a/internal/plugin/convert/schema.go b/internal/plugin/convert/schema.go index 3105011ff9c..4921ebab2e9 100644 --- a/internal/plugin/convert/schema.go +++ b/internal/plugin/convert/schema.go @@ -2,6 +2,7 @@ package convert import ( "encoding/json" + "log" "reflect" "sort" @@ -12,17 +13,24 @@ import ( // ConfigSchemaToProto takes a *configschema.Block and converts it to a // proto.Schema_Block for a grpc response. func ConfigSchemaToProto(b *configschema.Block) *proto.Schema_Block { - block := &proto.Schema_Block{} + block := &proto.Schema_Block{ + Description: b.Description, + DescriptionKind: protoStringKind(b.DescriptionKind), + Deprecated: b.Deprecated, + } for _, name := range sortedKeys(b.Attributes) { a := b.Attributes[name] + attr := &proto.Schema_Attribute{ - Name: name, - Description: a.Description, - Optional: a.Optional, - Computed: a.Computed, - Required: a.Required, - Sensitive: a.Sensitive, + Name: name, + Description: a.Description, + DescriptionKind: protoStringKind(a.DescriptionKind), + Optional: a.Optional, + Computed: a.Computed, + Required: a.Required, + Sensitive: a.Sensitive, + Deprecated: a.Deprecated, } ty, err := json.Marshal(a.Type) @@ -43,6 +51,18 @@ func ConfigSchemaToProto(b *configschema.Block) *proto.Schema_Block { return block } +func protoStringKind(k configschema.StringKind) proto.StringKind { + switch k { + default: + log.Printf("[TRACE] unexpected configschema.StringKind: %d", k) + return proto.StringKind_PLAIN + case configschema.StringPlain: + return proto.StringKind_PLAIN + case configschema.StringMarkdown: + return proto.StringKind_MARKDOWN + } +} + func protoSchemaNestedBlock(name string, b *configschema.NestedBlock) *proto.Schema_NestedBlock { var nesting proto.Schema_NestedBlock_NestingMode switch b.Nesting { @@ -74,15 +94,21 @@ func ProtoToConfigSchema(b *proto.Schema_Block) *configschema.Block { block := &configschema.Block{ Attributes: make(map[string]*configschema.Attribute), BlockTypes: make(map[string]*configschema.NestedBlock), + + Description: b.Description, + DescriptionKind: schemaStringKind(b.DescriptionKind), + Deprecated: b.Deprecated, } for _, a := range b.Attributes { attr := &configschema.Attribute{ - Description: a.Description, - Required: a.Required, - Optional: a.Optional, - Computed: a.Computed, - Sensitive: a.Sensitive, + Description: a.Description, + DescriptionKind: schemaStringKind(a.DescriptionKind), + Required: a.Required, + Optional: a.Optional, + Computed: a.Computed, + Sensitive: a.Sensitive, + Deprecated: a.Deprecated, } if err := json.Unmarshal(a.Type, &attr.Type); err != nil { @@ -99,6 +125,18 @@ func ProtoToConfigSchema(b *proto.Schema_Block) *configschema.Block { return block } +func schemaStringKind(k proto.StringKind) configschema.StringKind { + switch k { + default: + log.Printf("[TRACE] unexpected proto.StringKind: %d", k) + return configschema.StringPlain + case proto.StringKind_PLAIN: + return configschema.StringPlain + case proto.StringKind_MARKDOWN: + return configschema.StringMarkdown + } +} + func schemaNestedBlock(b *proto.Schema_NestedBlock) *configschema.NestedBlock { var nesting configschema.NestingMode switch b.Nesting { diff --git a/internal/plugin/convert/schema_test.go b/internal/plugin/convert/schema_test.go index eeaf96f6ca1..c48d0485a63 100644 --- a/internal/plugin/convert/schema_test.go +++ b/internal/plugin/convert/schema_test.go @@ -106,16 +106,16 @@ func TestConvertSchemaBlocks(t *testing.T) { }, &configschema.Block{ BlockTypes: map[string]*configschema.NestedBlock{ - "list": &configschema.NestedBlock{ + "list": { Nesting: configschema.NestingList, }, - "map": &configschema.NestedBlock{ + "map": { Nesting: configschema.NestingMap, }, - "set": &configschema.NestedBlock{ + "set": { Nesting: configschema.NestingSet, }, - "single": &configschema.NestedBlock{ + "single": { Nesting: configschema.NestingSingle, Block: configschema.Block{ Attributes: map[string]*configschema.Attribute{ @@ -157,15 +157,15 @@ func TestConvertSchemaBlocks(t *testing.T) { }, &configschema.Block{ BlockTypes: map[string]*configschema.NestedBlock{ - "single": &configschema.NestedBlock{ + "single": { Nesting: configschema.NestingSingle, Block: configschema.Block{ BlockTypes: map[string]*configschema.NestedBlock{ - "list": &configschema.NestedBlock{ + "list": { Nesting: configschema.NestingList, Block: configschema.Block{ BlockTypes: map[string]*configschema.NestedBlock{ - "set": &configschema.NestedBlock{ + "set": { Nesting: configschema.NestingSet, }, }, @@ -278,16 +278,16 @@ func TestConvertProtoSchemaBlocks(t *testing.T) { }, &configschema.Block{ BlockTypes: map[string]*configschema.NestedBlock{ - "list": &configschema.NestedBlock{ + "list": { Nesting: configschema.NestingList, }, - "map": &configschema.NestedBlock{ + "map": { Nesting: configschema.NestingMap, }, - "set": &configschema.NestedBlock{ + "set": { Nesting: configschema.NestingSet, }, - "single": &configschema.NestedBlock{ + "single": { Nesting: configschema.NestingSingle, Block: configschema.Block{ Attributes: map[string]*configschema.Attribute{ @@ -329,15 +329,15 @@ func TestConvertProtoSchemaBlocks(t *testing.T) { }, &configschema.Block{ BlockTypes: map[string]*configschema.NestedBlock{ - "single": &configschema.NestedBlock{ + "single": { Nesting: configschema.NestingSingle, Block: configschema.Block{ BlockTypes: map[string]*configschema.NestedBlock{ - "list": &configschema.NestedBlock{ + "list": { Nesting: configschema.NestingList, Block: configschema.Block{ BlockTypes: map[string]*configschema.NestedBlock{ - "set": &configschema.NestedBlock{ + "set": { Nesting: configschema.NestingSet, }, }, diff --git a/internal/tfplugin5/tfplugin5.pb.go b/internal/tfplugin5/tfplugin5.pb.go index 86fd21e41e0..84179725d69 100644 --- a/internal/tfplugin5/tfplugin5.pb.go +++ b/internal/tfplugin5/tfplugin5.pb.go @@ -24,6 +24,31 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +type StringKind int32 + +const ( + StringKind_PLAIN StringKind = 0 + StringKind_MARKDOWN StringKind = 1 +) + +var StringKind_name = map[int32]string{ + 0: "PLAIN", + 1: "MARKDOWN", +} + +var StringKind_value = map[string]int32{ + "PLAIN": 0, + "MARKDOWN": 1, +} + +func (x StringKind) String() string { + return proto.EnumName(StringKind_name, int32(x)) +} + +func (StringKind) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_17ae6090ff270234, []int{0} +} + type Diagnostic_Severity int32 const ( @@ -542,6 +567,9 @@ type Schema_Block struct { Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` Attributes []*Schema_Attribute `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes,omitempty"` BlockTypes []*Schema_NestedBlock `protobuf:"bytes,3,rep,name=block_types,json=blockTypes,proto3" json:"block_types,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + DescriptionKind StringKind `protobuf:"varint,5,opt,name=description_kind,json=descriptionKind,proto3,enum=tfplugin5.StringKind" json:"description_kind,omitempty"` + Deprecated bool `protobuf:"varint,6,opt,name=deprecated,proto3" json:"deprecated,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -593,17 +621,40 @@ func (m *Schema_Block) GetBlockTypes() []*Schema_NestedBlock { return nil } +func (m *Schema_Block) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Schema_Block) GetDescriptionKind() StringKind { + if m != nil { + return m.DescriptionKind + } + return StringKind_PLAIN +} + +func (m *Schema_Block) GetDeprecated() bool { + if m != nil { + return m.Deprecated + } + return false +} + type Schema_Attribute struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Type []byte `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"` - Optional bool `protobuf:"varint,5,opt,name=optional,proto3" json:"optional,omitempty"` - Computed bool `protobuf:"varint,6,opt,name=computed,proto3" json:"computed,omitempty"` - Sensitive bool `protobuf:"varint,7,opt,name=sensitive,proto3" json:"sensitive,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type []byte `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Required bool `protobuf:"varint,4,opt,name=required,proto3" json:"required,omitempty"` + Optional bool `protobuf:"varint,5,opt,name=optional,proto3" json:"optional,omitempty"` + Computed bool `protobuf:"varint,6,opt,name=computed,proto3" json:"computed,omitempty"` + Sensitive bool `protobuf:"varint,7,opt,name=sensitive,proto3" json:"sensitive,omitempty"` + DescriptionKind StringKind `protobuf:"varint,8,opt,name=description_kind,json=descriptionKind,proto3,enum=tfplugin5.StringKind" json:"description_kind,omitempty"` + Deprecated bool `protobuf:"varint,9,opt,name=deprecated,proto3" json:"deprecated,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Schema_Attribute) Reset() { *m = Schema_Attribute{} } @@ -680,6 +731,20 @@ func (m *Schema_Attribute) GetSensitive() bool { return false } +func (m *Schema_Attribute) GetDescriptionKind() StringKind { + if m != nil { + return m.DescriptionKind + } + return StringKind_PLAIN +} + +func (m *Schema_Attribute) GetDeprecated() bool { + if m != nil { + return m.Deprecated + } + return false +} + type Schema_NestedBlock struct { TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` Block *Schema_Block `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"` @@ -818,6 +883,7 @@ type GetProviderSchema_Response struct { ResourceSchemas map[string]*Schema `protobuf:"bytes,2,rep,name=resource_schemas,json=resourceSchemas,proto3" json:"resource_schemas,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` DataSourceSchemas map[string]*Schema `protobuf:"bytes,3,rep,name=data_source_schemas,json=dataSourceSchemas,proto3" json:"data_source_schemas,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Diagnostics []*Diagnostic `protobuf:"bytes,4,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + ProviderMeta *Schema `protobuf:"bytes,5,opt,name=provider_meta,json=providerMeta,proto3" json:"provider_meta,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -876,6 +942,13 @@ func (m *GetProviderSchema_Response) GetDiagnostics() []*Diagnostic { return nil } +func (m *GetProviderSchema_Response) GetProviderMeta() *Schema { + if m != nil { + return m.ProviderMeta + } + return nil +} + type PrepareProviderConfig struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1524,6 +1597,7 @@ type ReadResource_Request struct { TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` CurrentState *DynamicValue `protobuf:"bytes,2,opt,name=current_state,json=currentState,proto3" json:"current_state,omitempty"` Private []byte `protobuf:"bytes,3,opt,name=private,proto3" json:"private,omitempty"` + ProviderMeta *DynamicValue `protobuf:"bytes,4,opt,name=provider_meta,json=providerMeta,proto3" json:"provider_meta,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1575,6 +1649,13 @@ func (m *ReadResource_Request) GetPrivate() []byte { return nil } +func (m *ReadResource_Request) GetProviderMeta() *DynamicValue { + if m != nil { + return m.ProviderMeta + } + return nil +} + type ReadResource_Response struct { NewState *DynamicValue `protobuf:"bytes,1,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` Diagnostics []*Diagnostic `protobuf:"bytes,2,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` @@ -1667,6 +1748,7 @@ type PlanResourceChange_Request struct { ProposedNewState *DynamicValue `protobuf:"bytes,3,opt,name=proposed_new_state,json=proposedNewState,proto3" json:"proposed_new_state,omitempty"` Config *DynamicValue `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` PriorPrivate []byte `protobuf:"bytes,5,opt,name=prior_private,json=priorPrivate,proto3" json:"prior_private,omitempty"` + ProviderMeta *DynamicValue `protobuf:"bytes,6,opt,name=provider_meta,json=providerMeta,proto3" json:"provider_meta,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1732,6 +1814,13 @@ func (m *PlanResourceChange_Request) GetPriorPrivate() []byte { return nil } +func (m *PlanResourceChange_Request) GetProviderMeta() *DynamicValue { + if m != nil { + return m.ProviderMeta + } + return nil +} + type PlanResourceChange_Response struct { PlannedState *DynamicValue `protobuf:"bytes,1,opt,name=planned_state,json=plannedState,proto3" json:"planned_state,omitempty"` RequiresReplace []*AttributePath `protobuf:"bytes,2,rep,name=requires_replace,json=requiresReplace,proto3" json:"requires_replace,omitempty"` @@ -1851,6 +1940,7 @@ type ApplyResourceChange_Request struct { PlannedState *DynamicValue `protobuf:"bytes,3,opt,name=planned_state,json=plannedState,proto3" json:"planned_state,omitempty"` Config *DynamicValue `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` PlannedPrivate []byte `protobuf:"bytes,5,opt,name=planned_private,json=plannedPrivate,proto3" json:"planned_private,omitempty"` + ProviderMeta *DynamicValue `protobuf:"bytes,6,opt,name=provider_meta,json=providerMeta,proto3" json:"provider_meta,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1916,6 +2006,13 @@ func (m *ApplyResourceChange_Request) GetPlannedPrivate() []byte { return nil } +func (m *ApplyResourceChange_Request) GetProviderMeta() *DynamicValue { + if m != nil { + return m.ProviderMeta + } + return nil +} + type ApplyResourceChange_Response struct { NewState *DynamicValue `protobuf:"bytes,1,opt,name=new_state,json=newState,proto3" json:"new_state,omitempty"` Private []byte `protobuf:"bytes,2,opt,name=private,proto3" json:"private,omitempty"` @@ -2204,6 +2301,7 @@ var xxx_messageInfo_ReadDataSource proto.InternalMessageInfo type ReadDataSource_Request struct { TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` Config *DynamicValue `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + ProviderMeta *DynamicValue `protobuf:"bytes,3,opt,name=provider_meta,json=providerMeta,proto3" json:"provider_meta,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2248,6 +2346,13 @@ func (m *ReadDataSource_Request) GetConfig() *DynamicValue { return nil } +func (m *ReadDataSource_Request) GetProviderMeta() *DynamicValue { + if m != nil { + return m.ProviderMeta + } + return nil +} + type ReadDataSource_Response struct { State *DynamicValue `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` Diagnostics []*Diagnostic `protobuf:"bytes,2,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` @@ -2639,6 +2744,7 @@ func (m *ProvisionResource_Response) GetDiagnostics() []*Diagnostic { } func init() { + proto.RegisterEnum("tfplugin5.StringKind", StringKind_name, StringKind_value) proto.RegisterEnum("tfplugin5.Diagnostic_Severity", Diagnostic_Severity_name, Diagnostic_Severity_value) proto.RegisterEnum("tfplugin5.Schema_NestedBlock_NestingMode", Schema_NestedBlock_NestingMode_name, Schema_NestedBlock_NestingMode_value) proto.RegisterType((*DynamicValue)(nil), "tfplugin5.DynamicValue") @@ -2701,137 +2807,147 @@ func init() { proto.RegisterType((*ProvisionResource_Response)(nil), "tfplugin5.ProvisionResource.Response") } -func init() { proto.RegisterFile("tfplugin5.proto", fileDescriptor_17ae6090ff270234) } +func init() { + proto.RegisterFile("tfplugin5.proto", fileDescriptor_17ae6090ff270234) +} var fileDescriptor_17ae6090ff270234 = []byte{ - // 1880 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0xcb, 0x6f, 0x23, 0x49, - 0x19, 0x9f, 0xf6, 0x23, 0xb1, 0x3f, 0xe7, 0xe1, 0xd4, 0xcc, 0x0e, 0xa6, 0x77, 0x17, 0x82, 0x79, - 0x24, 0xab, 0xdd, 0xf1, 0xac, 0x32, 0xb0, 0xbb, 0x84, 0xd1, 0x8a, 0x6c, 0x26, 0x64, 0x22, 0x66, - 0xb2, 0xa1, 0x3c, 0x0f, 0x24, 0xa4, 0xb5, 0x6a, 0xdc, 0x15, 0x4f, 0x33, 0x76, 0x77, 0x6f, 0x75, - 0x39, 0x89, 0x85, 0xc4, 0x05, 0xc1, 0x19, 0x09, 0xf1, 0x90, 0x78, 0x5c, 0x40, 0xe2, 0x1f, 0xe0, - 0x00, 0xdc, 0x38, 0xf1, 0x0f, 0x70, 0x03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0x59, 0x76, 0xb3, 0x5a, 0x6a, - 0x64, 0x87, 0xe9, 0x34, 0x39, 0x61, 0xff, 0xb9, 0xf3, 0x60, 0x5a, 0xc8, 0x71, 0x66, 0x03, 0x86, - 0xec, 0xe3, 0x19, 0xf4, 0x44, 0xcc, 0xc6, 0xb9, 0xb8, 0x54, 0x4e, 0xc6, 0xb3, 0x38, 0x26, 0x27, - 0xeb, 0xd9, 0xcc, 0x92, 0x93, 0x8d, 0xd3, 0x72, 0x1e, 0x4f, 0xbe, 0x84, 0xe8, 0x53, 0x13, 0x86, - 0x4e, 0x49, 0x09, 0xf7, 0xe6, 0x3c, 0x88, 0x66, 0xfc, 0x45, 0xf5, 0xfb, 0x3f, 0x1a, 0xfb, 0xf9, - 0x94, 0x87, 0x51, 0xc2, 0xa4, 0x31, 0x4d, 0x50, 0x47, 0xb7, 0xbe, 0x57, 0x84, 0x9a, 0xf5, 0x30, - 0xa0, 0x0f, 0xec, 0xe2, 0xb4, 0x91, 0x51, 0x76, 0xec, 0x37, 0x2e, 0x33, 0xaa, 0x67, 0x00, 0xb5, - 0xaa, 0x67, 0x73, 0xde, 0x23, 0x94, 0x95, 0x8b, 0x53, 0xa8, 0x44, 0xe8, 0x8d, 0x9c, 0x68, 0x2d, - 0xf9, 0x49, 0xc6, 0x53, 0x33, 0x56, 0x7e, 0xa7, 0xa8, 0x99, 0xe5, 0x37, 0x0b, 0xa5, 0x24, 0xbc, - 0xe9, 0x5c, 0xc2, 0x11, 0x4f, 0x16, 0xe4, 0x1f, 0x7b, 0xb7, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, - 0x8a, 0x61, 0xfa, 0xcc, 0xeb, 0x1b, 0x00, 0x00, + // 2010 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0xcd, 0x6f, 0x23, 0x49, + 0x15, 0x9f, 0x6e, 0xdb, 0x89, 0xfd, 0xec, 0x49, 0x3a, 0x35, 0x1f, 0x98, 0xde, 0x0f, 0x82, 0x61, + 0x49, 0x96, 0xdd, 0xf1, 0xac, 0x32, 0x30, 0xbb, 0x84, 0xd1, 0x6a, 0xb3, 0x49, 0xc8, 0x44, 0x33, + 0xf1, 0x84, 0xf2, 0xcc, 0x04, 0x09, 0x69, 0xad, 0x1a, 0x77, 0xc5, 0xd3, 0xc4, 0xee, 0xee, 0xad, + 0x2e, 0x67, 0x62, 0x71, 0x44, 0x70, 0x46, 0xa0, 0x85, 0x03, 0x70, 0x81, 0x03, 0xe2, 0xc4, 0x0d, + 0xf1, 0x75, 0xe1, 0xce, 0x81, 0x3b, 0xdc, 0x56, 0x1c, 0xb9, 0xf0, 0x17, 0xa0, 0xaa, 0xae, 0xee, + 0x2e, 0xdb, 0xed, 0xa4, 0x93, 0xec, 0x0a, 0xed, 0xad, 0xeb, 0xbd, 0x5f, 0xbd, 0xf7, 0xea, 0xbd, + 0x5f, 0xbd, 0xaa, 0xb2, 0x61, 0x91, 0x1f, 0x06, 0xfd, 0x61, 0xcf, 0xf5, 0xbe, 0xde, 0x0c, 0x98, + 0xcf, 0x7d, 0x54, 0x49, 0x04, 0x8d, 0x7b, 0x50, 0xdb, 0x1a, 0x79, 0x64, 0xe0, 0x76, 0x9f, 0x92, + 0xfe, 0x90, 0xa2, 0x3a, 0xcc, 0x0f, 0xc2, 0x5e, 0x40, 0xba, 0x47, 0x75, 0x63, 0xd9, 0x58, 0xad, + 0xe1, 0x78, 0x88, 0x10, 0x14, 0xbf, 0x17, 0xfa, 0x5e, 0xdd, 0x94, 0x62, 0xf9, 0xdd, 0xf8, 0xd8, + 0x00, 0xd8, 0x72, 0x49, 0xcf, 0xf3, 0x43, 0xee, 0x76, 0xd1, 0x3a, 0x94, 0x43, 0x7a, 0x4c, 0x99, + 0xcb, 0x47, 0x72, 0xf6, 0xc2, 0xda, 0xab, 0xcd, 0xd4, 0x77, 0x0a, 0x6c, 0xb6, 0x15, 0x0a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b, 0xfa, 0x2f, 0x06, 0x9a, 0x22, 0xb1, 0xb7, 0x3c, 0x1b, 0xa0, 0x4c, 0x76, 0xb3, 0x1e, + 0x0d, 0x48, 0xa7, 0xe9, 0xb4, 0x3a, 0x31, 0xff, 0x95, 0xb3, 0x60, 0xca, 0xc9, 0x61, 0xe6, 0x25, + 0x11, 0xe9, 0xd3, 0x33, 0xf4, 0x89, 0x9b, 0x95, 0x33, 0x71, 0xa9, 0x9f, 0x8c, 0xc3, 0x77, 0xcc, + 0x4f, 0xd6, 0xe1, 0x9c, 0xe5, 0x27, 0x1b, 0xa7, 0xfc, 0x1c, 0x4c, 0x9e, 0xb7, 0xe8, 0x8b, 0x13, + 0x89, 0x4e, 0x55, 0x89, 0xf5, 0xc6, 0x69, 0x10, 0x65, 0xf8, 0x1b, 0xd1, 0xdf, 0x47, 0x68, 0xec, + 0x77, 0x69, 0xee, 0x07, 0x89, 0x91, 0xfa, 0xb4, 0x22, 0x9a, 0xba, 0xf6, 0xa3, 0x02, 0x54, 0xb5, + 0xf3, 0x03, 0x7d, 0xa0, 0x37, 0xa7, 0x95, 0x8c, 0xb6, 0xa3, 0x1f, 0x85, 0x99, 0xac, 0x9e, 0x01, + 0x54, 0xa1, 0x9e, 0x9c, 0x72, 0x6c, 0xa1, 0xac, 0xbd, 0x38, 0x85, 0x4a, 0x9c, 0xde, 0xca, 0x89, + 0x56, 0x9e, 0x9f, 0x65, 0x9c, 0x48, 0x63, 0xed, 0x77, 0x4a, 0x9b, 0xd9, 0x7e, 0xb3, 0x50, 0x91, + 0x87, 0xb7, 0x8c, 0x4b, 0x14, 0xe2, 0xd9, 0x9c, 0xfc, 0x5f, 0xf8, 0xce, 0xff, 0x02, 0x00, 0x00, + 0xff, 0xff, 0xe3, 0x8e, 0xe1, 0x22, 0x2a, 0x1e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConn +var _ grpc.ClientConnInterface // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 +const _ = grpc.SupportPackageIsVersion6 // ProviderClient is the client API for Provider service. // @@ -2856,10 +2972,10 @@ type ProviderClient interface { } type providerClient struct { - cc *grpc.ClientConn + cc grpc.ClientConnInterface } -func NewProviderClient(cc *grpc.ClientConn) ProviderClient { +func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { return &providerClient{cc} } @@ -3320,10 +3436,10 @@ type ProvisionerClient interface { } type provisionerClient struct { - cc *grpc.ClientConn + cc grpc.ClientConnInterface } -func NewProvisionerClient(cc *grpc.ClientConn) ProvisionerClient { +func NewProvisionerClient(cc grpc.ClientConnInterface) ProvisionerClient { return &provisionerClient{cc} } diff --git a/internal/tfplugin5/tfplugin5.proto b/internal/tfplugin5/tfplugin5.proto index 9875d9ba627..4f365697a81 100644 --- a/internal/tfplugin5/tfplugin5.proto +++ b/internal/tfplugin5/tfplugin5.proto @@ -1,12 +1,12 @@ -// Terraform Plugin RPC protocol version 5.1 +// Terraform Plugin RPC protocol version 5.2 // -// This file defines version 5.1 of the RPC protocol. To implement a plugin +// This file defines version 5.2 of the RPC protocol. To implement a plugin // against this protocol, copy this definition into your own codebase and // use protoc to generate stubs for your target language. // -// This file will be updated in-place in the source Terraform repository for -// any minor versions of protocol 5, but later minor versions will always be -// backwards compatible. Breaking changes, if any are required, will come +// This file will not be updated. Any minor versions of protocol 5 to follow +// should copy this file and modify the copy while maintaing backwards +// compatibility. Breaking changes, if any are required, will come // in a subsequent major version with its own separate proto definition. // // Note that only the proto files included in a release tag of Terraform are @@ -58,7 +58,7 @@ message Stop { message Request { } message Response { - string Error = 1; + string Error = 1; } } @@ -70,12 +70,20 @@ message RawState { map flatmap = 2; } +enum StringKind { + PLAIN = 0; + MARKDOWN = 1; +} + // Schema is the configuration schema for a Resource, Provider, or Provisioner. message Schema { message Block { int64 version = 1; repeated Attribute attributes = 2; repeated NestedBlock block_types = 3; + string description = 4; + StringKind description_kind = 5; + bool deprecated = 6; } message Attribute { @@ -86,6 +94,8 @@ message Schema { bool optional = 5; bool computed = 6; bool sensitive = 7; + StringKind description_kind = 8; + bool deprecated = 9; } message NestedBlock { @@ -145,6 +155,7 @@ message GetProviderSchema { map resource_schemas = 2; map data_source_schemas = 3; repeated Diagnostic diagnostics = 4; + Schema provider_meta = 5; } } @@ -220,6 +231,7 @@ message ReadResource { string type_name = 1; DynamicValue current_state = 2; bytes private = 3; + DynamicValue provider_meta = 4; } message Response { DynamicValue new_state = 1; @@ -235,6 +247,7 @@ message PlanResourceChange { DynamicValue proposed_new_state = 3; DynamicValue config = 4; bytes prior_private = 5; + DynamicValue provider_meta = 6; } message Response { @@ -266,6 +279,7 @@ message ApplyResourceChange { DynamicValue planned_state = 3; DynamicValue config = 4; bytes planned_private = 5; + DynamicValue provider_meta = 6; } message Response { DynamicValue new_state = 1; @@ -309,6 +323,7 @@ message ReadDataSource { message Request { string type_name = 1; DynamicValue config = 2; + DynamicValue provider_meta = 3; } message Response { DynamicValue state = 1; diff --git a/scripts/gofmtcheck.sh b/scripts/gofmtcheck.sh index c65c78b921b..bad9ba41aae 100755 --- a/scripts/gofmtcheck.sh +++ b/scripts/gofmtcheck.sh @@ -2,7 +2,7 @@ set -e echo "==> Checking that code complies with gofmt requirements..." -gofmt_files=$(gofmt -l `find . -name '*.go'`) +gofmt_files=$(gofmt -s -l `find . -name '*.go'`) if [[ -n ${gofmt_files} ]]; then echo 'gofmt needs running on the following files:' echo "${gofmt_files}" diff --git a/terraform/diff.go b/terraform/diff.go index 258e0ac9b21..067ab13aeff 100644 --- a/terraform/diff.go +++ b/terraform/diff.go @@ -809,7 +809,7 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) { // Found it! Ignore all of these. The prefix here is stripping // off the "%" so it is just "k." prefix := k[:len(k)-1] - for k2, _ := range d.Attributes { + for k2 := range d.Attributes { if strings.HasPrefix(k2, prefix) { ignoreAttrs[k2] = struct{}{} } @@ -849,17 +849,17 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) { // same attributes. To start, build up the check map to be all the keys. checkOld := make(map[string]struct{}) checkNew := make(map[string]struct{}) - for k, _ := range d.Attributes { + for k := range d.Attributes { checkOld[k] = struct{}{} } - for k, _ := range d2.CopyAttributes() { + for k := range d2.CopyAttributes() { checkNew[k] = struct{}{} } // Make an ordered list so we are sure the approximated hashes are left // to process at the end of the loop keys := make([]string, 0, len(d.Attributes)) - for k, _ := range d.Attributes { + for k := range d.Attributes { keys = append(keys, k) } sort.StringSlice(keys).Sort() @@ -917,7 +917,7 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) { return false, fmt.Sprintf("regexp failed to compile; err: %#v", err) } - for k2, _ := range checkNew { + for k2 := range checkNew { if re.MatchString(k2) { delete(checkNew, k2) } @@ -954,12 +954,12 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) { // This is a computed list, set, or map, so remove any keys with // this prefix from the check list. kprefix := k[:len(k)-matchLen] - for k2, _ := range checkOld { + for k2 := range checkOld { if strings.HasPrefix(k2, kprefix) { delete(checkOld, k2) } } - for k2, _ := range checkNew { + for k2 := range checkNew { if strings.HasPrefix(k2, kprefix) { delete(checkNew, k2) } @@ -979,7 +979,7 @@ func (d *InstanceDiff) Same(d2 *InstanceDiff) (bool, string) { // Check for leftover attributes if len(checkNew) > 0 { extras := make([]string, 0, len(checkNew)) - for attr, _ := range checkNew { + for attr := range checkNew { extras = append(extras, attr) } return false, diff --git a/terraform/diff_test.go b/terraform/diff_test.go index 3fc25118008..81235f7cd4f 100644 --- a/terraform/diff_test.go +++ b/terraform/diff_test.go @@ -22,7 +22,7 @@ func TestInstanceDiff_ChangeType(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "bar", }, @@ -33,7 +33,7 @@ func TestInstanceDiff_ChangeType(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "bar", RequiresNew: true, @@ -46,7 +46,7 @@ func TestInstanceDiff_ChangeType(t *testing.T) { &InstanceDiff{ Destroy: true, Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "bar", RequiresNew: true, @@ -59,7 +59,7 @@ func TestInstanceDiff_ChangeType(t *testing.T) { &InstanceDiff{ DestroyTainted: true, Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "bar", RequiresNew: true, @@ -99,7 +99,7 @@ func TestInstanceDiff_Empty(t *testing.T) { rd = &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { New: "bar", }, }, @@ -113,7 +113,7 @@ func TestInstanceDiff_Empty(t *testing.T) { func TestInstanceDiff_RequiresNew(t *testing.T) { rd := &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{}, + "foo": {}, }, } @@ -173,12 +173,12 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{}, + "foo": {}, }, }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{}, + "foo": {}, }, }, true, @@ -188,12 +188,12 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "bar": &ResourceAttrDiff{}, + "bar": {}, }, }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{}, + "foo": {}, }, }, false, @@ -204,13 +204,13 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{}, + "foo": {}, }, }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{}, - "bar": &ResourceAttrDiff{}, + "foo": {}, + "bar": {}, }, }, false, @@ -220,12 +220,12 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{RequiresNew: true}, + "foo": {RequiresNew: true}, }, }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{RequiresNew: false}, + "foo": {RequiresNew: false}, }, }, false, @@ -236,7 +236,7 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "${var.foo}", NewComputed: true, @@ -245,7 +245,7 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "0", New: "1", }, @@ -259,7 +259,7 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "${var.foo}", NewComputed: true, @@ -277,7 +277,7 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "", New: "", NewComputed: true, @@ -286,12 +286,12 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.1": &ResourceAttrDiff{ + "foo.1": { Old: "foo", New: "", NewRemoved: true, }, - "foo.2": &ResourceAttrDiff{ + "foo.2": { Old: "", New: "bar", }, @@ -304,16 +304,16 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{NewComputed: true}, + "foo.#": {NewComputed: true}, }, }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "1", }, - "foo.0": &ResourceAttrDiff{ + "foo.0": { Old: "", New: "12", }, @@ -326,11 +326,11 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "1", }, - "foo.~35964334.bar": &ResourceAttrDiff{ + "foo.~35964334.bar": { Old: "", New: "${var.foo}", }, @@ -338,11 +338,11 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "1", }, - "foo.87654323.bar": &ResourceAttrDiff{ + "foo.87654323.bar": { Old: "", New: "12", }, @@ -355,7 +355,7 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", NewComputed: true, }, @@ -372,7 +372,7 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", NewComputed: true, RequiresNew: true, @@ -390,7 +390,7 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", NewComputed: true, RequiresNew: true, @@ -410,7 +410,7 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", NewComputed: true, RequiresNew: true, @@ -421,11 +421,11 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "1", New: "1", }, - "foo.12": &ResourceAttrDiff{ + "foo.12": { Old: "4", New: "12", RequiresNew: true, @@ -445,11 +445,11 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "1", }, - "foo.~35964334.bar": &ResourceAttrDiff{ + "foo.~35964334.bar": { Old: "", New: "${var.foo}", }, @@ -457,19 +457,19 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "2", }, - "foo.87654323.bar": &ResourceAttrDiff{ + "foo.87654323.bar": { Old: "", New: "12", }, - "foo.87654325.bar": &ResourceAttrDiff{ + "foo.87654325.bar": { Old: "", New: "12", }, - "foo.87654325.baz": &ResourceAttrDiff{ + "foo.87654325.baz": { Old: "", New: "12", }, @@ -483,7 +483,7 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.%": &ResourceAttrDiff{ + "foo.%": { Old: "", New: "", NewComputed: true, @@ -492,12 +492,12 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.%": &ResourceAttrDiff{ + "foo.%": { Old: "0", New: "1", NewComputed: false, }, - "foo.val": &ResourceAttrDiff{ + "foo.val": { Old: "", New: "something", }, @@ -518,12 +518,12 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "somemap.oldkey": &ResourceAttrDiff{ + "somemap.oldkey": { Old: "long ago", New: "", NewRemoved: true, }, - "somemap.newkey": &ResourceAttrDiff{ + "somemap.newkey": { Old: "", New: "brave new world", }, @@ -531,7 +531,7 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "somemap.newkey": &ResourceAttrDiff{ + "somemap.newkey": { Old: "", New: "brave new world", }, @@ -549,16 +549,16 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "reqnew": &ResourceAttrDiff{ + "reqnew": { Old: "old", New: "new", RequiresNew: true, }, - "somemap.#": &ResourceAttrDiff{ + "somemap.#": { Old: "1", New: "0", }, - "somemap.oldkey": &ResourceAttrDiff{ + "somemap.oldkey": { Old: "long ago", New: "", NewRemoved: true, @@ -567,7 +567,7 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "reqnew": &ResourceAttrDiff{ + "reqnew": { Old: "", New: "new", RequiresNew: true, @@ -581,16 +581,16 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "reqnew": &ResourceAttrDiff{ + "reqnew": { Old: "old", New: "new", RequiresNew: true, }, - "somemap.%": &ResourceAttrDiff{ + "somemap.%": { Old: "1", New: "0", }, - "somemap.oldkey": &ResourceAttrDiff{ + "somemap.oldkey": { Old: "long ago", New: "", NewRemoved: true, @@ -599,7 +599,7 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "reqnew": &ResourceAttrDiff{ + "reqnew": { Old: "", New: "new", RequiresNew: true, @@ -614,19 +614,19 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "1", }, - "foo.~1.outer_val": &ResourceAttrDiff{ + "foo.~1.outer_val": { Old: "", New: "foo", }, - "foo.~1.inner.#": &ResourceAttrDiff{ + "foo.~1.inner.#": { Old: "0", New: "1", }, - "foo.~1.inner.~2.value": &ResourceAttrDiff{ + "foo.~1.inner.~2.value": { Old: "", New: "${var.bar}", NewComputed: true, @@ -635,19 +635,19 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "1", }, - "foo.12.outer_val": &ResourceAttrDiff{ + "foo.12.outer_val": { Old: "", New: "foo", }, - "foo.12.inner.#": &ResourceAttrDiff{ + "foo.12.inner.#": { Old: "0", New: "1", }, - "foo.12.inner.42.value": &ResourceAttrDiff{ + "foo.12.inner.42.value": { Old: "", New: "baz", }, @@ -661,19 +661,19 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "1", }, - "foo.~1.outer_val": &ResourceAttrDiff{ + "foo.~1.outer_val": { Old: "", New: "foo", }, - "foo.~1.inner.#": &ResourceAttrDiff{ + "foo.~1.inner.#": { Old: "0", New: "1", }, - "foo.~1.inner.0.value": &ResourceAttrDiff{ + "foo.~1.inner.0.value": { Old: "", New: "${var.bar}", NewComputed: true, @@ -682,19 +682,19 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "0", New: "1", }, - "foo.12.outer_val": &ResourceAttrDiff{ + "foo.12.outer_val": { Old: "", New: "foo", }, - "foo.12.inner.#": &ResourceAttrDiff{ + "foo.12.inner.#": { Old: "0", New: "1", }, - "foo.12.inner.0.value": &ResourceAttrDiff{ + "foo.12.inner.0.value": { Old: "", New: "baz", }, @@ -710,12 +710,12 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.%": &ResourceAttrDiff{ + "foo.%": { Old: "1", New: "0", RequiresNew: true, }, - "foo.bar": &ResourceAttrDiff{ + "foo.bar": { Old: "baz", New: "", NewRemoved: true, @@ -731,12 +731,12 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo.#": &ResourceAttrDiff{ + "foo.#": { Old: "1", New: "0", RequiresNew: true, }, - "foo.0": &ResourceAttrDiff{ + "foo.0": { Old: "baz", New: "", NewRemoved: true, @@ -755,7 +755,7 @@ func TestInstanceDiffSame(t *testing.T) { &InstanceDiff{ DestroyTainted: true, Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "foo", New: "foo", }, @@ -764,7 +764,7 @@ func TestInstanceDiffSame(t *testing.T) { &InstanceDiff{ DestroyTainted: true, Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "foo", }, @@ -777,11 +777,11 @@ func TestInstanceDiffSame(t *testing.T) { { &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "foo", New: "foo", }, - "bar": &ResourceAttrDiff{ + "bar": { Old: "bar", New: "baz", RequiresNew: true, @@ -790,11 +790,11 @@ func TestInstanceDiffSame(t *testing.T) { }, &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "foo", }, - "bar": &ResourceAttrDiff{ + "bar": { Old: "", New: "baz", RequiresNew: true, diff --git a/terraform/resource_test.go b/terraform/resource_test.go index babd4186e26..ae515a40823 100644 --- a/terraform/resource_test.go +++ b/terraform/resource_test.go @@ -592,12 +592,12 @@ func TestNewResourceConfigShimmed(t *testing.T) { }), Schema: &configschema.Block{ Attributes: map[string]*configschema.Attribute{ - "bar": &configschema.Attribute{ + "bar": { Type: cty.Set(cty.Object(map[string]cty.Type{ "val": cty.String, })), }, - "baz": &configschema.Attribute{ + "baz": { Type: cty.Set(cty.Object(map[string]cty.Type{ "obj": cty.Object(map[string]cty.Type{ "attr": cty.List(cty.String), diff --git a/terraform/state.go b/terraform/state.go index 3a8480436f9..a2d6395a922 100644 --- a/terraform/state.go +++ b/terraform/state.go @@ -956,7 +956,7 @@ func (m *ModuleState) String() string { } names := make([]string, 0, len(m.Resources)) - for name, _ := range m.Resources { + for name := range m.Resources { names = append(names, name) } @@ -993,7 +993,7 @@ func (m *ModuleState) String() string { attributes = rs.Primary.Attributes } attrKeys := make([]string, 0, len(attributes)) - for ak, _ := range attributes { + for ak := range attributes { if ak == "id" { continue } @@ -1028,7 +1028,7 @@ func (m *ModuleState) String() string { buf.WriteString("\nOutputs:\n\n") ks := make([]string, 0, len(m.Outputs)) - for k, _ := range m.Outputs { + for k := range m.Outputs { ks = append(ks, k) } @@ -1043,7 +1043,7 @@ func (m *ModuleState) String() string { buf.WriteString(fmt.Sprintf("%s = %s\n", k, vTyped)) case map[string]interface{}: var mapKeys []string - for key, _ := range vTyped { + for key := range vTyped { mapKeys = append(mapKeys, key) } sort.Strings(mapKeys) @@ -1575,7 +1575,7 @@ func (s *InstanceState) String() string { attributes := s.Attributes attrKeys := make([]string, 0, len(attributes)) - for ak, _ := range attributes { + for ak := range attributes { if ak == "id" { continue } diff --git a/terraform/state_test.go b/terraform/state_test.go index 590b44a0c53..48ce025b1b9 100644 --- a/terraform/state_test.go +++ b/terraform/state_test.go @@ -25,10 +25,10 @@ func TestStateValidate(t *testing.T) { "multiple modules": { &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: []string{"root", "foo"}, }, - &ModuleState{ + { Path: []string{"root", "foo"}, }, }, @@ -59,8 +59,8 @@ func TestStateAddModule(t *testing.T) { addrs.RootModuleInstance.Child("child", addrs.NoKey), }, [][]string{ - []string{"root"}, - []string{"root", "child"}, + {"root"}, + {"root", "child"}, }, }, @@ -72,10 +72,10 @@ func TestStateAddModule(t *testing.T) { addrs.RootModuleInstance.Child("bar", addrs.NoKey), }, [][]string{ - []string{"root"}, - []string{"root", "bar"}, - []string{"root", "foo"}, - []string{"root", "foo", "bar"}, + {"root"}, + {"root", "bar"}, + {"root", "foo"}, + {"root", "foo", "bar"}, }, }, // Same last element, different middle element @@ -88,11 +88,11 @@ func TestStateAddModule(t *testing.T) { addrs.RootModuleInstance.Child("bar", addrs.NoKey), }, [][]string{ - []string{"root"}, - []string{"root", "bar"}, - []string{"root", "foo"}, - []string{"root", "bar", "bar"}, - []string{"root", "foo", "bar"}, + {"root"}, + {"root", "bar"}, + {"root", "foo"}, + {"root", "bar", "bar"}, + {"root", "foo", "bar"}, }, }, } @@ -134,10 +134,10 @@ func TestStateDeepCopy(t *testing.T) { &State{ Version: 6, Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Primary: &InstanceState{ Meta: map[string]interface{}{}, }, @@ -154,10 +154,10 @@ func TestStateDeepCopy(t *testing.T) { &State{ Version: 6, Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Primary: &InstanceState{ Meta: map[string]interface{}{}, }, @@ -219,7 +219,7 @@ func TestStateEqual(t *testing.T) { false, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: []string{"root"}, }, }, @@ -232,14 +232,14 @@ func TestStateEqual(t *testing.T) { true, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: []string{"root"}, }, }, }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: []string{"root"}, }, }, @@ -252,10 +252,10 @@ func TestStateEqual(t *testing.T) { false, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Primary: &InstanceState{ Meta: map[string]interface{}{ "schema_version": "1", @@ -268,10 +268,10 @@ func TestStateEqual(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Primary: &InstanceState{ Meta: map[string]interface{}{ "schema_version": "2", @@ -290,10 +290,10 @@ func TestStateEqual(t *testing.T) { true, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Primary: &InstanceState{ Meta: map[string]interface{}{ "timeouts": map[string]interface{}{ @@ -309,10 +309,10 @@ func TestStateEqual(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Primary: &InstanceState{ Meta: map[string]interface{}{ "timeouts": map[string]interface{}{ @@ -334,10 +334,10 @@ func TestStateEqual(t *testing.T) { true, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Primary: &InstanceState{ Meta: map[string]interface{}{ "timeouts": map[string]interface{}{ @@ -353,10 +353,10 @@ func TestStateEqual(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Primary: &InstanceState{ Meta: map[string]interface{}{ "timeouts": map[string]interface{}{ @@ -544,17 +544,17 @@ func TestStateRemove(t *testing.T) { "test_instance.foo", &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", }, }, - "test_instance.bar": &ResourceState{ + "test_instance.bar": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -566,10 +566,10 @@ func TestStateRemove(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.bar": &ResourceState{ + "test_instance.bar": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -585,10 +585,10 @@ func TestStateRemove(t *testing.T) { "test_instance.foo.primary", &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -600,7 +600,7 @@ func TestStateRemove(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{}, }, @@ -612,17 +612,17 @@ func TestStateRemove(t *testing.T) { "test_instance.foo[0]", &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo.0": &ResourceState{ + "test_instance.foo.0": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", }, }, - "test_instance.foo.1": &ResourceState{ + "test_instance.foo.1": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -634,10 +634,10 @@ func TestStateRemove(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo.1": &ResourceState{ + "test_instance.foo.1": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -653,17 +653,17 @@ func TestStateRemove(t *testing.T) { "test_instance.foo", &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo.0": &ResourceState{ + "test_instance.foo.0": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", }, }, - "test_instance.foo.1": &ResourceState{ + "test_instance.foo.1": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -675,7 +675,7 @@ func TestStateRemove(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{}, }, @@ -687,10 +687,10 @@ func TestStateRemove(t *testing.T) { "module.foo", &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -699,17 +699,17 @@ func TestStateRemove(t *testing.T) { }, }, - &ModuleState{ + { Path: []string{"root", "foo"}, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", }, }, - "test_instance.bar": &ResourceState{ + "test_instance.bar": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -721,10 +721,10 @@ func TestStateRemove(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -740,10 +740,10 @@ func TestStateRemove(t *testing.T) { "module.foo", &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -752,17 +752,17 @@ func TestStateRemove(t *testing.T) { }, }, - &ModuleState{ + { Path: []string{"root", "foo"}, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", }, }, - "test_instance.bar": &ResourceState{ + "test_instance.bar": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -771,17 +771,17 @@ func TestStateRemove(t *testing.T) { }, }, - &ModuleState{ + { Path: []string{"root", "foo", "bar"}, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", }, }, - "test_instance.bar": &ResourceState{ + "test_instance.bar": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -793,10 +793,10 @@ func TestStateRemove(t *testing.T) { }, &State{ Modules: []*ModuleState{ - &ModuleState{ + { Path: rootModulePath, Resources: map[string]*ResourceState{ - "test_instance.foo": &ResourceState{ + "test_instance.foo": { Type: "test_instance", Primary: &InstanceState{ ID: "foo", @@ -1099,7 +1099,7 @@ func TestStateEmpty(t *testing.T) { { &State{ Modules: []*ModuleState{ - &ModuleState{}, + {}, }, }, false, @@ -1135,7 +1135,7 @@ func TestStateHasResources(t *testing.T) { { &State{ Modules: []*ModuleState{ - &ModuleState{}, + {}, }, }, false, @@ -1143,8 +1143,8 @@ func TestStateHasResources(t *testing.T) { { &State{ Modules: []*ModuleState{ - &ModuleState{}, - &ModuleState{}, + {}, + {}, }, }, false, @@ -1152,10 +1152,10 @@ func TestStateHasResources(t *testing.T) { { &State{ Modules: []*ModuleState{ - &ModuleState{}, - &ModuleState{ + {}, + { Resources: map[string]*ResourceState{ - "foo.foo": &ResourceState{}, + "foo.foo": {}, }, }, }, @@ -1210,20 +1210,20 @@ func TestInstanceState_MergeDiff(t *testing.T) { diff := &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "bar", New: "baz", }, - "bar": &ResourceAttrDiff{ + "bar": { Old: "", New: "foo", }, - "baz": &ResourceAttrDiff{ + "baz": { Old: "", New: "foo", NewComputed: true, }, - "port": &ResourceAttrDiff{ + "port": { NewRemoved: true, }, }, @@ -1250,18 +1250,18 @@ func TestInstanceState_MergeDiff_computedSet(t *testing.T) { diff := &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "config.#": &ResourceAttrDiff{ + "config.#": { Old: "0", New: "1", RequiresNew: true, }, - "config.0.name": &ResourceAttrDiff{ + "config.0.name": { Old: "", New: "hello", }, - "config.0.rules.#": &ResourceAttrDiff{ + "config.0.rules.#": { Old: "", NewComputed: true, }, @@ -1286,7 +1286,7 @@ func TestInstanceState_MergeDiff_nil(t *testing.T) { diff := &InstanceDiff{ Attributes: map[string]*ResourceAttrDiff{ - "foo": &ResourceAttrDiff{ + "foo": { Old: "", New: "baz", },