From 0a64027c7faba9877673e9fd047295d339df6ecd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:54:48 -0500 Subject: [PATCH 01/33] Bump github.com/google/go-cmp from 0.6.0 to 0.7.0 (#454) Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/google/go-cmp/releases) - [Commits](https://github.com/google/go-cmp/compare/v0.6.0...v0.7.0) --- updated-dependencies: - dependency-name: github.com/google/go-cmp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9b2499fd..e709a27f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.7 require ( github.com/Kunde21/markdownfmt/v3 v3.1.0 github.com/bmatcuk/doublestar/v4 v4.8.1 - github.com/google/go-cmp v0.6.0 + github.com/google/go-cmp v0.7.0 github.com/hashicorp/cli v1.1.7 github.com/hashicorp/go-version v1.7.0 github.com/hashicorp/hc-install v0.9.1 diff --git a/go.sum b/go.sum index 00fc31f1..e7bc365f 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,8 @@ github.com/go-git/go-git/v5 v5.13.0 h1:vLn5wlGIh/X78El6r3Jr+30W16Blk0CTcxTYcYPWi github.com/go-git/go-git/v5 v5.13.0/go.mod h1:Wjo7/JyVKtQgUNdXYXIepzWfJQkUEIGvkvVkiXRR/zw= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= From 36a492081b9d8f803686dc002c9fd7b45bf70bb2 Mon Sep 17 00:00:00 2001 From: Austin Valle Date: Mon, 17 Mar 2025 09:51:11 -0400 Subject: [PATCH 02/33] chore: Update minimum Go version in module (#459) * chore: Update minimum Go version in module * update deprecated function * deprecated --- cmd/tfplugindocs/main_test.go | 6 +++--- go.mod | 13 +++++++------ go.sum | 28 ++++++++++++++-------------- internal/cmd/run.go | 7 +++++-- tools/go.mod | 14 +++++++------- tools/go.sum | 24 ++++++++++++------------ 6 files changed, 48 insertions(+), 44 deletions(-) diff --git a/cmd/tfplugindocs/main_test.go b/cmd/tfplugindocs/main_test.go index f3f2b27c..e8018996 100644 --- a/cmd/tfplugindocs/main_test.go +++ b/cmd/tfplugindocs/main_test.go @@ -13,9 +13,9 @@ import ( ) func TestMain(m *testing.M) { - os.Exit(testscript.RunMain(m, map[string]func() int{ - "tfplugindocs": cmd.Main, - })) + testscript.Main(m, map[string]func(){ + "tfplugindocs": cmd.TestScriptMain, + }) } func Test_ProviderBuild_GenerateAcceptanceTests(t *testing.T) { diff --git a/go.mod b/go.mod index e709a27f..1e597501 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/terraform-plugin-docs -go 1.22.7 +go 1.23.7 require ( github.com/Kunde21/markdownfmt/v3 v3.1.0 @@ -12,13 +12,13 @@ require ( github.com/hashicorp/terraform-exec v0.22.0 github.com/hashicorp/terraform-json v0.24.0 github.com/mattn/go-colorable v0.1.14 - github.com/rogpeppe/go-internal v1.13.1 + github.com/rogpeppe/go-internal v1.14.1 github.com/yuin/goldmark v1.7.7 github.com/yuin/goldmark-meta v1.1.0 github.com/zclconf/go-cty v1.16.2 go.abhg.dev/goldmark/frontmatter v0.2.0 golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df - golang.org/x/text v0.22.0 + golang.org/x/text v0.23.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -49,9 +49,10 @@ require ( github.com/posener/complete v1.2.3 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect - golang.org/x/crypto v0.32.0 // indirect + golang.org/x/crypto v0.36.0 // indirect golang.org/x/mod v0.22.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/tools v0.22.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect ) diff --git a/go.sum b/go.sum index e7bc365f..599d6357 100644 --- a/go.sum +++ b/go.sum @@ -107,8 +107,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= -github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -139,8 +139,8 @@ go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -150,12 +150,12 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= -golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -163,8 +163,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -172,13 +172,13 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= -golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= -golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/cmd/run.go b/internal/cmd/run.go index 471a76b8..41dab763 100644 --- a/internal/cmd/run.go +++ b/internal/cmd/run.go @@ -113,9 +113,7 @@ func Run(name, version string, args []string, stdin io.Reader, stdout, stderr io return exitCode } -// Main has the required function signature for use with testscript func Main() int { - return Run( "tfplugindocs", build.GetVersion(), @@ -125,3 +123,8 @@ func Main() int { colorable.NewColorableStderr(), ) } + +// TestScriptMain has the required function signature for use with testscript +func TestScriptMain() { + Main() // Exit code is no longer used by testscript +} diff --git a/tools/go.mod b/tools/go.mod index 1e0f5946..938dd04b 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,6 +1,6 @@ module tools -go 1.22.7 +go 1.23.7 require github.com/hashicorp/copywrite v0.21.0 @@ -47,14 +47,14 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/thanhpk/randstr v1.0.4 // indirect go.mongodb.org/mongo-driver v1.10.0 // indirect - golang.org/x/crypto v0.31.0 // indirect + golang.org/x/crypto v0.36.0 // indirect golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect - golang.org/x/net v0.33.0 // indirect + golang.org/x/net v0.37.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/term v0.27.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/sync v0.12.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/term v0.30.0 // indirect + golang.org/x/text v0.23.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/go.sum b/tools/go.sum index fcb73234..abe7c9dc 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -372,8 +372,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM= golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= @@ -411,8 +411,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= 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-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -429,8 +429,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= +golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -477,16 +477,16 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= +golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -498,8 +498,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 5406ca47305f7d4daf85d26ce5236b57ebce28bb Mon Sep 17 00:00:00 2001 From: Justin Retzolk <44710313+justinretzolk@users.noreply.github.com> Date: Wed, 19 Mar 2025 09:03:18 -0500 Subject: [PATCH 03/33] Add `allowed-(guide|resource)-subcategories` and `allowed-(guide|resource)-subcategories-file` arguments to `validate` (#456) * Add flags for subcategory validation * Add ValidatorOptions and function to load allowed subcategories * Add allowed subcategories check to frontmatter check * Remove index subcategories check * Correct guides check bug * Clean up * Update README, additional cleanup * Minor formatting update to README * Fix linting errors * Add flags for subcategory validation * Add ValidatorOptions and function to load allowed subcategories * Add allowed subcategories check to frontmatter check * Remove index subcategories check * Correct guides check bug * Clean up * Update README, additional cleanup * Minor formatting update to README * Fix linting errors * Add changelog entries --- .../unreleased/BUG FIXES-20250318-151955.yaml | 5 ++ .../ENHANCEMENTS-20250318-152238.yaml | 5 ++ .../ENHANCEMENTS-20250318-152345.yaml | 5 ++ README.md | 62 +++++++++--------- internal/check/frontmatter.go | 22 +++++-- internal/check/frontmatter_test.go | 22 +++++++ internal/cmd/validate.go | 24 +++++-- .../testdata/allowed-subcategories.txt | 3 + internal/provider/util.go | 25 +++++++ internal/provider/validate.go | 65 ++++++++++++++++++- internal/provider/validate_test.go | 49 ++++++++++++++ 11 files changed, 245 insertions(+), 42 deletions(-) create mode 100644 .changes/unreleased/BUG FIXES-20250318-151955.yaml create mode 100644 .changes/unreleased/ENHANCEMENTS-20250318-152238.yaml create mode 100644 .changes/unreleased/ENHANCEMENTS-20250318-152345.yaml create mode 100644 internal/provider/testdata/allowed-subcategories.txt diff --git a/.changes/unreleased/BUG FIXES-20250318-151955.yaml b/.changes/unreleased/BUG FIXES-20250318-151955.yaml new file mode 100644 index 00000000..94a5dd94 --- /dev/null +++ b/.changes/unreleased/BUG FIXES-20250318-151955.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: 'validate: Fixed a bug that caused all non-index files to be detected as guides' +time: 2025-03-18T15:19:55.463729-05:00 +custom: + Issue: "456" diff --git a/.changes/unreleased/ENHANCEMENTS-20250318-152238.yaml b/.changes/unreleased/ENHANCEMENTS-20250318-152238.yaml new file mode 100644 index 00000000..5b012c0d --- /dev/null +++ b/.changes/unreleased/ENHANCEMENTS-20250318-152238.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: 'validate: Add `allowed-guide-subcategories` and `allowed-resource-subcategories` to provide a list of allowed subcategories' +time: 2025-03-18T15:22:38.292714-05:00 +custom: + Issue: "456" diff --git a/.changes/unreleased/ENHANCEMENTS-20250318-152345.yaml b/.changes/unreleased/ENHANCEMENTS-20250318-152345.yaml new file mode 100644 index 00000000..5b0e6ae7 --- /dev/null +++ b/.changes/unreleased/ENHANCEMENTS-20250318-152345.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: 'validate: Add `allowed-guide-subcategories-file` and `allowed-resource-subcategories-file` to provide a file containing a list of allowed subcategories' +time: 2025-03-18T15:23:45.718553-05:00 +custom: + Issue: "456" diff --git a/README.md b/README.md index b1e6d166..1a6bedb3 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Available commands are: generate generates a plugin website from code, templates, and examples migrate migrates website files from either the legacy rendered website directory (`website/docs/r`) or the docs rendered website directory (`docs/resources`) to the tfplugindocs supported structure (`templates/`). validate validates a plugin website - + ``` `generate` command: @@ -65,14 +65,14 @@ Usage: tfplugindocs generate [] --examples-dir examples directory based on provider-dir (default: "examples") --ignore-deprecated don't generate documentation for deprecated resources and data-sources (default: "false") - --provider-dir relative or absolute path to the root provider code directory when running the command outside the root provider code directory - --provider-name provider name, as used in Terraform configurations; defaults to the --provider-dir short name (after removing `terraform-provider-` prefix) - --providers-schema path to the providers schema JSON file, which contains the output of the terraform providers schema -json command. Setting this flag will skip building the provider and calling Terraform CLI - --rendered-provider-name provider name, as generated in documentation (ex. page titles, ...) + --provider-dir relative or absolute path to the root provider code directory when running the command outside the root provider code directory + --provider-name provider name, as used in Terraform configurations; defaults to the --provider-dir short name (after removing `terraform-provider-` prefix) + --providers-schema path to the providers schema JSON file, which contains the output of the terraform providers schema -json command. Setting this flag will skip building the provider and calling Terraform CLI + --rendered-provider-name provider name, as generated in documentation (ex. page titles, ...) --rendered-website-dir output directory based on provider-dir (default: "docs") - --tf-version terraform binary version to download. If not provided, will look for a terraform binary in the local environment. If not found in the environment, will download the latest version of Terraform + --tf-version terraform binary version to download. If not provided, will look for a terraform binary in the local environment. If not found in the environment, will download the latest version of Terraform --website-source-dir templates directory based on provider-dir (default: "templates") - --website-temp-dir temporary directory (used during generation) + --website-temp-dir temporary directory (used during generation) ``` `validate` command: @@ -82,10 +82,14 @@ $ tfplugindocs validate --help Usage: tfplugindocs validate [] - --provider-dir relative or absolute path to the root provider code directory; this will default to the current working directory if not set - --provider-name provider name, as used in Terraform configurations; defaults to the --provider-dir short name (after removing `terraform-provider-` prefix) - --providers-schema path to the providers schema JSON file, which contains the output of the terraform providers schema -json command. Setting this flag will skip building the provider and calling Terraform CLI - --tf-version terraform binary version to download. If not provided, will look for a terraform binary in the local environment. If not found in the environment, will download the latest version of Terraform + --allowed-guide-subcategories comma separated list of allowed guide frontmatter subcategories + --allowed-guide-subcategories-file path to newline separated file of allowed guide frontmatter subcategories + --allowed-resource-subcategories comma separated list of allowed resource frontmatter subcategories + --allowed-resource-subcategories-file path to newline separated file of allowed resource frontmatter subcategories + --provider-dir relative or absolute path to the root provider code directory; this will default to the current working directory if not set + --provider-name provider name, as used in Terraform configurations; defaults to the --provider-dir short name (after removing `terraform-provider-` prefix) + --providers-schema path to the providers schema JSON file, which contains the output of the terraform providers schema -json command. Setting this flag will skip building the provider and calling Terraform CLI + --tf-version terraform binary version to download. If not provided, will look for a terraform binary in the local environment. If not found in the environment, will download the latest version of Terraform ``` `migrate` command: @@ -98,7 +102,7 @@ Usage: tfplugindocs migrate [] --examples-dir examples directory based on provider-dir (default: "examples") --provider-dir relative or absolute path to the root provider code directory when running the command outside the root provider code directory --templates-dir new website templates directory based on provider-dir; files will be migrated to this directory (default: "templates") - --provider-name provider name, as used in Terraform configurations; defaults to the --provider-dir short name (after removing `terraform-provider-` prefix) + --provider-name provider name, as used in Terraform configurations; defaults to the --provider-dir short name (after removing `terraform-provider-` prefix) ``` ### How it Works @@ -161,22 +165,22 @@ Otherwise, the provider developer can set an arbitrary description like this: The `validate` subcommand can be used to validate the provider website documentation against the [Terraform Registry's provider documentation guidelines](https://developer.hashicorp.com/terraform/registry/providers/docs) and provider documentation best practices. The current checks in the `validate` command are: -| Check | Description | -|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `InvalidDirectoriesCheck` | Checks for valid subdirectory structure and throws an error if an invalid Terraform Provider documentation subdirectory is found. | -| `MixedDirectoriesCheck` | Throws an error if both legacy documentation (`/website/docs`) and registry documentation (`/docs`) are found. | -| `FileSizeCheck` | Throws an error if the documentation file is above the registry storage limit. | -| `FileExtensionCheck` | Throws an error if the extension of the given file is not a valid registry documentation extension. | -| `FrontMatterCheck` | Checks the YAML frontmatter of documentation for missing required fields or invalid fields. | -| `FileMismatchCheck` | Throws an error if the names/number of resources/datasources/functions in the provider schema does not match the names/number of files in the corresponding documentation directory | +| Check | Description | +|---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `InvalidDirectoriesCheck` | Checks for valid subdirectory structure and throws an error if an invalid Terraform Provider documentation subdirectory is found. | +| `MixedDirectoriesCheck` | Throws an error if both legacy documentation (`/website/docs`) and registry documentation (`/docs`) are found. | +| `FileSizeCheck` | Throws an error if the documentation file is above the registry storage limit. | +| `FileExtensionCheck` | Throws an error if the extension of the given file is not a valid registry documentation extension. | +| `FrontMatterCheck` | Checks the YAML frontmatter of documentation for missing required fields or invalid fields. Optionally, checks that the `subcategory` is within the specified allow list. | +| `FileMismatchCheck` | Throws an error if the names/number of resources/datasources/functions in the provider schema does not match the names/number of files in the corresponding documentation directory. | All check errors are wrapped and returned as a single error message to stderr. #### Migrate subcommand -The `migrate` subcommand can be used to migrate website files from either the legacy rendered website directory (`website/docs/r`) or the docs -rendered website directory (`docs/resources`) to the `tfplugindocs` supported structure (`templates/`). Markdown files in the rendered website -directory will be converted to `tfplugindocs` templates. The legacy `website/` directory will be removed after migration to avoid Terraform Registry +The `migrate` subcommand can be used to migrate website files from either the legacy rendered website directory (`website/docs/r`) or the docs +rendered website directory (`docs/resources`) to the `tfplugindocs` supported structure (`templates/`). Markdown files in the rendered website +directory will be converted to `tfplugindocs` templates. The legacy `website/` directory will be removed after migration to avoid Terraform Registry ingress issues. The `migrate` subcommand takes the following actions: @@ -260,10 +264,10 @@ Docs website directory structure: | `docs/functions/.html.markdown` | Function page | | `docs/resources/.html.markdown` | Resource page | -Files named `index` (before the first `.`) in the website docs root directory and files in the `website/docs/d/`, `website/docs/r/`, `docs/data-sources/`, -and `docs/resources/` subdirectories will be converted to `tfplugindocs` templates. +Files named `index` (before the first `.`) in the website docs root directory and files in the `website/docs/d/`, `website/docs/r/`, `docs/data-sources/`, +and `docs/resources/` subdirectories will be converted to `tfplugindocs` templates. -The `website/docs/guides/` and `docs/guides/` subdirectories will be copied as-is to the `--templates-dir` folder. +The `website/docs/guides/` and `docs/guides/` subdirectories will be copied as-is to the `--templates-dir` folder. All other files in the conventional paths will be ignored. @@ -356,13 +360,13 @@ This repo uses the `testscript` [package](https://pkg.go.dev/github.com/rogpeppe There are two types of acceptance tests: full provider build tests in `tfplugindocs/testdata/scripts/provider-build` and provider schema json tests in `tfplugindocs/testdata/scripts/schema-json`. -Provider build tests run the default `tfplugindocs` command which builds the provider source code and runs Terraform to retrieve the schema. These tests require the full provider source code to build a valid provider binary. +Provider build tests run the default `tfplugindocs` command which builds the provider source code and runs Terraform to retrieve the schema. These tests require the full provider source code to build a valid provider binary. -Schema json tests run the `tfplugindocs` command with the `--providers-schema=` flag to specify a provider schemas json file. This allows the test to skip the provider build and Terraform CLI call, instead using the specified file to generate docs. +Schema json tests run the `tfplugindocs` command with the `--providers-schema=` flag to specify a provider schemas json file. This allows the test to skip the provider build and Terraform CLI call, instead using the specified file to generate docs. You can run `make testacc` to run the full suite of acceptance tests. By default, the provider build acceptance tests will create a temporary directory in `/tmp/tftmp` for testing, but you can change this location in `cmd/tfplugindocs/main_test.go`. The schema json tests uses the `testscript` package's [default work directory](https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript#Params.WorkdirRoot). The test scripts are defined in the `tfplugindocs/testdata/scripts` directory. Each script includes the test, golden files, and the provider source code or schema JSON file needed to run the test. -Each script is a [text archive](https://pkg.go.dev/golang.org/x/tools/txtar). You can install the `txtar` CLI locally by running `go install golang.org/x/exp/cmd/txtar@latest` to extract the files in the test script for debugging. +Each script is a [text archive](https://pkg.go.dev/golang.org/x/tools/txtar). You can install the `txtar` CLI locally by running `go install golang.org/x/exp/cmd/txtar@latest` to extract the files in the test script for debugging. You can also use `txtar` CLI archive files into the `.txtar` format to create new tests or modify existing ones. diff --git a/internal/check/frontmatter.go b/internal/check/frontmatter.go index 65ac43aa..7afa4b8c 100644 --- a/internal/check/frontmatter.go +++ b/internal/check/frontmatter.go @@ -6,6 +6,7 @@ package check import ( "bytes" "fmt" + "slices" "github.com/yuin/goldmark" "github.com/yuin/goldmark/parser" @@ -27,13 +28,14 @@ type FrontMatterData struct { // FrontMatterOptions represents configuration options for FrontMatter. type FrontMatterOptions struct { - NoLayout bool - NoPageTitle bool - NoSidebarCurrent bool - NoSubcategory bool - RequireDescription bool - RequireLayout bool - RequirePageTitle bool + AllowedSubcategories []string + NoLayout bool + NoPageTitle bool + NoSidebarCurrent bool + NoSubcategory bool + RequireDescription bool + RequireLayout bool + RequirePageTitle bool } func NewFrontMatterCheck(opts *FrontMatterOptions) *FrontMatterCheck { @@ -100,5 +102,11 @@ func (check *FrontMatterCheck) Run(src []byte) error { return fmt.Errorf("YAML frontmatter missing required page_title") } + if allowedSubcategories := check.Options.AllowedSubcategories; len(allowedSubcategories) != 0 && frontMatter.Subcategory != nil { + if !slices.Contains(allowedSubcategories, *frontMatter.Subcategory) { + return fmt.Errorf("YAML frontmatter contains a subcategory (%s) that is not in the allowed list", *frontMatter.Subcategory) + } + } + return nil } diff --git a/internal/check/frontmatter_test.go b/internal/check/frontmatter_test.go index b915eb98..707e975f 100644 --- a/internal/check/frontmatter_test.go +++ b/internal/check/frontmatter_test.go @@ -138,6 +138,28 @@ subcategory: Example Subcategory }, ExpectError: true, }, + "allowed subcategory option": { + Source: ` +--- +subcategory: Example Subcategory +--- +`, + Options: &FrontMatterOptions{ + AllowedSubcategories: []string{"Example Subcategory"}, + }, + ExpectError: false, + }, + "disallowed subcategory option": { + Source: ` +--- +subcategory: Example Subcategory +--- +`, + Options: &FrontMatterOptions{ + AllowedSubcategories: []string{"Subcategory"}, + }, + ExpectError: true, + }, } for name, testCase := range testCases { diff --git a/internal/cmd/validate.go b/internal/cmd/validate.go index 55107f3c..fdd4601e 100644 --- a/internal/cmd/validate.go +++ b/internal/cmd/validate.go @@ -15,10 +15,14 @@ import ( type validateCmd struct { commonCmd - flagProviderName string - flagProviderDir string - flagProvidersSchema string - tfVersion string + flagAllowedGuideSubcategories string + flagAllowedGuideSubcategoriesFile string + flagAllowedResourceSubcategories string + flagAllowedResourceSubcategoriesFile string + flagProviderName string + flagProviderDir string + flagProvidersSchema string + tfVersion string } func (cmd *validateCmd) Synopsis() string { @@ -65,6 +69,10 @@ func (cmd *validateCmd) Help() string { func (cmd *validateCmd) Flags() *flag.FlagSet { fs := flag.NewFlagSet("validate", flag.ExitOnError) + fs.StringVar(&cmd.flagAllowedGuideSubcategories, "allowed-guide-subcategories", "", "comma separated list of allowed guide frontmatter subcategories") + fs.StringVar(&cmd.flagAllowedGuideSubcategoriesFile, "allowed-guide-subcategories-file", "", "path to newline separated file of allowed guide frontmatter subcategories") + fs.StringVar(&cmd.flagAllowedResourceSubcategories, "allowed-resource-subcategories", "", "comma separated list of allowed resource frontmatter subcategories") + fs.StringVar(&cmd.flagAllowedResourceSubcategoriesFile, "allowed-resource-subcategories-file", "", "path to newline separated file of allowed resource frontmatter subcategories") fs.StringVar(&cmd.flagProviderName, "provider-name", "", "provider name, as used in Terraform configurations; defaults to the --provider-dir short name (after removing `terraform-provider-` prefix)") fs.StringVar(&cmd.flagProviderDir, "provider-dir", "", "relative or absolute path to the root provider code directory; this will default to the current working directory if not set") fs.StringVar(&cmd.flagProvidersSchema, "providers-schema", "", "path to the providers schema JSON file, which contains the output of the terraform providers schema -json command. Setting this flag will skip building the provider and calling Terraform CLI") @@ -84,11 +92,19 @@ func (cmd *validateCmd) Run(args []string) int { } func (cmd *validateCmd) runInternal() error { + opts := provider.ValidatorOptions{ + AllowedGuideSubcategories: cmd.flagAllowedGuideSubcategories, + AllowedGuideSubcategoriesFile: cmd.flagAllowedGuideSubcategoriesFile, + AllowedResourceSubcategories: cmd.flagAllowedResourceSubcategories, + AllowedResourceSubcategoriesFile: cmd.flagAllowedResourceSubcategoriesFile, + } + err := provider.Validate(cmd.ui, cmd.flagProviderDir, cmd.flagProviderName, cmd.flagProvidersSchema, cmd.tfVersion, + opts, ) if err != nil { return errors.Join(errors.New("validation errors found: "), err) diff --git a/internal/provider/testdata/allowed-subcategories.txt b/internal/provider/testdata/allowed-subcategories.txt new file mode 100644 index 00000000..7c0e7304 --- /dev/null +++ b/internal/provider/testdata/allowed-subcategories.txt @@ -0,0 +1,3 @@ +CategoryOne +CategoryTwo +CategoryThree diff --git a/internal/provider/util.go b/internal/provider/util.go index 9041cf01..bcb8084d 100644 --- a/internal/provider/util.go +++ b/internal/provider/util.go @@ -4,6 +4,7 @@ package provider import ( + "bufio" "errors" "fmt" "io" @@ -192,3 +193,27 @@ func newMarkdownRenderer() goldmark.Markdown { ) return gm } + +func allowedSubcategoriesFile(path string) ([]string, error) { + log.Printf("[DEBUG] Reading Subcategories File %s", path) + + file, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("error opening allowed subcategories file (%s): %w", path, err) + } + + defer file.Close() + + scanner := bufio.NewScanner(file) + + var allowedSubcategories []string + for scanner.Scan() { + allowedSubcategories = append(allowedSubcategories, scanner.Text()) + } + + if err := scanner.Err(); err != nil { + return nil, fmt.Errorf("error reading allowed subcategories file (%s): %w", path, err) + } + + return allowedSubcategories, nil +} diff --git a/internal/provider/validate.go b/internal/provider/validate.go index 0ba0fd21..b6139d52 100644 --- a/internal/provider/validate.go +++ b/internal/provider/validate.go @@ -11,6 +11,7 @@ import ( "log" "os" "path/filepath" + "strings" "github.com/bmatcuk/doublestar/v4" "github.com/hashicorp/cli" @@ -72,6 +73,13 @@ var RegistryGuideFrontMatterOptions = &check.FrontMatterOptions{ RequirePageTitle: true, } +type ValidatorOptions struct { + AllowedGuideSubcategories string + AllowedGuideSubcategoriesFile string + AllowedResourceSubcategories string + AllowedResourceSubcategoriesFile string +} + type validator struct { providerName string providerDir string @@ -81,10 +89,13 @@ type validator struct { tfVersion string providerSchema *tfjson.ProviderSchema + allowedGuideSubcategories []string + allowedResourceSubcategories []string + logger *Logger } -func Validate(ui cli.Ui, providerDir, providerName, providersSchemaPath, tfversion string) error { +func Validate(ui cli.Ui, providerDir, providerName, providersSchemaPath, tfversion string, opts ValidatorOptions) error { // Ensure provider directory is resolved absolute path if providerDir == "" { wd, err := os.Getwd() @@ -127,11 +138,44 @@ func Validate(ui cli.Ui, providerDir, providerName, providersSchemaPath, tfversi logger: NewLogger(ui), } + if err := v.loadAllowedSubcategories(opts); err != nil { + return fmt.Errorf("error loading allowed subcategories: %w", err) + } + ctx := context.Background() return v.validate(ctx) } +func (v *validator) loadAllowedSubcategories(opts ValidatorOptions) error { + + if o := opts.AllowedGuideSubcategories; o != "" { + v.allowedGuideSubcategories = strings.Split(o, ",") + } + + if o := opts.AllowedGuideSubcategoriesFile; o != "" { + allowedGuideSubcategories, err := allowedSubcategoriesFile(o) + if err != nil { + return fmt.Errorf("error getting allowed guide subcategories: %w", err) + } + v.allowedGuideSubcategories = allowedGuideSubcategories + } + + if o := opts.AllowedResourceSubcategories; o != "" { + v.allowedResourceSubcategories = strings.Split(o, ",") + } + + if o := opts.AllowedResourceSubcategoriesFile; o != "" { + allowedResourceSubcategories, err := allowedSubcategoriesFile(o) + if err != nil { + return fmt.Errorf("error getting allowed resource subcategories: %w", err) + } + v.allowedResourceSubcategories = allowedResourceSubcategories + } + + return nil +} + func (v *validator) validate(ctx context.Context) error { var result error @@ -219,12 +263,25 @@ func (v *validator) validateStaticDocs() error { } // Configure FrontMatterOptions based on file type + relativeToGuides, err := filepath.Rel(dir+"/guides", path) + if err != nil { + return fmt.Errorf("error determining relative path (%s): %w", path, err) + } + if removeAllExt(d.Name()) == "index" { options.FrontMatter = RegistryIndexFrontMatterOptions - } else if _, relErr := filepath.Rel(dir+"/guides", path); relErr == nil { + } else if filepath.IsLocal(relativeToGuides) { options.FrontMatter = RegistryGuideFrontMatterOptions + + if len(v.allowedGuideSubcategories) != 0 { + options.FrontMatter.AllowedSubcategories = v.allowedGuideSubcategories + } } else { options.FrontMatter = RegistryFrontMatterOptions + + if len(v.allowedResourceSubcategories) != 0 { + options.FrontMatter.AllowedSubcategories = v.allowedResourceSubcategories + } } v.logger.infof("running file checks on %s", path) result = errors.Join(result, check.NewProviderFileCheck(v.providerFS, options).Run(path)) @@ -308,6 +365,10 @@ func (v *validator) validateLegacyWebsite() error { options.FrontMatter = LegacyIndexFrontMatterOptions } else { options.FrontMatter = LegacyFrontMatterOptions + + if len(v.allowedResourceSubcategories) != 0 { + options.FrontMatter.AllowedSubcategories = v.allowedResourceSubcategories + } } v.logger.infof("running file checks on %s", path) result = errors.Join(result, check.NewProviderFileCheck(v.providerFS, options).Run(path)) diff --git a/internal/provider/validate_test.go b/internal/provider/validate_test.go index 3e092c51..63ea3b39 100644 --- a/internal/provider/validate_test.go +++ b/internal/provider/validate_test.go @@ -7,6 +7,7 @@ import ( "bytes" "io/fs" "path/filepath" + "slices" "testing" "testing/fstest" @@ -1119,6 +1120,54 @@ func TestDocumentationDirGlobPattern(t *testing.T) { } } +func TestLoadAllowedSubcategories(t *testing.T) { + t.Parallel() + + testCases := map[string]struct { + Options ValidatorOptions + CheckValue string + }{ + "list": { + Options: ValidatorOptions{ + AllowedGuideSubcategories: "CategoryOne,CategoryTwo,CategoryThree", + AllowedResourceSubcategories: "CategoryOne,CategoryTwo,CategoryThree", + }, + }, + "file": { + Options: ValidatorOptions{ + AllowedGuideSubcategoriesFile: "testdata/allowed-subcategories.txt", + AllowedResourceSubcategoriesFile: "testdata/allowed-subcategories.txt", + }, + }, + } + + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + t.Parallel() + + v := &validator{} + expected := []string{"CategoryOne", "CategoryTwo", "CategoryThree"} + + got := v.loadAllowedSubcategories(testCase.Options) + + if got != nil { + t.Fatalf("Unexpected error: %s", got) + } + + results := map[string][]string{ + "guide": v.allowedGuideSubcategories, + "resource": v.allowedResourceSubcategories, + } + + for checkName, value := range results { + if !slices.Equal(expected, value) { + t.Fatalf("unexpected result for allowed %s subcategories: wanted: %v, got: %v", checkName, expected, value) + } + } + }) + } +} + func encodeYAML(t *testing.T, data *FrontMatterData) []byte { t.Helper() var buf bytes.Buffer From 992989fc2a97e26cc158d9983b8a419a450b3123 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 15:20:19 -0400 Subject: [PATCH 04/33] Bump github.com/hashicorp/copywrite from 0.21.0 to 0.22.0 in /tools (#461) Bumps [github.com/hashicorp/copywrite](https://github.com/hashicorp/copywrite) from 0.21.0 to 0.22.0. - [Release notes](https://github.com/hashicorp/copywrite/releases) - [Changelog](https://github.com/hashicorp/copywrite/blob/main/.goreleaser.yaml) - [Commits](https://github.com/hashicorp/copywrite/compare/v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/copywrite dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 938dd04b..7ba09d85 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -2,7 +2,7 @@ module tools go 1.23.7 -require github.com/hashicorp/copywrite v0.21.0 +require github.com/hashicorp/copywrite v0.22.0 require ( github.com/AlecAivazis/survey/v2 v2.3.7 // indirect diff --git a/tools/go.sum b/tools/go.sum index abe7c9dc..f5e51f9d 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -144,8 +144,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.13.0/go.mod h1:ZlVrynguJKcYr54zGaDbaL3fOvKC9m72FhPvA8T35KQ= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/copywrite v0.21.0 h1:IE8uByQdos8s0uAyHF4O8RHV5cJEhmIc+Awk+wkKXKI= -github.com/hashicorp/copywrite v0.21.0/go.mod h1:mu6DAyUI6m6vq8weoJn9a0HDuUUrV+0GQdRp4mD50yU= +github.com/hashicorp/copywrite v0.22.0 h1:mqjMrgP3VptS7aLbu2l39rtznoK+BhphHst6i7HiTAo= +github.com/hashicorp/copywrite v0.22.0/go.mod h1:FqvGJt2+yoYDpVYgFSdg3R2iyhkCVaBmPMhfso0MR2k= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= From d54c073d9a16fd967aab942d5cb2f5c915fdea57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 11:08:59 -0400 Subject: [PATCH 05/33] Bump github.com/golang-jwt/jwt/v4 from 4.5.1 to 4.5.2 in /tools (#462) Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.1 to 4.5.2. - [Release notes](https://github.com/golang-jwt/jwt/releases) - [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md) - [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.1...v4.5.2) --- updated-dependencies: - dependency-name: github.com/golang-jwt/jwt/v4 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 7ba09d85..e4ab24aa 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -17,7 +17,7 @@ require ( github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-openapi/errors v0.20.2 // indirect github.com/go-openapi/strfmt v0.21.3 // indirect - github.com/golang-jwt/jwt/v4 v4.5.1 // indirect + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-github/v45 v45.2.0 // indirect github.com/google/go-github/v53 v53.0.0 // indirect diff --git a/tools/go.sum b/tools/go.sum index f5e51f9d..d5a7ac1f 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -96,8 +96,8 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= -github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= From 6ea34fa0e03e4a165ba53f8958cb1cd2d6b386d9 Mon Sep 17 00:00:00 2001 From: "hashicorp-tsccr[bot]" <129506189+hashicorp-tsccr[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 11:22:22 -0400 Subject: [PATCH 06/33] Result of tsccr-helper -log-level=info gha update -latest .github/ (#463) Co-authored-by: hashicorp-tsccr[bot] --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a7a0ba1..9baefa53 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: with: go-version-file: 'go.mod' - name: Run linters - uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0 + uses: golangci/golangci-lint-action@4696ba8babb6127d732c3c6dde519db15edab9ea # v6.5.1 with: version: latest args: --timeout=3m From 52d2a892f79b2503f84a5b45b615b4bc11c04e32 Mon Sep 17 00:00:00 2001 From: "hashicorp-tsccr[bot]" <129506189+hashicorp-tsccr[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 10:48:29 -0500 Subject: [PATCH 07/33] SEC-090: Automated trusted workflow pinning (2025-04-07) (#466) * Result of tsccr-helper -log-level=info gha update -latest .github/ * golangci-lint migrate --------- Co-authored-by: hashicorp-tsccr[bot] Co-authored-by: Baraa Basata --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- .golangci.yml | 43 ++++++++++++++++++++++++++--------- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb7bc6ab..f976e4ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,7 +84,7 @@ jobs: ref: ${{ inputs.versionNumber }} fetch-depth: 0 - - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 with: go-version-file: 'go.mod' @@ -93,7 +93,7 @@ jobs: cd .changes sed -e "1{/# /d;}" -e "2{/^$/d;}" ${{ needs.changelog-version.outputs.version }}.md > /tmp/release-notes.txt - - uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1 + - uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9baefa53..c3c16f6e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,11 +23,11 @@ jobs: - name: Check out code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Go - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 with: go-version-file: 'go.mod' - name: Run linters - uses: golangci/golangci-lint-action@4696ba8babb6127d732c3c6dde519db15edab9ea # v6.5.1 + uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 with: version: latest args: --timeout=3m diff --git a/.golangci.yml b/.golangci.yml index 1e7c56bf..17f5c44c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,16 +1,11 @@ -issues: - max-issues-per-linter: 0 - max-same-issues: 0 - +version: "2" linters: - disable-all: true + default: none enable: - copyloopvar - durationcheck - errcheck - forcetypeassert - - gofmt - - gosimple - govet - ineffassign - makezero @@ -23,7 +18,33 @@ linters: - unparam - unused - usetesting - -run: - # Prevent false positive timeouts in CI - timeout: 5m + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - third_party$ + - builtin$ + - examples$ + settings: + staticcheck: + checks: + - all + - '-QF1002' # "could use tagged switch" -- https://staticcheck.dev/docs/checks/#QF1002 + - '-QF1012' # "Use fmt.Fprintf(...) instead of WriteString" -- https://staticcheck.dev/docs/checks/#QF1012 + - '-ST1003' # example: "const autoTFVarsJson should be autoTFVarsJSON" -- https://staticcheck.dev/docs/checks/#ST1003 +issues: + max-issues-per-linter: 0 + max-same-issues: 0 +formatters: + enable: + - gofmt + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ From 535d816a35cf406170c39b07c54106c6956b88c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 18:25:45 -0400 Subject: [PATCH 08/33] Bump golang.org/x/text from 0.23.0 to 0.24.0 (#467) Bumps [golang.org/x/text](https://github.com/golang/text) from 0.23.0 to 0.24.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.23.0...v0.24.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-version: 0.24.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 1e597501..b126f948 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/zclconf/go-cty v1.16.2 go.abhg.dev/goldmark/frontmatter v0.2.0 golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df - golang.org/x/text v0.23.0 + golang.org/x/text v0.24.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 599d6357..32dae866 100644 --- a/go.sum +++ b/go.sum @@ -154,8 +154,8 @@ golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= +golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -172,8 +172,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From 10d3159585198836578b4fd0f9c17d495e03404b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 16:43:19 -0400 Subject: [PATCH 09/33] Bump github.com/hashicorp/hc-install from 0.9.1 to 0.9.2 (#469) Bumps [github.com/hashicorp/hc-install](https://github.com/hashicorp/hc-install) from 0.9.1 to 0.9.2. - [Release notes](https://github.com/hashicorp/hc-install/releases) - [Commits](https://github.com/hashicorp/hc-install/compare/v0.9.1...v0.9.2) --- updated-dependencies: - dependency-name: github.com/hashicorp/hc-install dependency-version: 0.9.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 ++++---- go.sum | 46 ++++++++++++++++++++++------------------------ 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index b126f948..e8bc2d0f 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/go-cmp v0.7.0 github.com/hashicorp/cli v1.1.7 github.com/hashicorp/go-version v1.7.0 - github.com/hashicorp/hc-install v0.9.1 + github.com/hashicorp/hc-install v0.9.2 github.com/hashicorp/terraform-exec v0.22.0 github.com/hashicorp/terraform-json v0.24.0 github.com/mattn/go-colorable v0.1.14 @@ -27,11 +27,11 @@ require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.2.0 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect - github.com/ProtonMail/go-crypto v1.1.3 // indirect + github.com/ProtonMail/go-crypto v1.1.6 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect - github.com/cloudflare/circl v1.3.7 // indirect + github.com/cloudflare/circl v1.6.0 // indirect github.com/fatih/color v1.16.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -50,7 +50,7 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect golang.org/x/crypto v0.36.0 // indirect - golang.org/x/mod v0.22.0 // indirect + golang.org/x/mod v0.24.0 // indirect golang.org/x/net v0.37.0 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/tools v0.26.0 // indirect diff --git a/go.sum b/go.sum index 32dae866..a1dfa892 100644 --- a/go.sum +++ b/go.sum @@ -10,10 +10,10 @@ github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7Y github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/ProtonMail/go-crypto v1.1.3 h1:nRBOetoydLeUb4nHajyO2bKqMLfWQ/ZPwkXqXxPxCFk= -github.com/ProtonMail/go-crypto v1.1.3/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw= +github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= @@ -22,10 +22,10 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmatcuk/doublestar/v4 v4.8.1 h1:54Bopc5c2cAvhLRAzqOGCYHYyhcDHsFF4wWIR5wKP38= github.com/bmatcuk/doublestar/v4 v4.8.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= -github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= -github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo= -github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk= +github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= +github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= +github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= 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= @@ -37,12 +37,12 @@ github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3 github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.6.0 h1:w2hPNtoehvJIxR00Vb4xX94qHQi/ApZfX+nBE2Cjio8= -github.com/go-git/go-billy/v5 v5.6.0/go.mod h1:sFDq7xD3fn3E0GOwUSZqHo9lrkmx8xJhA0ZrfvjBRGM= -github.com/go-git/go-git/v5 v5.13.0 h1:vLn5wlGIh/X78El6r3Jr+30W16Blk0CTcxTYcYPWi5E= -github.com/go-git/go-git/v5 v5.13.0/go.mod h1:Wjo7/JyVKtQgUNdXYXIepzWfJQkUEIGvkvVkiXRR/zw= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM= +github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU= +github.com/go-git/go-git/v5 v5.14.0 h1:/MD3lCrGjCen5WfEAzKg00MJJffKhC8gzS80ycmCi60= +github.com/go-git/go-git/v5 v5.14.0/go.mod h1:Z5Xhoia5PcWA3NF8vRLURn9E5FRhSl7dGj9ItW3Wk5k= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -70,8 +70,8 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hc-install v0.9.1 h1:gkqTfE3vVbafGQo6VZXcy2v5yoz2bE0+nhZXruCuODQ= -github.com/hashicorp/hc-install v0.9.1/go.mod h1:pWWvN/IrfeBK4XPeXXYkL6EjMufHkCK5DvwxeLKuBf0= +github.com/hashicorp/hc-install v0.9.2 h1:v80EtNX4fCVHqzL9Lg/2xkp62bbvQMnvPQ0G+OmtO24= +github.com/hashicorp/hc-install v0.9.2/go.mod h1:XUqBQNnuT4RsxoxiM9ZaUk0NX8hi2h+Lb6/c0OZnC/I= github.com/hashicorp/terraform-exec v0.22.0 h1:G5+4Sz6jYZfRYUCg6eQgDsqTzkNXV+fP8l+uRmZHj64= github.com/hashicorp/terraform-exec v0.22.0/go.mod h1:bjVbsncaeh8jVdhttWYZuBGj21FcYw6Ia/XfHcNO7lQ= github.com/hashicorp/terraform-json v0.24.0 h1:rUiyF+x1kYawXeRth6fKFm/MdfBS6+lW4NbeATsYz8Q= @@ -101,8 +101,8 @@ github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HK github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= -github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= +github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= 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/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= @@ -114,8 +114,8 @@ github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/skeema/knownhosts v1.3.0 h1:AM+y0rI04VksttfwjkSTNQorvGqmwATnvnAHpSgc0LY= -github.com/skeema/knownhosts v1.3.0/go.mod h1:sPINvnADmT/qYH1kfv+ePMmOBTH6Tbl7b5LvTDjFK7M= +github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= +github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= @@ -144,8 +144,8 @@ golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZv golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -154,8 +154,6 @@ golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= -golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From 5f172ed2a0676a49c08aba3a0c4c31bbb6790b29 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 16:46:01 -0400 Subject: [PATCH 10/33] Bump github.com/hashicorp/terraform-exec from 0.22.0 to 0.23.0 (#468) Bumps [github.com/hashicorp/terraform-exec](https://github.com/hashicorp/terraform-exec) from 0.22.0 to 0.23.0. - [Release notes](https://github.com/hashicorp/terraform-exec/releases) - [Changelog](https://github.com/hashicorp/terraform-exec/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-exec/compare/v0.22.0...v0.23.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-exec dependency-version: 0.23.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e8bc2d0f..8793ac69 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/hashicorp/cli v1.1.7 github.com/hashicorp/go-version v1.7.0 github.com/hashicorp/hc-install v0.9.2 - github.com/hashicorp/terraform-exec v0.22.0 + github.com/hashicorp/terraform-exec v0.23.0 github.com/hashicorp/terraform-json v0.24.0 github.com/mattn/go-colorable v0.1.14 github.com/rogpeppe/go-internal v1.14.1 diff --git a/go.sum b/go.sum index a1dfa892..5ac0a149 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKe github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/hc-install v0.9.2 h1:v80EtNX4fCVHqzL9Lg/2xkp62bbvQMnvPQ0G+OmtO24= github.com/hashicorp/hc-install v0.9.2/go.mod h1:XUqBQNnuT4RsxoxiM9ZaUk0NX8hi2h+Lb6/c0OZnC/I= -github.com/hashicorp/terraform-exec v0.22.0 h1:G5+4Sz6jYZfRYUCg6eQgDsqTzkNXV+fP8l+uRmZHj64= -github.com/hashicorp/terraform-exec v0.22.0/go.mod h1:bjVbsncaeh8jVdhttWYZuBGj21FcYw6Ia/XfHcNO7lQ= +github.com/hashicorp/terraform-exec v0.23.0 h1:MUiBM1s0CNlRFsCLJuM5wXZrzA3MnPYEsiXmzATMW/I= +github.com/hashicorp/terraform-exec v0.23.0/go.mod h1:mA+qnx1R8eePycfwKkCRk3Wy65mwInvlpAeOwmA7vlY= github.com/hashicorp/terraform-json v0.24.0 h1:rUiyF+x1kYawXeRth6fKFm/MdfBS6+lW4NbeATsYz8Q= github.com/hashicorp/terraform-json v0.24.0/go.mod h1:Nfj5ubo9xbu9uiAoZVBsNOjvNKB66Oyrvtit74kC7ow= github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= From a095fe12f4ddc597fa1f33ca6f569c21fa671c65 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 08:15:49 -0400 Subject: [PATCH 11/33] Bump golang.org/x/net from 0.37.0 to 0.38.0 in /tools (#471) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.37.0 to 0.38.0. - [Commits](https://github.com/golang/net/compare/v0.37.0...v0.38.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-version: 0.38.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index e4ab24aa..b9c4f8c0 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -49,7 +49,7 @@ require ( go.mongodb.org/mongo-driver v1.10.0 // indirect golang.org/x/crypto v0.36.0 // indirect golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect - golang.org/x/net v0.37.0 // indirect + golang.org/x/net v0.38.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect golang.org/x/sync v0.12.0 // indirect golang.org/x/sys v0.31.0 // indirect diff --git a/tools/go.sum b/tools/go.sum index d5a7ac1f..ac09f376 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -411,8 +411,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= +golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= 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-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= From 3a9b93cb5c86f6dcaf0478ee3eee10d21c80a2d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Apr 2025 08:25:04 -0400 Subject: [PATCH 12/33] Bump golang.org/x/net from 0.37.0 to 0.38.0 (#470) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.37.0 to 0.38.0. - [Commits](https://github.com/golang/net/compare/v0.37.0...v0.38.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-version: 0.38.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8793ac69..0b9421ef 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/spf13/cast v1.5.0 // indirect golang.org/x/crypto v0.36.0 // indirect golang.org/x/mod v0.24.0 // indirect - golang.org/x/net v0.37.0 // indirect + golang.org/x/net v0.38.0 // indirect golang.org/x/sys v0.31.0 // indirect golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect diff --git a/go.sum b/go.sum index 5ac0a149..8c4b531e 100644 --- a/go.sum +++ b/go.sum @@ -150,8 +150,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= +golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= From 2eeff7c4b0f58bb96c2dc1a5aafc822481a51ce7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 13:33:31 -0400 Subject: [PATCH 13/33] Bump golang.org/x/text from 0.24.0 to 0.25.0 (#473) Bumps [golang.org/x/text](https://github.com/golang/text) from 0.24.0 to 0.25.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-version: 0.25.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0b9421ef..8c67bac4 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/zclconf/go-cty v1.16.2 go.abhg.dev/goldmark/frontmatter v0.2.0 golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df - golang.org/x/text v0.24.0 + golang.org/x/text v0.25.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 8c4b531e..bca27a2f 100644 --- a/go.sum +++ b/go.sum @@ -170,8 +170,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= -golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= +golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From 528349494e1fb08e2e2378b521a0ee81a6bb0116 Mon Sep 17 00:00:00 2001 From: Baraa Basata Date: Tue, 13 May 2025 08:18:25 -0400 Subject: [PATCH 14/33] Add catalog metadata (META.d) (#474) * Add catalog metadata (META.d) * Add catalog metadata (META.d) --- .copywrite.hcl | 3 +++ META.d/_summary.yaml | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 META.d/_summary.yaml diff --git a/.copywrite.hcl b/.copywrite.hcl index 7169a19e..fd368544 100644 --- a/.copywrite.hcl +++ b/.copywrite.hcl @@ -5,6 +5,9 @@ project { copyright_year = 2020 header_ignore = [ + # internal catalog metadata (prose) + "META.d/**/*.yaml", + # changie tooling configuration and CHANGELOG entries (prose) ".changes/unreleased/*.yaml", ".changie.yaml", diff --git a/META.d/_summary.yaml b/META.d/_summary.yaml new file mode 100644 index 00000000..38bd6daf --- /dev/null +++ b/META.d/_summary.yaml @@ -0,0 +1,10 @@ +--- +schema: 1.1 + +partition: tf-ecosystem + +summary: + owner: team-tf-core-plugins + description: | + Generate and validate Terraform plugin/provider documentation. + visibility: public From 649bd19b94b2b21148dc4edc45442677c634859c Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Thu, 15 May 2025 13:12:46 +0200 Subject: [PATCH 15/33] github: Use Dependabot to keep Actions updated (#475) --- .github/dependabot.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9818590e..ed991eb9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,10 +13,7 @@ updates: schedule: # Check for updates to Go modules every weekday interval: "daily" - # Dependabot only updates hashicorp GHAs, external GHAs are managed by internal tooling (tsccr) - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" - allow: - - dependency-name: "hashicorp/*" From 69cb1a109feb8f256884e865925f6c9e59496a1b Mon Sep 17 00:00:00 2001 From: Denise Yu Date: Mon, 19 May 2025 04:04:19 -0400 Subject: [PATCH 16/33] Create pull_request_template.md (#481) --- .github/pull_request_template.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..38e8ce71 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,16 @@ +## Related Issue + +Fixes # + +## Description + +In plain English, describe your approach to addressing the issue linked above. For example, if you made a particular design decision, let us know why you chose this path instead of another solution. + + +## Rollback Plan + +- [ ] If a change needs to be reverted, we will roll out an update to the code within 7 days. + +## Changes to Security Controls + +Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain. From 3cf97a514e8e2e1c984a046d52345df3aa8da65c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 10:09:44 -0400 Subject: [PATCH 17/33] Bump github.com/zclconf/go-cty from 1.16.2 to 1.16.3 (#483) Bumps [github.com/zclconf/go-cty](https://github.com/zclconf/go-cty) from 1.16.2 to 1.16.3. - [Release notes](https://github.com/zclconf/go-cty/releases) - [Changelog](https://github.com/zclconf/go-cty/blob/main/CHANGELOG.md) - [Commits](https://github.com/zclconf/go-cty/compare/v1.16.2...v1.16.3) --- updated-dependencies: - dependency-name: github.com/zclconf/go-cty dependency-version: 1.16.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8c67bac4..db75294e 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/rogpeppe/go-internal v1.14.1 github.com/yuin/goldmark v1.7.7 github.com/yuin/goldmark-meta v1.1.0 - github.com/zclconf/go-cty v1.16.2 + github.com/zclconf/go-cty v1.16.3 go.abhg.dev/goldmark/frontmatter v0.2.0 golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df golang.org/x/text v0.25.0 diff --git a/go.sum b/go.sum index bca27a2f..5a324480 100644 --- a/go.sum +++ b/go.sum @@ -132,8 +132,8 @@ github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU= github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= -github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70= -github.com/zclconf/go-cty v1.16.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk= +github.com/zclconf/go-cty v1.16.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= From c134bbfe2e1d8065b3dfd489134d12596ee3f016 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 12:44:11 -0400 Subject: [PATCH 18/33] Bump github.com/hashicorp/terraform-json from 0.24.0 to 0.25.0 (#476) Bumps [github.com/hashicorp/terraform-json](https://github.com/hashicorp/terraform-json) from 0.24.0 to 0.25.0. - [Release notes](https://github.com/hashicorp/terraform-json/releases) - [Commits](https://github.com/hashicorp/terraform-json/compare/v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-json dependency-version: 0.25.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index db75294e..05882c22 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/hashicorp/go-version v1.7.0 github.com/hashicorp/hc-install v0.9.2 github.com/hashicorp/terraform-exec v0.23.0 - github.com/hashicorp/terraform-json v0.24.0 + github.com/hashicorp/terraform-json v0.25.0 github.com/mattn/go-colorable v0.1.14 github.com/rogpeppe/go-internal v1.14.1 github.com/yuin/goldmark v1.7.7 diff --git a/go.sum b/go.sum index 5a324480..5d461ce7 100644 --- a/go.sum +++ b/go.sum @@ -74,8 +74,8 @@ github.com/hashicorp/hc-install v0.9.2 h1:v80EtNX4fCVHqzL9Lg/2xkp62bbvQMnvPQ0G+O github.com/hashicorp/hc-install v0.9.2/go.mod h1:XUqBQNnuT4RsxoxiM9ZaUk0NX8hi2h+Lb6/c0OZnC/I= github.com/hashicorp/terraform-exec v0.23.0 h1:MUiBM1s0CNlRFsCLJuM5wXZrzA3MnPYEsiXmzATMW/I= github.com/hashicorp/terraform-exec v0.23.0/go.mod h1:mA+qnx1R8eePycfwKkCRk3Wy65mwInvlpAeOwmA7vlY= -github.com/hashicorp/terraform-json v0.24.0 h1:rUiyF+x1kYawXeRth6fKFm/MdfBS6+lW4NbeATsYz8Q= -github.com/hashicorp/terraform-json v0.24.0/go.mod h1:Nfj5ubo9xbu9uiAoZVBsNOjvNKB66Oyrvtit74kC7ow= +github.com/hashicorp/terraform-json v0.25.0 h1:rmNqc/CIfcWawGiwXmRuiXJKEiJu1ntGoxseG1hLhoQ= +github.com/hashicorp/terraform-json v0.25.0/go.mod h1:sMKS8fiRDX4rVlR6EJUMudg1WcanxCMoWwTLkgZP/vc= github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= From 085bf438ebbc1ad7ba93b404f766959875ce50a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 13:03:07 -0400 Subject: [PATCH 19/33] Bump golangci/golangci-lint-action from 7.0.0 to 8.0.0 (#479) Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 7.0.0 to 8.0.0. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/1481404843c368bc19ca9406f87d6e0fc97bdcfd...4afd733a84b1f43292c63897423277bb7f4313a9) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-version: 8.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3c16f6e..1e1fc434 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: with: go-version-file: 'go.mod' - name: Run linters - uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0 + uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 with: version: latest args: --timeout=3m From 9f2c4e6d69d78cf70e720611d4798faf33de0532 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 14:14:17 -0400 Subject: [PATCH 20/33] Bump actions/setup-go from 5.4.0 to 5.5.0 (#478) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.4.0 to 5.5.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/0aaccfd150d50ccaeb58ebd88d36e91967a5f35b...d35c59abb061a4a6fb18e82ac0862c26744d6ab5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-version: 5.5.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f976e4ef..48cd9c3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,7 +84,7 @@ jobs: ref: ${{ inputs.versionNumber }} fetch-depth: 0 - - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: 'go.mod' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e1fc434..a1227352 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - name: Check out code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup Go - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 with: go-version-file: 'go.mod' - name: Run linters From e3c4136fd2bcfe6009efa8b9ab7797b204b11cb3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 15:20:01 -0400 Subject: [PATCH 21/33] Bump github.com/cli/go-gh/v2 from 2.11.2 to 2.12.1 in /tools (#486) Bumps [github.com/cli/go-gh/v2](https://github.com/cli/go-gh) from 2.11.2 to 2.12.1. - [Release notes](https://github.com/cli/go-gh/releases) - [Commits](https://github.com/cli/go-gh/compare/v2.11.2...v2.12.1) --- updated-dependencies: - dependency-name: github.com/cli/go-gh/v2 dependency-version: 2.12.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tools/go.mod | 4 ++-- tools/go.sum | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index b9c4f8c0..03c735b0 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -10,7 +10,7 @@ require ( github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect github.com/bmatcuk/doublestar/v4 v4.6.0 // indirect github.com/bradleyfalzon/ghinstallation/v2 v2.5.0 // indirect - github.com/cli/go-gh/v2 v2.11.2 // indirect + github.com/cli/go-gh/v2 v2.12.1 // indirect github.com/cli/safeexec v1.0.0 // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/fatih/color v1.13.0 // indirect @@ -32,7 +32,7 @@ require ( github.com/knadh/koanf v1.5.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mergestat/timediff v0.0.3 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mitchellh/copystructure v1.2.0 // indirect diff --git a/tools/go.sum b/tools/go.sum index ac09f376..a6cf06d2 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -44,8 +44,8 @@ github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7N github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cli/go-gh/v2 v2.11.2 h1:oad1+sESTPNTiTvh3I3t8UmxuovNDxhwLzeMHk45Q9w= -github.com/cli/go-gh/v2 v2.11.2/go.mod h1:vVFhi3TfjseIW26ED9itAR8gQK0aVThTm8sYrsZ5QTI= +github.com/cli/go-gh/v2 v2.12.1 h1:SVt1/afj5FRAythyMV3WJKaUfDNsxXTIe7arZbwTWKA= +github.com/cli/go-gh/v2 v2.12.1/go.mod h1:+5aXmEOJsH9fc9mBHfincDwnS02j2AIA/DsTH0Bk5uw= github.com/cli/safeexec v1.0.0 h1:0VngyaIyqACHdcMNWfo6+KdUYnqEr2Sg+bSP1pdF+dI= github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -138,8 +138,9 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.13.0/go.mod h1:ZlVrynguJKcYr54zGaDbaL3fOvKC9m72FhPvA8T35KQ= @@ -236,8 +237,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mergestat/timediff v0.0.3 h1:ucCNh4/ZrTPjFZ081PccNbhx9spymCJkFxSzgVuPU+Y= github.com/mergestat/timediff v0.0.3/go.mod h1:yvMUaRu2oetc+9IbPLYBJviz6sA7xz8OXMDfhBl7YSI= From 5cdb0ab9245a831cf6a0fd41e4f2a0efeb385057 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 09:24:39 -0400 Subject: [PATCH 22/33] Bump golang.org/x/text from 0.25.0 to 0.26.0 (#487) Bumps [golang.org/x/text](https://github.com/golang/text) from 0.25.0 to 0.26.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.25.0...v0.26.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-version: 0.26.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 11 +++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 05882c22..e71bb5cc 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/zclconf/go-cty v1.16.3 go.abhg.dev/goldmark/frontmatter v0.2.0 golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df - golang.org/x/text v0.25.0 + golang.org/x/text v0.26.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -49,10 +49,9 @@ require ( github.com/posener/complete v1.2.3 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect - golang.org/x/crypto v0.36.0 // indirect - golang.org/x/mod v0.24.0 // indirect - golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/tools v0.26.0 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/mod v0.25.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/tools v0.33.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect ) diff --git a/go.sum b/go.sum index 5d461ce7..6f880cc4 100644 --- a/go.sum +++ b/go.sum @@ -139,19 +139,19 @@ go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= -golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= -golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= +golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -161,8 +161,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -170,13 +170,13 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4= -golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= +golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 3a0cd6f6d29fda4731791d7bcdc3bb46cb2049f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Jun 2025 12:58:52 -0400 Subject: [PATCH 23/33] Bump github.com/cloudflare/circl from 1.3.7 to 1.6.1 in /tools (#490) Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.7 to 1.6.1. - [Release notes](https://github.com/cloudflare/circl/releases) - [Commits](https://github.com/cloudflare/circl/compare/v1.3.7...v1.6.1) --- updated-dependencies: - dependency-name: github.com/cloudflare/circl dependency-version: 1.6.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 03c735b0..b7e30a0e 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -12,7 +12,7 @@ require ( github.com/bradleyfalzon/ghinstallation/v2 v2.5.0 // indirect github.com/cli/go-gh/v2 v2.12.1 // indirect github.com/cli/safeexec v1.0.0 // indirect - github.com/cloudflare/circl v1.3.7 // indirect + github.com/cloudflare/circl v1.6.1 // indirect github.com/fatih/color v1.13.0 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-openapi/errors v0.20.2 // indirect diff --git a/tools/go.sum b/tools/go.sum index a6cf06d2..d0dfd246 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -51,8 +51,8 @@ github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= -github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= +github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= From 20d59379a481902ab13b77deabad17683d2653dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Jun 2025 13:04:29 -0400 Subject: [PATCH 24/33] Bump github.com/cloudflare/circl from 1.6.0 to 1.6.1 (#491) Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.6.0 to 1.6.1. - [Release notes](https://github.com/cloudflare/circl/releases) - [Commits](https://github.com/cloudflare/circl/compare/v1.6.0...v1.6.1) --- updated-dependencies: - dependency-name: github.com/cloudflare/circl dependency-version: 1.6.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e71bb5cc..dc1eb81d 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect - github.com/cloudflare/circl v1.6.0 // indirect + github.com/cloudflare/circl v1.6.1 // indirect github.com/fatih/color v1.16.0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect diff --git a/go.sum b/go.sum index 6f880cc4..47226692 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmatcuk/doublestar/v4 v4.8.1 h1:54Bopc5c2cAvhLRAzqOGCYHYyhcDHsFF4wWIR5wKP38= github.com/bmatcuk/doublestar/v4 v4.8.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= -github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk= -github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= +github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= +github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 2ffec57b62671e96a119acc9617cf71c3133577b Mon Sep 17 00:00:00 2001 From: Joachim Desroches <129734564+jedesroches@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:54:08 +0200 Subject: [PATCH 25/33] Remove subcategory field from frontmatter in default provider template. (#446) * Remove subcategory field from frontmatter in default provider template. * Fix failing tests * Add changelog entry --------- Co-authored-by: Selena Goods --- .changes/unreleased/BUG FIXES-20250613-152846.yaml | 5 +++++ .../generate/framework_provider_success_no_templates.txtar | 1 - .../framework_provider_success_all_framework_types.txtar | 1 - .../generate/framework_provider_success_no_templates.txtar | 1 - .../scripts/schema-json/generate/nested_id_attribute.txtar | 1 - internal/provider/template.go | 1 - 6 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 .changes/unreleased/BUG FIXES-20250613-152846.yaml diff --git a/.changes/unreleased/BUG FIXES-20250613-152846.yaml b/.changes/unreleased/BUG FIXES-20250613-152846.yaml new file mode 100644 index 00000000..ab5359dd --- /dev/null +++ b/.changes/unreleased/BUG FIXES-20250613-152846.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: 'generate: Remove `subcategory` field from default provider templates' +time: 2025-06-13T15:28:46.039473-04:00 +custom: + Issue: "446" diff --git a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar index bb6e91cc..94f1c263 100644 --- a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar @@ -68,7 +68,6 @@ data "scaffolding_example" "example" { --- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "scaffolding Provider" -subcategory: "" description: |- Example provider --- diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_all_framework_types.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_all_framework_types.txtar index 813b5c6f..8aba3640 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_all_framework_types.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_all_framework_types.txtar @@ -32,7 +32,6 @@ rendering "resources/example.md.tmpl" --- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "scaffolding Provider" -subcategory: "" description: |- Example provider --- diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar index 861b396e..7710fdfb 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar @@ -103,7 +103,6 @@ example(input string, variadicInput string...) string --- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "scaffolding Provider" -subcategory: "" description: |- Example provider --- diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/nested_id_attribute.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/nested_id_attribute.txtar index 21628fae..886c20aa 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/nested_id_attribute.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/nested_id_attribute.txtar @@ -29,7 +29,6 @@ rendering "resources/example.md.tmpl" --- # generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "scaffolding Provider" -subcategory: "" description: |- Example provider --- diff --git a/internal/provider/template.go b/internal/provider/template.go index 58766489..9a965fc8 100644 --- a/internal/provider/template.go +++ b/internal/provider/template.go @@ -331,7 +331,6 @@ description: |- const defaultProviderTemplate providerTemplate = `--- ` + frontmatterComment + ` page_title: "{{.ProviderShortName}} Provider" -subcategory: "" description: |- {{ .Description | plainmarkdown | trimspace | prefixlines " " }} --- From 2f25d2c0d2305eb5117d85d3857416249874092a Mon Sep 17 00:00:00 2001 From: "Jonas L." Date: Mon, 16 Jun 2025 15:54:18 +0200 Subject: [PATCH 26/33] fix: remove double newlines when no variadic argument (#489) * fix: remove double newlines when no variadic argument * Add acceptance test * Add changelog entry --------- Co-authored-by: Selena Goods --- .../ENHANCEMENTS-20250613-162958.yaml | 5 ++ ...mework_provider_success_no_templates.txtar | 51 +++++++++++++++++++ internal/provider/template.go | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/ENHANCEMENTS-20250613-162958.yaml diff --git a/.changes/unreleased/ENHANCEMENTS-20250613-162958.yaml b/.changes/unreleased/ENHANCEMENTS-20250613-162958.yaml new file mode 100644 index 00000000..df64549f --- /dev/null +++ b/.changes/unreleased/ENHANCEMENTS-20250613-162958.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: 'generate: Remove trailing whitespace from default function template when `.HasVariadic` evaluates to false' +time: 2025-06-13T16:29:58.411584-04:00 +custom: + Issue: "489" diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar index 7710fdfb..ba8e1bfd 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar @@ -9,6 +9,7 @@ cmp docs/index.md expected-index.md cmp docs/data-sources/example.md expected-datasource.md cmp docs/resources/example.md expected-resource.md cmp docs/functions/example.md expected-function.md +cmp docs/functions/no-variadic.md expected-no-variadic-function.md cmp docs/ephemeral-resources/example.md expected-ephemeral-resource.md -- expected-output.txt -- @@ -22,6 +23,7 @@ generating missing data source content generating new template for data-source "scaffolding_example" generating missing function content generating new template for function "example" +generating new template for function "no-variadic" generating missing ephemeral resource content generating new template for "scaffolding_example" generating missing provider content @@ -32,6 +34,7 @@ rendering templated website to static markdown rendering "data-sources/example.md.tmpl" rendering "ephemeral-resources/example.md.tmpl" rendering "functions/example.md.tmpl" +rendering "functions/no-variadic.md.tmpl" rendering "index.md.tmpl" rendering "resources/example.md.tmpl" -- expected-datasource.md -- @@ -99,6 +102,38 @@ example(input string, variadicInput string...) string 1. `input` (String) Value to echo. 1. `variadicInput` (Variadic, String) Variadic input to echo. +-- expected-no-variadic-function.md -- +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "no-variadic function - terraform-provider-scaffolding" +subcategory: "" +description: |- + Echo a string +--- + +# function: no-variadic + +Given a string value, returns the same value. + +## Example Usage + +```terraform +output "test" { + value = provider::scaffolding::no-variadic("testvalue1") +} +``` + +## Signature + + +```text +no-variadic(input string) string +``` + +## Arguments + + +1. `input` (String) Value to echo. -- expected-index.md -- --- # generated by https://github.com/hashicorp/terraform-plugin-docs @@ -207,6 +242,10 @@ data "scaffolding_example" "example" { output "test" { value = provider::scaffolding::example("testvalue1", "testvalue2") } +-- examples/functions/no-variadic/function.tf -- +output "test" { + value = provider::scaffolding::no-variadic("testvalue1") +} -- examples/provider/provider.tf -- provider "scaffolding" { # example configuration here @@ -340,6 +379,18 @@ resource "scaffolding_example" "example" { "description": "Variadic input to echo.", "type": "string" } + }, + "no-variadic": { + "description": "Given a string value, returns the same value.", + "summary": "Echo a string", + "return_type": "string", + "parameters": [ + { + "name": "input", + "description": "Value to echo.", + "type": "string" + } + ] } } } diff --git a/internal/provider/template.go b/internal/provider/template.go index 9a965fc8..ab3bb669 100644 --- a/internal/provider/template.go +++ b/internal/provider/template.go @@ -323,7 +323,7 @@ description: |- ## Arguments {{ .FunctionArgumentsMarkdown }} -{{ if .HasVariadic -}} +{{- if .HasVariadic }} {{ .FunctionVariadicArgumentMarkdown }} {{- end }} ` From 8b2645d33ebb685b19030284154b5c7c1510fedf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 10:41:24 -0400 Subject: [PATCH 27/33] Bump github.com/yuin/goldmark from 1.7.7 to 1.7.12 (#484) * Bump github.com/yuin/goldmark from 1.7.7 to 1.7.12 Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.7 to 1.7.12. - [Release notes](https://github.com/yuin/goldmark/releases) - [Commits](https://github.com/yuin/goldmark/compare/v1.7.7...v1.7.12) --- updated-dependencies: - dependency-name: github.com/yuin/goldmark dependency-version: 1.7.12 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Remove deprecated `node.Text` references --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Selena Goods --- go.mod | 2 +- go.sum | 4 +-- internal/mdplain/renderer.go | 50 +++++++++++++++--------------------- internal/provider/migrate.go | 2 +- 4 files changed, 25 insertions(+), 33 deletions(-) diff --git a/go.mod b/go.mod index dc1eb81d..7ac7a84b 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/hashicorp/terraform-json v0.25.0 github.com/mattn/go-colorable v0.1.14 github.com/rogpeppe/go-internal v1.14.1 - github.com/yuin/goldmark v1.7.7 + github.com/yuin/goldmark v1.7.12 github.com/yuin/goldmark-meta v1.1.0 github.com/zclconf/go-cty v1.16.3 go.abhg.dev/goldmark/frontmatter v0.2.0 diff --git a/go.sum b/go.sum index 47226692..7953d842 100644 --- a/go.sum +++ b/go.sum @@ -128,8 +128,8 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU= -github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY= +github.com/yuin/goldmark v1.7.12/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk= diff --git a/internal/mdplain/renderer.go b/internal/mdplain/renderer.go index 93bd5ec7..bd6c9e11 100644 --- a/internal/mdplain/renderer.go +++ b/internal/mdplain/renderer.go @@ -26,59 +26,51 @@ func (r *TextRender) Render(w io.Writer, source []byte, n ast.Node) error { } switch node := node.(type) { - case *ast.Blockquote, *ast.Heading: + case *ast.Blockquote, *ast.CodeSpan: + return ast.WalkContinue, nil + case *ast.Heading, *ast.CodeBlock, *ast.List: doubleSpace(out) - out.Write(node.Text(source)) - return ast.WalkSkipChildren, nil + return ast.WalkContinue, nil case *ast.ThematicBreak: doubleSpace(out) return ast.WalkSkipChildren, nil - case *ast.CodeBlock: - doubleSpace(out) - for i := 0; i < node.Lines().Len(); i++ { - line := node.Lines().At(i) - out.Write(line.Value(source)) - } - return ast.WalkSkipChildren, nil case *ast.FencedCodeBlock: doubleSpace(out) doubleSpace(out) - for i := 0; i < node.Lines().Len(); i++ { - line := node.Lines().At(i) - _, _ = out.Write(line.Value(source)) - } - return ast.WalkSkipChildren, nil - case *ast.List: - doubleSpace(out) + out.Write(node.Lines().Value(source)) return ast.WalkContinue, nil case *ast.Paragraph: doubleSpace(out) - if node.Text(source)[0] == '|' { // Write tables as-is. - for i := 0; i < node.Lines().Len(); i++ { - line := node.Lines().At(i) - out.Write(line.Value(source)) - } + if node.Lines().Value(source)[0] == '|' { // Write tables as-is. + out.Write(node.Lines().Value(source)) return ast.WalkSkipChildren, nil } return ast.WalkContinue, nil case *extAST.Strikethrough: - out.Write(node.Text(source)) + out.Write(node.Lines().Value(source)) return ast.WalkContinue, nil case *ast.AutoLink: out.Write(node.URL(source)) return ast.WalkSkipChildren, nil - case *ast.CodeSpan: - out.Write(node.Text(source)) - return ast.WalkSkipChildren, nil case *ast.Link: - _, err := out.Write(node.Text(source)) + // we want to write the text of the + // link before the url + child := node.FirstChild() + if child != nil { + t, ok := child.(*ast.Text) + if ok { + out.Write(t.Value(source)) + } + } + if !isRelativeLink(node.Destination) { out.WriteString(" ") out.Write(node.Destination) } - return ast.WalkSkipChildren, err + + return ast.WalkSkipChildren, nil case *ast.Text: - out.Write(node.Text(source)) + out.Write(node.Value(source)) if node.SoftLineBreak() { doubleSpace(out) } diff --git a/internal/provider/migrate.go b/internal/provider/migrate.go index 9abd7734..68314c2a 100644 --- a/internal/provider/migrate.go +++ b/internal/provider/migrate.go @@ -296,7 +296,7 @@ func (m *migrator) ExtractCodeExamples(content []byte, newRelDir string, templat if fencedNode, isFenced := node.(*ast.FencedCodeBlock); isFenced && fencedNode.Info != nil { var ext, exampleName, examplePath, template string - lang := string(fencedNode.Info.Text(content)[:]) + lang := string(fencedNode.Info.Value(content)[:]) switch lang { case "hcl", "terraform": exampleCount++ From 03677020e0a08a75df4180baaace07b0e42a2fe3 Mon Sep 17 00:00:00 2001 From: Selena Goods Date: Mon, 16 Jun 2025 15:14:49 -0400 Subject: [PATCH 28/33] Generate: Use rendered provider name instead of provider name in default templates (#492) * Update the default provider, resource, and function templates to use `.RenderedProviderName` instead of `.ProviderName` * Update Readme * Update Readme * Add changelog entries * Fix tests * Sort schema keys when generating missing templates to ensure deterministic stdout. --- .../BREAKING CHANGES-20250613-135104.yaml | 6 +++ .../ENHANCEMENTS-20250613-134814.yaml | 5 +++ README.md | 8 ++-- ...ork_provider_success_named_templates.txtar | 24 +++++----- ...mework_provider_success_no_templates.txtar | 18 ++++---- internal/provider/generate.go | 45 +++++++++++++++++-- internal/provider/template.go | 10 ++--- 7 files changed, 82 insertions(+), 34 deletions(-) create mode 100644 .changes/unreleased/BREAKING CHANGES-20250613-135104.yaml create mode 100644 .changes/unreleased/ENHANCEMENTS-20250613-134814.yaml diff --git a/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml b/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml new file mode 100644 index 00000000..ddef526a --- /dev/null +++ b/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml @@ -0,0 +1,6 @@ +kind: BREAKING CHANGES +body: 'generate: The `.ProviderShortName` template function now uses the rendered provider name to derive the provider short name. Users that pass in the +`--rendered-provider-name` flag might see a different output for this function' +time: 2025-06-13T13:51:04.745115-04:00 +custom: + Issue: "492" diff --git a/.changes/unreleased/ENHANCEMENTS-20250613-134814.yaml b/.changes/unreleased/ENHANCEMENTS-20250613-134814.yaml new file mode 100644 index 00000000..271fcd99 --- /dev/null +++ b/.changes/unreleased/ENHANCEMENTS-20250613-134814.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: 'generate: Default resource and function templates now use `.RenderedProviderName` instead of `.ProviderName`' +time: 2025-06-13T13:48:14.705452-04:00 +custom: + Issue: "492" diff --git a/README.md b/README.md index 1a6bedb3..c9fb2a0b 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Usage: tfplugindocs generate [] --provider-dir relative or absolute path to the root provider code directory when running the command outside the root provider code directory --provider-name provider name, as used in Terraform configurations; defaults to the --provider-dir short name (after removing `terraform-provider-` prefix) --providers-schema path to the providers schema JSON file, which contains the output of the terraform providers schema -json command. Setting this flag will skip building the provider and calling Terraform CLI - --rendered-provider-name provider name, as generated in documentation (ex. page titles, ...) + --rendered-provider-name provider name, as generated in documentation (ex. page titles, ...); defaults to the --provider-name --rendered-website-dir output directory based on provider-dir (default: "docs") --tf-version terraform binary version to download. If not provided, will look for a terraform binary in the local environment. If not found in the environment, will download the latest version of Terraform --website-source-dir templates directory based on provider-dir (default: "templates") @@ -286,7 +286,7 @@ using the following data fields and functions: | `.HasExample` | bool | Is there an example file? | | `.ExampleFile` | string | Path to the file with the terraform configuration example | | `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | -| `.ProviderShortName` | string | Short version of the provider name (ex. `random`) | +| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | | `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` | | `.SchemaMarkdown` | string | a Markdown formatted Provider Schema definition | @@ -302,7 +302,7 @@ using the following data fields and functions: | `.HasImport` | bool | Is there an import file? | | `.ImportFile` | string | Path to the file with the command for importing the resource | | `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | -| `.ProviderShortName` | string | Short version of the provider name (ex. `random`) | +| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | | `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` | | `.SchemaMarkdown` | string | a Markdown formatted Resource / Data Source Schema definition | @@ -317,7 +317,7 @@ using the following data fields and functions: | `.HasExample` | bool | Is there an example file? | | `.ExampleFile` | string | Path to the file with the terraform configuration example | | `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | -| `.ProviderShortName` | string | Short version of the provider name (ex. `random`) | +| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | | `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` | | `.FunctionSignatureMarkdown` | string | a Markdown formatted Function signature | | `.FunctionArgumentsMarkdown` | string | a Markdown formatted Function arguments definition | diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar index 50d254eb..e90405e2 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar @@ -4,7 +4,7 @@ # Successful run of tfplugindocs on a Framework provider with "named" template paths (i.e. templates/resources/.md.tmpl) # Templates test all implemented data fields and functions. [!unix] skip -exec tfplugindocs --provider-name=terraform-provider-scaffolding --providers-schema=schema.json +exec tfplugindocs --provider-name=terraform-provider-scaffolding --providers-schema=schema.json --rendered-provider-name=Scaffolding cmp stdout expected-output.txt cmpenv docs/index.md expected-index.md cmpenv docs/data-sources/example.md expected-datasource.md @@ -13,7 +13,7 @@ cmpenv docs/functions/example.md expected-function.md cmpenv docs/ephemeral-resources/example.md expected-ephemeral-resource.md -- expected-output.txt -- -rendering website for provider "terraform-provider-scaffolding" (as "terraform-provider-scaffolding") +rendering website for provider "terraform-provider-scaffolding" (as "Scaffolding") copying any existing content to tmp dir exporting schema from JSON file getting provider schema @@ -46,8 +46,8 @@ HasExample: true ExampleFile: $WORK/examples/data-sources/scaffolding_example/data-source.tf HasImport: false ProviderName: terraform-provider-scaffolding -ProviderShortName: scaffolding -RenderedProviderName: terraform-provider-scaffolding +ProviderShortName: Scaffolding +RenderedProviderName: Scaffolding SchemaMarkdown: ## Schema @@ -102,8 +102,8 @@ Summary: Echo a string HasExample: true ExampleFile: $WORK/examples/functions/example/function.tf ProviderName: terraform-provider-scaffolding -ProviderShortName: scaffolding -RenderedProviderName: terraform-provider-scaffolding +ProviderShortName: Scaffolding +RenderedProviderName: Scaffolding FunctionSignatureMarkdown: ```text example(input string, variadicInput string...) string @@ -146,8 +146,8 @@ Description: Example provider HasExample: true ExampleFile: $WORK/examples/provider/provider.tf ProviderName: terraform-provider-scaffolding -ProviderShortName: scaffolding -RenderedProviderName: terraform-provider-scaffolding +ProviderShortName: Scaffolding +RenderedProviderName: Scaffolding SchemaMarkdown: ## Schema @@ -193,8 +193,8 @@ ExampleFile: $WORK/examples/resources/scaffolding_example/resource.tf HasImport: true ImportFile: $WORK/examples/resources/scaffolding_example/import.sh ProviderName: terraform-provider-scaffolding -ProviderShortName: scaffolding -RenderedProviderName: terraform-provider-scaffolding +ProviderShortName: Scaffolding +RenderedProviderName: Scaffolding SchemaMarkdown: ## Schema @@ -260,8 +260,8 @@ HasExample: true ExampleFile: $WORK/examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf HasImport: false ProviderName: terraform-provider-scaffolding -ProviderShortName: scaffolding -RenderedProviderName: terraform-provider-scaffolding +ProviderShortName: Scaffolding +RenderedProviderName: Scaffolding SchemaMarkdown: ## Schema diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar index ba8e1bfd..04f2bcc9 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar @@ -3,7 +3,7 @@ # Successful run of tfplugindocs on a Framework provider with examples but no templates or pre-exiting docs. [!unix] skip -exec tfplugindocs --provider-name=terraform-provider-scaffolding --providers-schema=schema.json +exec tfplugindocs --provider-name=terraform-provider-scaffolding --providers-schema=schema.json --rendered-provider-name=Scaffolding cmp stdout expected-output.txt cmp docs/index.md expected-index.md cmp docs/data-sources/example.md expected-datasource.md @@ -13,7 +13,7 @@ cmp docs/functions/no-variadic.md expected-no-variadic-function.md cmp docs/ephemeral-resources/example.md expected-ephemeral-resource.md -- expected-output.txt -- -rendering website for provider "terraform-provider-scaffolding" (as "terraform-provider-scaffolding") +rendering website for provider "terraform-provider-scaffolding" (as "Scaffolding") exporting schema from JSON file getting provider schema generating missing templates @@ -40,7 +40,7 @@ rendering "resources/example.md.tmpl" -- expected-datasource.md -- --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding_example Data Source - terraform-provider-scaffolding" +page_title: "scaffolding_example Data Source - Scaffolding" subcategory: "" description: |- Example data source @@ -71,7 +71,7 @@ data "scaffolding_example" "example" { -- expected-function.md -- --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "example function - terraform-provider-scaffolding" +page_title: "example function - Scaffolding" subcategory: "" description: |- Echo a string @@ -105,7 +105,7 @@ example(input string, variadicInput string...) string -- expected-no-variadic-function.md -- --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "no-variadic function - terraform-provider-scaffolding" +page_title: "no-variadic function - Scaffolding" subcategory: "" description: |- Echo a string @@ -137,12 +137,12 @@ no-variadic(input string) string -- expected-index.md -- --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding Provider" +page_title: "Scaffolding Provider" description: |- Example provider --- -# scaffolding Provider +# Scaffolding Provider Example provider @@ -163,7 +163,7 @@ provider "scaffolding" { -- expected-resource.md -- --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding_example Resource - terraform-provider-scaffolding" +page_title: "scaffolding_example Resource - Scaffolding" subcategory: "" description: |- Example resource @@ -195,7 +195,7 @@ resource "scaffolding_example" "example" { -- expected-ephemeral-resource.md -- --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding_example Ephemeral Resource - terraform-provider-scaffolding" +page_title: "scaffolding_example Ephemeral Resource - Scaffolding" subcategory: "" description: |- Example ephemeral resource diff --git a/internal/provider/generate.go b/internal/provider/generate.go index 7df7b63d..3b814b82 100644 --- a/internal/provider/generate.go +++ b/internal/provider/generate.go @@ -10,6 +10,7 @@ import ( "os/exec" "path/filepath" "runtime" + "sort" "strings" "github.com/hashicorp/cli" @@ -443,7 +444,16 @@ func (g *generator) generateMissingProviderTemplate() error { func (g *generator) generateMissingTemplates(providerSchema *tfjson.ProviderSchema) error { g.infof("generating missing resource content") - for name, schema := range providerSchema.ResourceSchemas { + + resourceKeys := make([]string, 0, len(providerSchema.ResourceSchemas)) + for key := range providerSchema.ResourceSchemas { + resourceKeys = append(resourceKeys, key) + } + sort.Strings(resourceKeys) + + for _, name := range resourceKeys { + schema := providerSchema.ResourceSchemas[name] + if g.ignoreDeprecated && schema.Block.Deprecated { continue } @@ -455,7 +465,16 @@ func (g *generator) generateMissingTemplates(providerSchema *tfjson.ProviderSche } g.infof("generating missing data source content") - for name, schema := range providerSchema.DataSourceSchemas { + + dataSourceKeys := make([]string, 0, len(providerSchema.DataSourceSchemas)) + for key := range providerSchema.DataSourceSchemas { + dataSourceKeys = append(dataSourceKeys, key) + } + sort.Strings(dataSourceKeys) + + for _, name := range dataSourceKeys { + schema := providerSchema.DataSourceSchemas[name] + if g.ignoreDeprecated && schema.Block.Deprecated { continue } @@ -467,7 +486,16 @@ func (g *generator) generateMissingTemplates(providerSchema *tfjson.ProviderSche } g.infof("generating missing function content") - for name, signature := range providerSchema.Functions { + + functionKeys := make([]string, 0, len(providerSchema.Functions)) + for key := range providerSchema.Functions { + functionKeys = append(functionKeys, key) + } + sort.Strings(functionKeys) + + for _, name := range functionKeys { + signature := providerSchema.Functions[name] + if g.ignoreDeprecated && signature.DeprecationMessage != "" { continue } @@ -479,7 +507,16 @@ func (g *generator) generateMissingTemplates(providerSchema *tfjson.ProviderSche } g.infof("generating missing ephemeral resource content") - for name, schema := range providerSchema.EphemeralResourceSchemas { + + ephemeralKeys := make([]string, 0, len(providerSchema.EphemeralResourceSchemas)) + for key := range providerSchema.EphemeralResourceSchemas { + ephemeralKeys = append(ephemeralKeys, key) + } + sort.Strings(ephemeralKeys) + + for _, name := range ephemeralKeys { + schema := providerSchema.EphemeralResourceSchemas[name] + if g.ignoreDeprecated && schema.Block.Deprecated { continue } diff --git a/internal/provider/template.go b/internal/provider/template.go index ab3bb669..2be400e7 100644 --- a/internal/provider/template.go +++ b/internal/provider/template.go @@ -150,7 +150,7 @@ func (t providerTemplate) Render(providerDir, providerName, renderedProviderName ExampleFile: exampleFile, ProviderName: providerName, - ProviderShortName: providerShortName(providerName), + ProviderShortName: providerShortName(renderedProviderName), SchemaMarkdown: schemaComment + "\n" + schemaBuffer.String(), @@ -199,7 +199,7 @@ func (t resourceTemplate) Render(providerDir, name, providerName, renderedProvid ImportFile: importFile, ProviderName: providerName, - ProviderShortName: providerShortName(providerName), + ProviderShortName: providerShortName(renderedProviderName), SchemaMarkdown: schemaComment + "\n" + schemaBuffer.String(), @@ -257,7 +257,7 @@ func (t functionTemplate) Render(providerDir, name, providerName, renderedProvid ExampleFile: exampleFile, ProviderName: providerName, - ProviderShortName: providerShortName(providerName), + ProviderShortName: providerShortName(renderedProviderName), FunctionSignatureMarkdown: signatureComment + "\n" + funcSig, FunctionArgumentsMarkdown: argumentComment + "\n" + funcArgs, @@ -271,7 +271,7 @@ func (t functionTemplate) Render(providerDir, name, providerName, renderedProvid const defaultResourceTemplate resourceTemplate = `--- ` + frontmatterComment + ` -page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +page_title: "{{.Name}} {{.Type}} - {{.RenderedProviderName}}" subcategory: "" description: |- {{ .Description | plainmarkdown | trimspace | prefixlines " " }} @@ -300,7 +300,7 @@ Import is supported using the following syntax: const defaultFunctionTemplate functionTemplate = `--- ` + frontmatterComment + ` -page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +page_title: "{{.Name}} {{.Type}} - {{.RenderedProviderName}}" subcategory: "" description: |- {{ .Summary | plainmarkdown | trimspace | prefixlines " " }} From 9ff8b91ea1e23bbdb28d7b89aa0cd6c50518f8c7 Mon Sep 17 00:00:00 2001 From: Ansgar Mertens Date: Fri, 20 Jun 2025 15:38:16 +0200 Subject: [PATCH 29/33] Dependabot: Single weekly PR for GH Actions, Single PR for terraform-plugin-* Go dependencies (#485) * github: Group all Github action updates in a single Dependabot PR once a week * dependabot: single PR for terraform-plugin-* dependencies * dependabot: skip single PR for terraform-plugin-* dependencies for this repo as it's uncommon to happen at the same time or it's not even using those libraries --- .github/dependabot.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ed991eb9..0ed0546a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,7 +6,6 @@ updates: schedule: # Check for updates to Go modules every weekday interval: "daily" - # Maintain dependencies for Go modules (tools) - package-ecosystem: "gomod" directory: "/tools" @@ -15,5 +14,12 @@ updates: interval: "daily" - package-ecosystem: "github-actions" directory: "/" + groups: + "github-actions": + patterns: + - "*" # Group all GitHub Actions dependencies together schedule: - interval: "daily" + interval: "weekly" + day: "monday" + time: "09:00" + timezone: "Etc/UTC" From 31cddc780d26d5e66fce673e18f64d6b297fd6f5 Mon Sep 17 00:00:00 2001 From: Selena Goods Date: Mon, 30 Jun 2025 14:14:53 -0400 Subject: [PATCH 30/33] Revert "Bump github.com/yuin/goldmark from 1.7.7 to 1.7.12 (#484)" (#498) This reverts commit 8b2645d33ebb685b19030284154b5c7c1510fedf. --- go.mod | 2 +- go.sum | 4 +-- internal/mdplain/renderer.go | 50 +++++++++++++++++++++--------------- internal/provider/migrate.go | 2 +- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index 7ac7a84b..dc1eb81d 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/hashicorp/terraform-json v0.25.0 github.com/mattn/go-colorable v0.1.14 github.com/rogpeppe/go-internal v1.14.1 - github.com/yuin/goldmark v1.7.12 + github.com/yuin/goldmark v1.7.7 github.com/yuin/goldmark-meta v1.1.0 github.com/zclconf/go-cty v1.16.3 go.abhg.dev/goldmark/frontmatter v0.2.0 diff --git a/go.sum b/go.sum index 7953d842..47226692 100644 --- a/go.sum +++ b/go.sum @@ -128,8 +128,8 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.7.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY= -github.com/yuin/goldmark v1.7.12/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= +github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU= +github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= github.com/zclconf/go-cty v1.16.3 h1:osr++gw2T61A8KVYHoQiFbFd1Lh3JOCXc/jFLJXKTxk= diff --git a/internal/mdplain/renderer.go b/internal/mdplain/renderer.go index bd6c9e11..93bd5ec7 100644 --- a/internal/mdplain/renderer.go +++ b/internal/mdplain/renderer.go @@ -26,51 +26,59 @@ func (r *TextRender) Render(w io.Writer, source []byte, n ast.Node) error { } switch node := node.(type) { - case *ast.Blockquote, *ast.CodeSpan: - return ast.WalkContinue, nil - case *ast.Heading, *ast.CodeBlock, *ast.List: + case *ast.Blockquote, *ast.Heading: doubleSpace(out) - return ast.WalkContinue, nil + out.Write(node.Text(source)) + return ast.WalkSkipChildren, nil case *ast.ThematicBreak: doubleSpace(out) return ast.WalkSkipChildren, nil + case *ast.CodeBlock: + doubleSpace(out) + for i := 0; i < node.Lines().Len(); i++ { + line := node.Lines().At(i) + out.Write(line.Value(source)) + } + return ast.WalkSkipChildren, nil case *ast.FencedCodeBlock: doubleSpace(out) doubleSpace(out) - out.Write(node.Lines().Value(source)) + for i := 0; i < node.Lines().Len(); i++ { + line := node.Lines().At(i) + _, _ = out.Write(line.Value(source)) + } + return ast.WalkSkipChildren, nil + case *ast.List: + doubleSpace(out) return ast.WalkContinue, nil case *ast.Paragraph: doubleSpace(out) - if node.Lines().Value(source)[0] == '|' { // Write tables as-is. - out.Write(node.Lines().Value(source)) + if node.Text(source)[0] == '|' { // Write tables as-is. + for i := 0; i < node.Lines().Len(); i++ { + line := node.Lines().At(i) + out.Write(line.Value(source)) + } return ast.WalkSkipChildren, nil } return ast.WalkContinue, nil case *extAST.Strikethrough: - out.Write(node.Lines().Value(source)) + out.Write(node.Text(source)) return ast.WalkContinue, nil case *ast.AutoLink: out.Write(node.URL(source)) return ast.WalkSkipChildren, nil + case *ast.CodeSpan: + out.Write(node.Text(source)) + return ast.WalkSkipChildren, nil case *ast.Link: - // we want to write the text of the - // link before the url - child := node.FirstChild() - if child != nil { - t, ok := child.(*ast.Text) - if ok { - out.Write(t.Value(source)) - } - } - + _, err := out.Write(node.Text(source)) if !isRelativeLink(node.Destination) { out.WriteString(" ") out.Write(node.Destination) } - - return ast.WalkSkipChildren, nil + return ast.WalkSkipChildren, err case *ast.Text: - out.Write(node.Value(source)) + out.Write(node.Text(source)) if node.SoftLineBreak() { doubleSpace(out) } diff --git a/internal/provider/migrate.go b/internal/provider/migrate.go index 68314c2a..9abd7734 100644 --- a/internal/provider/migrate.go +++ b/internal/provider/migrate.go @@ -296,7 +296,7 @@ func (m *migrator) ExtractCodeExamples(content []byte, newRelDir string, templat if fencedNode, isFenced := node.(*ast.FencedCodeBlock); isFenced && fencedNode.Info != nil { var ext, exampleName, examplePath, template string - lang := string(fencedNode.Info.Value(content)[:]) + lang := string(fencedNode.Info.Text(content)[:]) switch lang { case "hcl", "terraform": exampleCount++ From 3b9b212b7696d8528397271c5ff4a5ddc2a3ce05 Mon Sep 17 00:00:00 2001 From: Austin Valle Date: Mon, 30 Jun 2025 14:31:24 -0400 Subject: [PATCH 31/33] generate: Add support for `import` configuration examples with the `id` attribute (#495) * quick impl * add ID prefix * template update * add changelog * add import shell test * update acceptance tests and add some import config files * update naming * update changelog --- .../unreleased/FEATURES-20250616-181322.yaml | 5 ++ README.md | 61 ++++++++++--------- ...k_provider_success_generic_templates.txtar | 19 +++++- ...ork_provider_success_named_templates.txtar | 19 +++++- ...mework_provider_success_no_templates.txtar | 34 +++++++++++ ...k_provider_success_generic_templates.txtar | 17 +++++- ...amework_provider_success_legacy_docs.txtar | 11 +++- ...ork_provider_success_named_templates.txtar | 17 +++++- ...mework_provider_success_no_templates.txtar | 26 ++++++++ ...mework_provider_success_static_files.txtar | 11 +++- internal/provider/generate.go | 7 ++- internal/provider/template.go | 24 ++++++-- internal/provider/template_test.go | 2 +- 13 files changed, 204 insertions(+), 49 deletions(-) create mode 100644 .changes/unreleased/FEATURES-20250616-181322.yaml diff --git a/.changes/unreleased/FEATURES-20250616-181322.yaml b/.changes/unreleased/FEATURES-20250616-181322.yaml new file mode 100644 index 00000000..0cfe1198 --- /dev/null +++ b/.changes/unreleased/FEATURES-20250616-181322.yaml @@ -0,0 +1,5 @@ +kind: FEATURES +body: 'generate: Added support for defining import example file (`import-by-string-id.tf`) using Terraform configuration and the `id` attribute' +time: 2025-06-16T18:13:22.627319-04:00 +custom: + Issue: "472" diff --git a/README.md b/README.md index c9fb2a0b..89a79d83 100644 --- a/README.md +++ b/README.md @@ -223,15 +223,16 @@ For examples: > **NOTE:** In the following conventional paths for examples, `` and `` include the provider prefix as well, but the provider prefix is **NOT** included in``. > For example, the data source [`caller_identity`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) in the `aws` provider would have an "example" conventional path of: `examples/data-sources/aws_caller_identity/data-source.tf` -| Path | Description | -|---------------------------------------------------------------------------|-----------------------------------| -| `examples/` | Root of examples | -| `examples/provider/provider.tf` | Provider example config | -| `examples/data-sources//data-source.tf` | Data source example config | -| `examples/ephemeral-resources//ephemeral-resource.tf` | Ephemeral resource example config | -| `examples/functions//function.tf` | Function example config | -| `examples/resources//resource.tf` | Resource example config | -| `examples/resources//import.sh` | Resource example import command | +| Path | Description | +|---------------------------------------------------------------------------|--------------------------------------| +| `examples/` | Root of examples | +| `examples/provider/provider.tf` | Provider example config | +| `examples/data-sources//data-source.tf` | Data source example config | +| `examples/ephemeral-resources//ephemeral-resource.tf` | Ephemeral resource example config | +| `examples/functions//function.tf` | Function example config | +| `examples/resources//resource.tf` | Resource example config | +| `examples/resources//import.sh` | Resource example import command | +| `examples/resources//import-by-string-id.tf` | Resource example import by id config | #### Migration @@ -280,31 +281,33 @@ using the following data fields and functions: ##### Provider Fields -| Field | Type | Description | -|------------------------:|:------:|-------------------------------------------------------------------------------------------| -| `.Description` | string | Provider description | -| `.HasExample` | bool | Is there an example file? | -| `.ExampleFile` | string | Path to the file with the terraform configuration example | -| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | -| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | +| Field | Type | Description | +|-------------------------|--------|-------------------------------------------------------------------------------------------| +| `.Description` | string | Provider description | +| `.HasExample` | bool | Is there an example file? | +| `.ExampleFile` | string | Path to the file with the terraform configuration example | +| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | +| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | | `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` | -| `.SchemaMarkdown` | string | a Markdown formatted Provider Schema definition | +| `.SchemaMarkdown` | string | a Markdown formatted Provider Schema definition | ##### Managed Resource / Ephemeral Resource / Data Source Fields -| Field | Type | Description | -|------------------------:|:------:|-------------------------------------------------------------------------------------------| -| `.Name` | string | Name of the resource/data-source (ex. `tls_certificate`) | -| `.Type` | string | Either `Resource` or `Data Source` | -| `.Description` | string | Resource / Data Source description | -| `.HasExample` | bool | Is there an example file? | -| `.ExampleFile` | string | Path to the file with the terraform configuration example | -| `.HasImport` | bool | Is there an import file? | -| `.ImportFile` | string | Path to the file with the command for importing the resource | -| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | -| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | +| Field | Type | Description | +|-------------------------|--------|-------------------------------------------------------------------------------------------| +| `.Name` | string | Name of the resource/data-source (ex. `tls_certificate`) | +| `.Type` | string | Either `Resource` or `Data Source` | +| `.Description` | string | Resource / Data Source description | +| `.HasExample` | bool | Is there an example file? | +| `.ExampleFile` | string | Path to the file with the terraform configuration example | +| `.HasImport` | bool | Is there an import shell file? (`terraform import` shell example) | +| `.ImportFile` | string | Path to the file with the command for importing the resource | +| `.HasImportIDConfig` | bool | Is there an import terraform config file? (`import` block example with `id`) | +| `.ImportIDConfigFile` | string | Path to the file with the Terraform configuration for importing the resource by `id` | +| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | +| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | | `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` | -| `.SchemaMarkdown` | string | a Markdown formatted Resource / Data Source Schema definition | +| `.SchemaMarkdown` | string | a Markdown formatted Resource / Data Source Schema definition | ##### Provider-defined Function Fields diff --git a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_generic_templates.txtar b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_generic_templates.txtar index cf5f7b6a..b0029a00 100644 --- a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_generic_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_generic_templates.txtar @@ -144,6 +144,8 @@ HasExample: true ExampleFile: $WORK/examples/resources/scaffolding_example/resource.tf HasImport: true ImportFile: $WORK/examples/resources/scaffolding_example/import.sh +HasImportIDConfig: true +ImportIDConfigFile: $WORK/examples/resources/scaffolding_example/import-by-string-id.tf ProviderName: terraform-provider-scaffolding ProviderShortName: scaffolding RenderedProviderName: terraform-provider-scaffolding @@ -191,7 +193,7 @@ codefile: Import is supported using the following syntax: ```shell -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" ``` tffile: @@ -305,6 +307,8 @@ HasExample: {{.HasExample}} ExampleFile: {{.ExampleFile}} HasImport: {{.HasImport}} ImportFile: {{.ImportFile}} +HasImportIDConfig: {{.HasImportIDConfig}} +ImportIDConfigFile: {{.ImportIDConfigFile}} ProviderName: {{.ProviderName}} ProviderShortName: {{.ProviderShortName}} RenderedProviderName: {{.RenderedProviderName}} @@ -371,12 +375,21 @@ data "scaffolding_example" "example" { provider "scaffolding" { # example configuration here } --- examples/resources/scaffolding_example/resource.tf -- +-- examples/resources/scaffolding_example/import-by-string-id.tf -- +import { + to = scaffolding_example.example + id = "id-123" +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/resources/scaffolding_example/import.sh -- -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" +-- examples/resources/scaffolding_example/resource.tf -- +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} -- internal/provider/example_data_source.go -- // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 diff --git a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar index a7354950..e7a5ccbf 100644 --- a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar @@ -144,6 +144,8 @@ HasExample: true ExampleFile: $WORK/examples/resources/scaffolding_example/resource.tf HasImport: true ImportFile: $WORK/examples/resources/scaffolding_example/import.sh +HasImportIDConfig: true +ImportIDConfigFile: $WORK/examples/resources/scaffolding_example/import-by-string-id.tf ProviderName: terraform-provider-scaffolding ProviderShortName: scaffolding RenderedProviderName: terraform-provider-scaffolding @@ -191,7 +193,7 @@ codefile: Import is supported using the following syntax: ```shell -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" ``` tffile: @@ -305,6 +307,8 @@ HasExample: {{.HasExample}} ExampleFile: {{.ExampleFile}} HasImport: {{.HasImport}} ImportFile: {{.ImportFile}} +HasImportIDConfig: {{.HasImportIDConfig}} +ImportIDConfigFile: {{.ImportIDConfigFile}} ProviderName: {{.ProviderName}} ProviderShortName: {{.ProviderShortName}} RenderedProviderName: {{.RenderedProviderName}} @@ -371,12 +375,21 @@ data "scaffolding_example" "example" { provider "scaffolding" { # example configuration here } --- examples/resources/scaffolding_example/resource.tf -- +-- examples/resources/scaffolding_example/import-by-string-id.tf -- +import { + to = scaffolding_example.example + id = "id-123" +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/resources/scaffolding_example/import.sh -- -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" +-- examples/resources/scaffolding_example/resource.tf -- +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} -- internal/provider/example_data_source.go -- // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 diff --git a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar index 94f1c263..7c30ad2f 100644 --- a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar @@ -122,6 +122,29 @@ resource "scaffolding_example" "example" { ### Read-Only - `id` (String) Example identifier + +## Import + +Import is supported using the following syntax: + +In Terraform v1.5.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `id` attribute, for example: + +```terraform +import { + to = scaffolding_example.example + id = "id-123" +} + +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +``` + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +terraform import scaffolding_example.example "id-123" +``` -- examples/README.md -- # Examples @@ -140,6 +163,17 @@ data "scaffolding_example" "example" { provider "scaffolding" { # example configuration here } +-- examples/resources/scaffolding_example/import-by-string-id.tf -- +import { + to = scaffolding_example.example + id = "id-123" +} + +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +-- examples/resources/scaffolding_example/import.sh -- +terraform import scaffolding_example.example "id-123" -- examples/resources/scaffolding_example/resource.tf -- resource "scaffolding_example" "example" { configurable_attribute = "some-value" diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_generic_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_generic_templates.txtar index 3984d4e7..85a766b5 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_generic_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_generic_templates.txtar @@ -193,6 +193,8 @@ HasExample: true ExampleFile: $WORK/examples/resources/scaffolding_example/resource.tf HasImport: true ImportFile: $WORK/examples/resources/scaffolding_example/import.sh +HasImportIDConfig: true +ImportIDConfigFile: $WORK/examples/resources/scaffolding_example/import-by-string-id.tf ProviderName: terraform-provider-scaffolding ProviderShortName: scaffolding RenderedProviderName: terraform-provider-scaffolding @@ -240,7 +242,7 @@ codefile: Import is supported using the following syntax: ```shell -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" ``` tffile: @@ -453,6 +455,8 @@ HasExample: {{.HasExample}} ExampleFile: {{.ExampleFile}} HasImport: {{.HasImport}} ImportFile: {{.ImportFile}} +HasImportIDConfig: {{.HasImportIDConfig}} +ImportIDConfigFile: {{.ImportIDConfigFile}} ProviderName: {{.ProviderName}} ProviderShortName: {{.ProviderShortName}} RenderedProviderName: {{.RenderedProviderName}} @@ -581,11 +585,20 @@ provider "scaffolding" { # example configuration here } -- examples/resources/scaffolding_example/resource.tf -- +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +-- examples/resources/scaffolding_example/import-by-string-id.tf -- +import { + to = scaffolding_example.example + id = "id-123" +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/resources/scaffolding_example/import.sh -- -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" -- examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf -- resource "scaffolding_example" "example" { configurable_attribute = "some-value" diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_legacy_docs.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_legacy_docs.txtar index 9d175252..0c049c15 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_legacy_docs.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_legacy_docs.txtar @@ -193,11 +193,20 @@ resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf -- +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +-- examples/resources/scaffolding_example/import-by-string-id.tf -- +import { + to = scaffolding_example.example + id = "id-123" +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/resources/scaffolding_example/import.sh -- -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" -- schema.json -- { "format_version": "1.0", diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar index e90405e2..93dd75ab 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar @@ -192,6 +192,8 @@ HasExample: true ExampleFile: $WORK/examples/resources/scaffolding_example/resource.tf HasImport: true ImportFile: $WORK/examples/resources/scaffolding_example/import.sh +HasImportIDConfig: true +ImportIDConfigFile: $WORK/examples/resources/scaffolding_example/import-by-string-id.tf ProviderName: terraform-provider-scaffolding ProviderShortName: Scaffolding RenderedProviderName: Scaffolding @@ -239,7 +241,7 @@ codefile: Import is supported using the following syntax: ```shell -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" ``` tffile: @@ -452,6 +454,8 @@ HasExample: {{.HasExample}} ExampleFile: {{.ExampleFile}} HasImport: {{.HasImport}} ImportFile: {{.ImportFile}} +HasImportIDConfig: {{.HasImportIDConfig}} +ImportIDConfigFile: {{.ImportIDConfigFile}} ProviderName: {{.ProviderName}} ProviderShortName: {{.ProviderShortName}} RenderedProviderName: {{.RenderedProviderName}} @@ -584,11 +588,20 @@ resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf -- +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +-- examples/resources/scaffolding_example/import-by-string-id.tf -- +import { + to = scaffolding_example.example + id = "id-123" +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/resources/scaffolding_example/import.sh -- -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" -- schema.json -- { "format_version": "1.0", diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar index 04f2bcc9..80251b8f 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar @@ -192,6 +192,23 @@ resource "scaffolding_example" "example" { ### Read-Only - `id` (String) Example identifier + +## Import + +Import is supported using the following syntax: + +In Terraform v1.5.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `id` attribute, for example: + +```terraform +import { + to = scaffolding_example.example + id = "id-123" +} + +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +``` -- expected-ephemeral-resource.md -- --- # generated by https://github.com/hashicorp/terraform-plugin-docs @@ -250,6 +267,15 @@ output "test" { provider "scaffolding" { # example configuration here } +-- examples/resources/scaffolding_example/import-by-string-id.tf -- +import { + to = scaffolding_example.example + id = "id-123" +} + +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} -- examples/resources/scaffolding_example/resource.tf -- resource "scaffolding_example" "example" { configurable_attribute = "some-value" diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_static_files.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_static_files.txtar index f37cdfc4..a082d55d 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_static_files.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_static_files.txtar @@ -193,11 +193,20 @@ resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf -- +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +-- examples/resources/scaffolding_example/import-by-string-id.tf -- +import { + to = scaffolding_example.example + id = "id-123" +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } -- examples/resources/scaffolding_example/import.sh -- -terraform import scaffolding_example.example +terraform import scaffolding_example.example "id-123" -- schema.json -- { "format_version": "1.0", diff --git a/internal/provider/generate.go b/internal/provider/generate.go index 3b814b82..5fe68a4d 100644 --- a/internal/provider/generate.go +++ b/internal/provider/generate.go @@ -629,7 +629,7 @@ func (g *generator) renderStaticWebsite(providerSchema *tfjson.ProviderSchema) e if resSchema != nil { tmpl := resourceTemplate(tmplData) - render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Data Source", exampleFilePath, "", resSchema) + render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Data Source", exampleFilePath, "", "", resSchema) if err != nil { return fmt.Errorf("unable to render data source template %q: %w", rel, err) } @@ -644,10 +644,11 @@ func (g *generator) renderStaticWebsite(providerSchema *tfjson.ProviderSchema) e resSchema, resName := resourceSchema(providerSchema.ResourceSchemas, shortName, relFile) exampleFilePath := filepath.Join(g.ProviderExamplesDir(), "resources", resName, "resource.tf") importFilePath := filepath.Join(g.ProviderExamplesDir(), "resources", resName, "import.sh") + importIDConfigFilePath := filepath.Join(g.ProviderExamplesDir(), "resources", resName, "import-by-string-id.tf") if resSchema != nil { tmpl := resourceTemplate(tmplData) - render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Resource", exampleFilePath, importFilePath, resSchema) + render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Resource", exampleFilePath, importIDConfigFilePath, importFilePath, resSchema) if err != nil { return fmt.Errorf("unable to render resource template %q: %w", rel, err) } @@ -682,7 +683,7 @@ func (g *generator) renderStaticWebsite(providerSchema *tfjson.ProviderSchema) e if resSchema != nil { tmpl := resourceTemplate(tmplData) - render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Ephemeral Resource", exampleFilePath, "", resSchema) + render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Ephemeral Resource", exampleFilePath, "", "", resSchema) if err != nil { return fmt.Errorf("unable to render ephemeral resource template %q: %w", rel, err) } diff --git a/internal/provider/template.go b/internal/provider/template.go index 2be400e7..e77792d1 100644 --- a/internal/provider/template.go +++ b/internal/provider/template.go @@ -158,7 +158,7 @@ func (t providerTemplate) Render(providerDir, providerName, renderedProviderName }) } -func (t resourceTemplate) Render(providerDir, name, providerName, renderedProviderName, typeName, exampleFile, importFile string, schema *tfjson.Schema) (string, error) { +func (t resourceTemplate) Render(providerDir, name, providerName, renderedProviderName, typeName, exampleFile, importIDConfigFile, importCmdFile string, schema *tfjson.Schema) (string, error) { schemaBuffer := bytes.NewBuffer(nil) err := schemamd.Render(schema, schemaBuffer) if err != nil { @@ -181,6 +181,9 @@ func (t resourceTemplate) Render(providerDir, name, providerName, renderedProvid HasImport bool ImportFile string + HasImportIDConfig bool + ImportIDConfigFile string + ProviderName string ProviderShortName string @@ -195,8 +198,11 @@ func (t resourceTemplate) Render(providerDir, name, providerName, renderedProvid HasExample: exampleFile != "" && fileExists(exampleFile), ExampleFile: exampleFile, - HasImport: importFile != "" && fileExists(importFile), - ImportFile: importFile, + HasImport: importCmdFile != "" && fileExists(importCmdFile), + ImportFile: importCmdFile, + + HasImportIDConfig: importIDConfigFile != "" && fileExists(importIDConfigFile), + ImportIDConfigFile: importIDConfigFile, ProviderName: providerName, ProviderShortName: providerShortName(renderedProviderName), @@ -288,11 +294,21 @@ description: |- {{- end }} {{ .SchemaMarkdown | trimspace }} -{{- if .HasImport }} +{{- if or .HasImport .HasImportIDConfig }} ## Import Import is supported using the following syntax: +{{- end }} +{{- if .HasImportIDConfig }} + +In Terraform v1.5.0 and later, the [` + "`" + `import` + "`" + ` block](https://developer.hashicorp.com/terraform/language/import) can be used with the ` + "`" + `id` + "`" + ` attribute, for example: + +{{tffile .ImportIDConfigFile }} +{{- end }} +{{- if .HasImport }} + +The [` + "`" + `terraform import` + "`" + ` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: {{codefile "shell" .ImportFile }} {{- end }} diff --git a/internal/provider/template_test.go b/internal/provider/template_test.go index 82bcc3b5..3760b94d 100644 --- a/internal/provider/template_test.go +++ b/internal/provider/template_test.go @@ -93,7 +93,7 @@ provider "scaffolding" { }, } - result, err := tpl.Render("testdata/test-provider-dir", "testTemplate", "test-provider", "test-provider", "Resource", "provider.tf", "provider.tf", &schema) + result, err := tpl.Render("testdata/test-provider-dir", "testTemplate", "test-provider", "test-provider", "Resource", "provider.tf", "", "", &schema) if err != nil { t.Error(err) } From 5db550975c478ae458ad12964b3f967be1055883 Mon Sep 17 00:00:00 2001 From: Austin Valle Date: Mon, 30 Jun 2025 15:41:54 -0400 Subject: [PATCH 32/33] generate: Add support for import configuration examples with `identity` + schema (#496) * quick impl * add ID prefix * template update * add changelog * add import shell test * update acceptance tests and add some import config files * wip implementation * quick impl * add ID prefix * template update * add changelog * add import shell test * update acceptance tests and add some import config files * update naming * update changelog * change name * always provider identity schema in render * add a generate test * documentation * example * add acceptance tests * add more tests for render * add note about import changes * update PR number --- .../BREAKING CHANGES-20250613-135104.yaml | 2 +- .../unreleased/FEATURES-20250625-173710.yaml | 6 + .../unreleased/NOTES-20250630-144026.yaml | 6 + README.md | 107 +++++++--- ...ork_provider_success_named_templates.txtar | 187 +++++++++++----- ...mework_provider_success_no_templates.txtar | 199 +++++++++++++----- ...ork_provider_success_named_templates.txtar | 52 +++++ ...mework_provider_success_no_templates.txtar | 64 ++++++ internal/provider/generate.go | 8 +- internal/provider/template.go | 39 +++- internal/provider/template_test.go | 2 +- internal/provider/util.go | 13 ++ internal/schemamd/render.go | 117 ++++++++++ internal/schemamd/render_test.go | 53 +++++ internal/schemamd/testdata/identity.md | 14 ++ .../schemamd/testdata/identity.schema.json | 46 ++++ 16 files changed, 773 insertions(+), 142 deletions(-) create mode 100644 .changes/unreleased/FEATURES-20250625-173710.yaml create mode 100644 .changes/unreleased/NOTES-20250630-144026.yaml create mode 100644 internal/schemamd/testdata/identity.md create mode 100644 internal/schemamd/testdata/identity.schema.json diff --git a/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml b/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml index ddef526a..990825bc 100644 --- a/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml +++ b/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml @@ -1,6 +1,6 @@ kind: BREAKING CHANGES body: 'generate: The `.ProviderShortName` template function now uses the rendered provider name to derive the provider short name. Users that pass in the -`--rendered-provider-name` flag might see a different output for this function' + `--rendered-provider-name` flag might see a different output for this function' time: 2025-06-13T13:51:04.745115-04:00 custom: Issue: "492" diff --git a/.changes/unreleased/FEATURES-20250625-173710.yaml b/.changes/unreleased/FEATURES-20250625-173710.yaml new file mode 100644 index 00000000..1aed0b63 --- /dev/null +++ b/.changes/unreleased/FEATURES-20250625-173710.yaml @@ -0,0 +1,6 @@ +kind: FEATURES +body: 'generate: Added support for defining import example file (`import-by-identity.tf`) using Terraform configuration + and the `identity` attribute (managed resource identity)' +time: 2025-06-25T17:37:10.853795-04:00 +custom: + Issue: "496" diff --git a/.changes/unreleased/NOTES-20250630-144026.yaml b/.changes/unreleased/NOTES-20250630-144026.yaml new file mode 100644 index 00000000..32b45a11 --- /dev/null +++ b/.changes/unreleased/NOTES-20250630-144026.yaml @@ -0,0 +1,6 @@ +kind: NOTES +body: 'generate: Generated import documentation will now contain more information about which methods are + supported by the provider (CLI command, config by ID, config by identity).' +time: 2025-06-30T14:40:26.94407-04:00 +custom: + Issue: "495" diff --git a/README.md b/README.md index 89a79d83..c72c187f 100644 --- a/README.md +++ b/README.md @@ -223,16 +223,17 @@ For examples: > **NOTE:** In the following conventional paths for examples, `` and `` include the provider prefix as well, but the provider prefix is **NOT** included in``. > For example, the data source [`caller_identity`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) in the `aws` provider would have an "example" conventional path of: `examples/data-sources/aws_caller_identity/data-source.tf` -| Path | Description | -|---------------------------------------------------------------------------|--------------------------------------| -| `examples/` | Root of examples | -| `examples/provider/provider.tf` | Provider example config | -| `examples/data-sources//data-source.tf` | Data source example config | -| `examples/ephemeral-resources//ephemeral-resource.tf` | Ephemeral resource example config | -| `examples/functions//function.tf` | Function example config | -| `examples/resources//resource.tf` | Resource example config | -| `examples/resources//import.sh` | Resource example import command | -| `examples/resources//import-by-string-id.tf` | Resource example import by id config | +| Path | Description | +|---------------------------------------------------------------------------|--------------------------------------------| +| `examples/` | Root of examples | +| `examples/provider/provider.tf` | Provider example config | +| `examples/data-sources//data-source.tf` | Data source example config | +| `examples/ephemeral-resources//ephemeral-resource.tf` | Ephemeral resource example config | +| `examples/functions//function.tf` | Function example config | +| `examples/resources//resource.tf` | Resource example config | +| `examples/resources//import.sh` | Resource example import command | +| `examples/resources//import-by-string-id.tf` | Resource example import by id config | +| `examples/resources//import-by-identity.tf` | Resource example import by identity config | #### Migration @@ -293,21 +294,24 @@ using the following data fields and functions: ##### Managed Resource / Ephemeral Resource / Data Source Fields -| Field | Type | Description | -|-------------------------|--------|-------------------------------------------------------------------------------------------| -| `.Name` | string | Name of the resource/data-source (ex. `tls_certificate`) | -| `.Type` | string | Either `Resource` or `Data Source` | -| `.Description` | string | Resource / Data Source description | -| `.HasExample` | bool | Is there an example file? | -| `.ExampleFile` | string | Path to the file with the terraform configuration example | -| `.HasImport` | bool | Is there an import shell file? (`terraform import` shell example) | -| `.ImportFile` | string | Path to the file with the command for importing the resource | -| `.HasImportIDConfig` | bool | Is there an import terraform config file? (`import` block example with `id`) | -| `.ImportIDConfigFile` | string | Path to the file with the Terraform configuration for importing the resource by `id` | -| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | -| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | -| `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` | -| `.SchemaMarkdown` | string | a Markdown formatted Resource / Data Source Schema definition | +| Field | Type | Description | +|-----------------------------|--------|--------------------------------------------------------------------------------------------| +| `.Name` | string | Name of the resource/data-source (ex. `tls_certificate`) | +| `.Type` | string | Either `Resource` or `Data Source` | +| `.Description` | string | Resource / Data Source description | +| `.HasExample` | bool | Is there an example file? | +| `.ExampleFile` | string | Path to the file with the terraform configuration example | +| `.HasImport` | bool | Is there an import shell file? (`terraform import` shell example) | +| `.ImportFile` | string | Path to the file with the command for importing the resource | +| `.HasImportIDConfig` | bool | Is there an import terraform config file? (`import` block example with `id`) | +| `.ImportIDConfigFile` | string | Path to the file with the Terraform configuration for importing the resource by `id` | +| `.HasImportIdentityConfig` | bool | Is there an import terraform config file? (`import` block example with `identity`) | +| `.ImportIdentityConfigFile` | string | Path to the file with the Terraform configuration for importing the resource by `identity` | +| `.IdentitySchemaMarkdown` | string | a Markdown formatted Resource Identity Schema definition | +| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | +| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | +| `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` | +| `.SchemaMarkdown` | string | a Markdown formatted Resource / Data Source Schema definition | ##### Provider-defined Function Fields @@ -360,16 +364,57 @@ This can be autogenerated by running `make generate` or running `go generate ./. ### Acceptance Tests This repo uses the `testscript` [package](https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript) for acceptance testing. - There are two types of acceptance tests: full provider build tests in `tfplugindocs/testdata/scripts/provider-build` and provider schema json tests in `tfplugindocs/testdata/scripts/schema-json`. -Provider build tests run the default `tfplugindocs` command which builds the provider source code and runs Terraform to retrieve the schema. These tests require the full provider source code to build a valid provider binary. - -Schema json tests run the `tfplugindocs` command with the `--providers-schema=` flag to specify a provider schemas json file. This allows the test to skip the provider build and Terraform CLI call, instead using the specified file to generate docs. +Provider [build tests](./cmd/tfplugindocs/testdata/scripts/provider-build/) run the default `tfplugindocs` command which builds the provider source code and runs Terraform to retrieve the schema. These tests require the full provider source code to build a valid provider binary. +[Schema json](./cmd/tfplugindocs/testdata/scripts/schema-json/) tests run the `tfplugindocs` command with the `--providers-schema=` flag to specify a provider schemas json file. This allows the test to skip the provider build and Terraform CLI call, instead using the specified file to generate docs. You can run `make testacc` to run the full suite of acceptance tests. By default, the provider build acceptance tests will create a temporary directory in `/tmp/tftmp` for testing, but you can change this location in `cmd/tfplugindocs/main_test.go`. The schema json tests uses the `testscript` package's [default work directory](https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript#Params.WorkdirRoot). The test scripts are defined in the `tfplugindocs/testdata/scripts` directory. Each script includes the test, golden files, and the provider source code or schema JSON file needed to run the test. +Each script is a [text archive](https://pkg.go.dev/golang.org/x/tools/txtar). You can install the `txtar` CLI locally by running `go install golang.org/x/exp/cmd/txtar@latest` to extract the files in the test script for debugging or to help with updating. + +For example, to unarchive all of the files from a test script: +```bash +# Assuming that your working directory is the root of the terraform-plugin-docs repo + +# Create a fresh directory to extract to +mkdir tmp && cd tmp + +# Extract this specific test script to the current working directory +txtar -x <../cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar +``` + +#### New test scripts + +Updates to existing tests are typically just made manually, but the `txtar` CLI can be used to create a new test quickly. + +A new text archive can be created from a folder with: +```bash +# Assuming that your working directory is the root of the terraform-plugin-docs repo + +# Create a fresh directory to make changes to +mkdir tmp && cd tmp + +# Update files in ./tmp that you want in the new .txtar + +# Archives all of the files in the current directory with a placeholder comment +echo "placeholder comment" | txtar . >../cmd/tfplugindocs/testdata/scripts/provider-build/generate/new.txtar +``` -Each script is a [text archive](https://pkg.go.dev/golang.org/x/tools/txtar). You can install the `txtar` CLI locally by running `go install golang.org/x/exp/cmd/txtar@latest` to extract the files in the test script for debugging. -You can also use `txtar` CLI archive files into the `.txtar` format to create new tests or modify existing ones. +Once a new text archive is created, the comment header can be replaced with [test script commands](https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript) +like `env`, `cmp`, `exec`, etc. These commands control what actually is run during the test along with the assertions, for example: +```bash +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + +# Successful run of tfplugindocs on a Framework provider with examples but no templates or pre-existing docs. +[!unix] skip +env GOCACHE=$WORK/gocache # sets an environment variable +env GOMODCACHE=$WORK/gomodcache # sets an environment variable +exec tfplugindocs --provider-name=terraform-provider-scaffolding # executes the Go binary for generating documentation +cmp stdout expected-output.txt # compares stdout from binary with the golden file in the text archive below +cmp docs/index.md expected-index.md # compares the generated docs with the golden file in the text archive below +cmp docs/data-sources/example.md expected-datasource.md # compares the generated docs with the golden file in the text archive below +cmp docs/resources/example.md expected-resource.md # compares the generated docs with the golden file in the text archive below +``` \ No newline at end of file diff --git a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar index e7a5ccbf..6cad31f7 100644 --- a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar @@ -146,6 +146,20 @@ HasImport: true ImportFile: $WORK/examples/resources/scaffolding_example/import.sh HasImportIDConfig: true ImportIDConfigFile: $WORK/examples/resources/scaffolding_example/import-by-string-id.tf +HasImportIdentityConfig: true +ImportIdentityConfigFile: $WORK/examples/resources/scaffolding_example/import-by-identity.tf +IdentitySchemaMarkdown: +### Identity Schema + +#### Required + +- `name` (String) Name of resource. + +#### Optional + +- `project` (String) Project of resource, can also be sourced via `SCAFFOLDING_PROJECT` environment variable. +- `region` (String) Region of resource, can also be sourced via `SCAFFOLDING_REGION` environment variable. + ProviderName: terraform-provider-scaffolding ProviderShortName: scaffolding RenderedProviderName: terraform-provider-scaffolding @@ -309,6 +323,9 @@ HasImport: {{.HasImport}} ImportFile: {{.ImportFile}} HasImportIDConfig: {{.HasImportIDConfig}} ImportIDConfigFile: {{.ImportIDConfigFile}} +HasImportIdentityConfig: {{.HasImportIdentityConfig}} +ImportIdentityConfigFile: {{.ImportIdentityConfigFile}} +IdentitySchemaMarkdown: {{.IdentitySchemaMarkdown}} ProviderName: {{.ProviderName}} ProviderShortName: {{.ProviderShortName}} RenderedProviderName: {{.RenderedProviderName}} @@ -381,6 +398,19 @@ import { id = "id-123" } +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +-- examples/resources/scaffolding_example/import-by-identity.tf -- +import { + to = scaffolding_example.example + identity = { + name = "resource-abc" + project = "test-project-123" + region = "us-east-2" + } +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } @@ -509,6 +539,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/identityschema" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" @@ -520,6 +551,7 @@ import ( // Ensure provider defined types fully satisfy framework interfaces. var _ resource.Resource = &ExampleResource{} var _ resource.ResourceWithImportState = &ExampleResource{} +var _ resource.ResourceWithIdentity = &ExampleResource{} func NewExampleResource() resource.Resource { return &ExampleResource{} @@ -537,10 +569,36 @@ type ExampleResourceModel struct { Id types.String `tfsdk:"id"` } +// ExampleResourceIdentityModel describes the resource identity data model. +type ExampleResourceIdentityModel struct { + Name types.String `tfsdk:"name"` + Project types.String `tfsdk:"project"` + Region types.String `tfsdk:"region"` +} + func (r *ExampleResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { resp.TypeName = req.ProviderTypeName + "_example" } +func (r *ExampleResource) IdentitySchema(ctx context.Context, req resource.IdentitySchemaRequest, resp *resource.IdentitySchemaResponse) { + resp.IdentitySchema = identityschema.Schema{ + Attributes: map[string]identityschema.Attribute{ + "name": identityschema.StringAttribute{ + RequiredForImport: true, + Description: "Name of resource.", + }, + "project": identityschema.StringAttribute{ + OptionalForImport: true, + Description: "Project of resource, can also be sourced via `SCAFFOLDING_PROJECT` environment variable.", + }, + "region": identityschema.StringAttribute{ + OptionalForImport: true, + Description: "Region of resource, can also be sourced via `SCAFFOLDING_REGION` environment variable.", + }, + }, + } +} + func (r *ExampleResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. @@ -610,6 +668,13 @@ func (r *ExampleResource) Create(ctx context.Context, req resource.CreateRequest // save into the Terraform state. data.Id = types.StringValue("example-id") + // Create identity and store in Terraform state + resp.Diagnostics.Append(resp.Identity.Set(ctx, ExampleResourceIdentityModel{ + Name: types.StringValue("resource-abc"), + Project: types.StringValue("test-project-123"), + Region: types.StringValue("us-east-2"), + })...) + // Write logs using the tflog package // Documentation: https://terraform.io/plugin/log tflog.Trace(ctx, "created a resource") @@ -682,7 +747,7 @@ func (r *ExampleResource) Delete(ctx context.Context, req resource.DeleteRequest } func (r *ExampleResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + resource.ImportStatePassthroughWithIdentity(ctx, path.Root("id"), path.Root("name"), req, resp) } -- internal/provider/provider.go -- // Copyright (c) HashiCorp, Inc. @@ -824,75 +889,85 @@ testacc: -- go.mod -- module github.com/hashicorp/terraform-provider-scaffolding-framework -go 1.19 +go 1.23.0 + +toolchain go1.23.7 require ( - github.com/hashicorp/terraform-plugin-framework v1.4.2 + github.com/hashicorp/terraform-plugin-framework v1.15.0 github.com/hashicorp/terraform-plugin-log v0.9.0 ) require ( github.com/fatih/color v1.13.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect - github.com/hashicorp/go-plugin v1.5.1 // indirect + github.com/hashicorp/go-plugin v1.6.3 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.2 // indirect + github.com/hashicorp/terraform-plugin-go v0.27.0 // indirect + github.com/hashicorp/terraform-registry-address v0.2.5 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect - github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/oklog/run v1.0.0 // indirect - github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect - google.golang.org/grpc v1.57.1 // indirect - google.golang.org/protobuf v1.31.0 // indirect + golang.org/x/net v0.39.0 // indirect + golang.org/x/sys v0.32.0 // indirect + golang.org/x/text v0.24.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect + google.golang.org/grpc v1.72.1 // indirect + google.golang.org/protobuf v1.36.6 // indirect ) -- go.sum -- github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= 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/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k= -github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-plugin v1.6.3 h1:xgHB+ZUSYeuJi96WtxEjzi23uh7YQpznjGh0U0UUrwg= +github.com/hashicorp/go-plugin v1.6.3/go.mod h1:MRobyh+Wc/nYy1V4KAXUiYfzxoYhs7V1mlH1Z7iY2h0= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/terraform-plugin-framework v1.4.2 h1:P7a7VP1GZbjc4rv921Xy5OckzhoiO3ig6SGxwelD2sI= -github.com/hashicorp/terraform-plugin-framework v1.4.2/go.mod h1:GWl3InPFZi2wVQmdVnINPKys09s9mLmTZr95/ngLnbY= -github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU= -github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec= +github.com/hashicorp/terraform-plugin-framework v1.15.0 h1:LQ2rsOfmDLxcn5EeIwdXFtr03FVsNktbbBci8cOKdb4= +github.com/hashicorp/terraform-plugin-framework v1.15.0/go.mod h1:hxrNI/GY32KPISpWqlCoTLM9JZsGH3CyYlir09bD/fI= +github.com/hashicorp/terraform-plugin-go v0.27.0 h1:ujykws/fWIdsi6oTUT5Or4ukvEan4aN9lY+LOxVP8EE= +github.com/hashicorp/terraform-plugin-go v0.27.0/go.mod h1:FDa2Bb3uumkTGSkTFpWSOwWJDwA7bf3vdP3ltLDTH6o= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= -github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= +github.com/hashicorp/terraform-registry-address v0.2.5 h1:2GTftHqmUhVOeuu9CW3kwDkRe4pcBDq0uuK5VJngU1M= +github.com/hashicorp/terraform-registry-address v0.2.5/go.mod h1:PpzXWINwB5kuVS5CA7m1+eO2f1jKb5ZDIxrOPfpnGkg= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= @@ -900,35 +975,43 @@ github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQ 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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= -google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a h1:51aaUVRocpvUOSQKM6Q7VuoaktNIaMCLuhZB6DKksq4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a/go.mod h1:uRxBH1mhmO8PGhU89cMcHaXKZqO+OfakD8QQO0oYwlQ= +google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA= +google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar index 7c30ad2f..6a13f4c6 100644 --- a/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar @@ -127,6 +127,35 @@ resource "scaffolding_example" "example" { Import is supported using the following syntax: +In Terraform v1.12.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `identity` attribute, for example: + +```terraform +import { + to = scaffolding_example.example + identity = { + name = "resource-abc" + project = "test-project-123" + region = "us-east-2" + } +} + +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +``` + + +### Identity Schema + +#### Required + +- `name` (String) Name of resource. + +#### Optional + +- `project` (String) Project of resource, can also be sourced via `SCAFFOLDING_PROJECT` environment variable. +- `region` (String) Region of resource, can also be sourced via `SCAFFOLDING_REGION` environment variable. + In Terraform v1.5.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `id` attribute, for example: ```terraform @@ -163,6 +192,19 @@ data "scaffolding_example" "example" { provider "scaffolding" { # example configuration here } +-- examples/resources/scaffolding_example/import-by-identity.tf -- +import { + to = scaffolding_example.example + identity = { + name = "resource-abc" + project = "test-project-123" + region = "us-east-2" + } +} + +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} -- examples/resources/scaffolding_example/import-by-string-id.tf -- import { to = scaffolding_example.example @@ -297,6 +339,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/identityschema" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" @@ -308,6 +351,7 @@ import ( // Ensure provider defined types fully satisfy framework interfaces. var _ resource.Resource = &ExampleResource{} var _ resource.ResourceWithImportState = &ExampleResource{} +var _ resource.ResourceWithIdentity = &ExampleResource{} func NewExampleResource() resource.Resource { return &ExampleResource{} @@ -325,10 +369,36 @@ type ExampleResourceModel struct { Id types.String `tfsdk:"id"` } +// ExampleResourceIdentityModel describes the resource identity data model. +type ExampleResourceIdentityModel struct { + Name types.String `tfsdk:"name"` + Project types.String `tfsdk:"project"` + Region types.String `tfsdk:"region"` +} + func (r *ExampleResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { resp.TypeName = req.ProviderTypeName + "_example" } +func (r *ExampleResource) IdentitySchema(ctx context.Context, req resource.IdentitySchemaRequest, resp *resource.IdentitySchemaResponse) { + resp.IdentitySchema = identityschema.Schema{ + Attributes: map[string]identityschema.Attribute{ + "name": identityschema.StringAttribute{ + RequiredForImport: true, + Description: "Name of resource.", + }, + "project": identityschema.StringAttribute{ + OptionalForImport: true, + Description: "Project of resource, can also be sourced via `SCAFFOLDING_PROJECT` environment variable.", + }, + "region": identityschema.StringAttribute{ + OptionalForImport: true, + Description: "Region of resource, can also be sourced via `SCAFFOLDING_REGION` environment variable.", + }, + }, + } +} + func (r *ExampleResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. @@ -398,6 +468,13 @@ func (r *ExampleResource) Create(ctx context.Context, req resource.CreateRequest // save into the Terraform state. data.Id = types.StringValue("example-id") + // Create identity and store in Terraform state + resp.Diagnostics.Append(resp.Identity.Set(ctx, ExampleResourceIdentityModel{ + Name: types.StringValue("resource-abc"), + Project: types.StringValue("test-project-123"), + Region: types.StringValue("us-east-2"), + })...) + // Write logs using the tflog package // Documentation: https://terraform.io/plugin/log tflog.Trace(ctx, "created a resource") @@ -470,7 +547,7 @@ func (r *ExampleResource) Delete(ctx context.Context, req resource.DeleteRequest } func (r *ExampleResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + resource.ImportStatePassthroughWithIdentity(ctx, path.Root("id"), path.Root("name"), req, resp) } -- internal/provider/provider.go -- // Copyright (c) HashiCorp, Inc. @@ -612,75 +689,85 @@ testacc: -- go.mod -- module github.com/hashicorp/terraform-provider-scaffolding-framework -go 1.19 +go 1.23.0 + +toolchain go1.23.7 require ( - github.com/hashicorp/terraform-plugin-framework v1.4.2 + github.com/hashicorp/terraform-plugin-framework v1.15.0 github.com/hashicorp/terraform-plugin-log v0.9.0 ) require ( github.com/fatih/color v1.13.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect - github.com/hashicorp/go-plugin v1.5.1 // indirect + github.com/hashicorp/go-plugin v1.6.3 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.2 // indirect + github.com/hashicorp/terraform-plugin-go v0.27.0 // indirect + github.com/hashicorp/terraform-registry-address v0.2.5 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect - github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/oklog/run v1.0.0 // indirect - github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect - google.golang.org/grpc v1.57.1 // indirect - google.golang.org/protobuf v1.31.0 // indirect + golang.org/x/net v0.39.0 // indirect + golang.org/x/sys v0.32.0 // indirect + golang.org/x/text v0.24.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect + google.golang.org/grpc v1.72.1 // indirect + google.golang.org/protobuf v1.36.6 // indirect ) -- go.sum -- github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= 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/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k= -github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-plugin v1.6.3 h1:xgHB+ZUSYeuJi96WtxEjzi23uh7YQpznjGh0U0UUrwg= +github.com/hashicorp/go-plugin v1.6.3/go.mod h1:MRobyh+Wc/nYy1V4KAXUiYfzxoYhs7V1mlH1Z7iY2h0= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/terraform-plugin-framework v1.4.2 h1:P7a7VP1GZbjc4rv921Xy5OckzhoiO3ig6SGxwelD2sI= -github.com/hashicorp/terraform-plugin-framework v1.4.2/go.mod h1:GWl3InPFZi2wVQmdVnINPKys09s9mLmTZr95/ngLnbY= -github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU= -github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec= +github.com/hashicorp/terraform-plugin-framework v1.15.0 h1:LQ2rsOfmDLxcn5EeIwdXFtr03FVsNktbbBci8cOKdb4= +github.com/hashicorp/terraform-plugin-framework v1.15.0/go.mod h1:hxrNI/GY32KPISpWqlCoTLM9JZsGH3CyYlir09bD/fI= +github.com/hashicorp/terraform-plugin-go v0.27.0 h1:ujykws/fWIdsi6oTUT5Or4ukvEan4aN9lY+LOxVP8EE= +github.com/hashicorp/terraform-plugin-go v0.27.0/go.mod h1:FDa2Bb3uumkTGSkTFpWSOwWJDwA7bf3vdP3ltLDTH6o= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= -github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= +github.com/hashicorp/terraform-registry-address v0.2.5 h1:2GTftHqmUhVOeuu9CW3kwDkRe4pcBDq0uuK5VJngU1M= +github.com/hashicorp/terraform-registry-address v0.2.5/go.mod h1:PpzXWINwB5kuVS5CA7m1+eO2f1jKb5ZDIxrOPfpnGkg= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= @@ -688,35 +775,43 @@ github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQ 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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= +golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= -google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= +golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= +golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a h1:51aaUVRocpvUOSQKM6Q7VuoaktNIaMCLuhZB6DKksq4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a/go.mod h1:uRxBH1mhmO8PGhU89cMcHaXKZqO+OfakD8QQO0oYwlQ= +google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA= +google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar index 93dd75ab..c5cfe008 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_named_templates.txtar @@ -194,6 +194,20 @@ HasImport: true ImportFile: $WORK/examples/resources/scaffolding_example/import.sh HasImportIDConfig: true ImportIDConfigFile: $WORK/examples/resources/scaffolding_example/import-by-string-id.tf +HasImportIdentityConfig: true +ImportIdentityConfigFile: $WORK/examples/resources/scaffolding_example/import-by-identity.tf +IdentitySchemaMarkdown: +### Identity Schema + +#### Required + +- `name` (String) Name of resource. + +#### Optional + +- `project` (String) Project of resource, can also be sourced via `SCAFFOLDING_PROJECT` environment variable. +- `region` (String) Region of resource, can also be sourced via `SCAFFOLDING_REGION` environment variable. + ProviderName: terraform-provider-scaffolding ProviderShortName: Scaffolding RenderedProviderName: Scaffolding @@ -456,6 +470,9 @@ HasImport: {{.HasImport}} ImportFile: {{.ImportFile}} HasImportIDConfig: {{.HasImportIDConfig}} ImportIDConfigFile: {{.ImportIDConfigFile}} +HasImportIdentityConfig: {{.HasImportIdentityConfig}} +ImportIdentityConfigFile: {{.ImportIdentityConfigFile}} +IdentitySchemaMarkdown: {{.IdentitySchemaMarkdown}} ProviderName: {{.ProviderName}} ProviderShortName: {{.ProviderShortName}} RenderedProviderName: {{.RenderedProviderName}} @@ -597,6 +614,19 @@ import { id = "id-123" } +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +-- examples/resources/scaffolding_example/import-by-identity.tf -- +import { + to = scaffolding_example.example + identity = { + name = "resource-abc" + project = "test-project-123" # can also be read via SCAFFOLDING_PROJECT environment variable + region = "us-east-2" # can also be read via SCAFFOLDING_REGION environment variable + } +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } @@ -652,6 +682,28 @@ terraform import scaffolding_example.example "id-123" } } }, + "resource_identity_schemas": { + "scaffolding_example": { + "version": 0, + "attributes": { + "name": { + "type": "string", + "description": "Name of resource.", + "required_for_import": true + }, + "project": { + "type": "string", + "description": "Project of resource, can also be sourced via `SCAFFOLDING_PROJECT` environment variable.", + "optional_for_import": true + }, + "region": { + "type": "string", + "description": "Region of resource, can also be sourced via `SCAFFOLDING_REGION` environment variable.", + "optional_for_import": true + } + } + } + }, "ephemeral_resource_schemas": { "scaffolding_example": { "version": 0, diff --git a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar index 80251b8f..bb1e5961 100644 --- a/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar +++ b/cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_no_templates.txtar @@ -197,6 +197,35 @@ resource "scaffolding_example" "example" { Import is supported using the following syntax: +In Terraform v1.12.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `identity` attribute, for example: + +```terraform +import { + to = scaffolding_example.example + identity = { + name = "resource-abc" + project = "test-project-123" # can also be read via SCAFFOLDING_PROJECT environment variable + region = "us-east-2" # can also be read via SCAFFOLDING_REGION environment variable + } +} + +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +``` + + +### Identity Schema + +#### Required + +- `name` (String) Name of resource. + +#### Optional + +- `project` (String) Project of resource, can also be sourced via `SCAFFOLDING_PROJECT` environment variable. +- `region` (String) Region of resource, can also be sourced via `SCAFFOLDING_REGION` environment variable. + In Terraform v1.5.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `id` attribute, for example: ```terraform @@ -273,6 +302,19 @@ import { id = "id-123" } +resource "scaffolding_example" "example" { + configurable_attribute = "some-value" +} +-- examples/resources/scaffolding_example/import-by-identity.tf -- +import { + to = scaffolding_example.example + identity = { + name = "resource-abc" + project = "test-project-123" # can also be read via SCAFFOLDING_PROJECT environment variable + region = "us-east-2" # can also be read via SCAFFOLDING_REGION environment variable + } +} + resource "scaffolding_example" "example" { configurable_attribute = "some-value" } @@ -335,6 +377,28 @@ resource "scaffolding_example" "example" { } } }, + "resource_identity_schemas": { + "scaffolding_example": { + "version": 0, + "attributes": { + "name": { + "type": "string", + "description": "Name of resource.", + "required_for_import": true + }, + "project": { + "type": "string", + "description": "Project of resource, can also be sourced via `SCAFFOLDING_PROJECT` environment variable.", + "optional_for_import": true + }, + "region": { + "type": "string", + "description": "Region of resource, can also be sourced via `SCAFFOLDING_REGION` environment variable.", + "optional_for_import": true + } + } + } + }, "ephemeral_resource_schemas": { "scaffolding_example": { "version": 0, diff --git a/internal/provider/generate.go b/internal/provider/generate.go index 5fe68a4d..85370946 100644 --- a/internal/provider/generate.go +++ b/internal/provider/generate.go @@ -629,7 +629,7 @@ func (g *generator) renderStaticWebsite(providerSchema *tfjson.ProviderSchema) e if resSchema != nil { tmpl := resourceTemplate(tmplData) - render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Data Source", exampleFilePath, "", "", resSchema) + render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Data Source", exampleFilePath, "", "", "", resSchema, nil) if err != nil { return fmt.Errorf("unable to render data source template %q: %w", rel, err) } @@ -642,13 +642,15 @@ func (g *generator) renderStaticWebsite(providerSchema *tfjson.ProviderSchema) e g.warnf("data source entitled %q, or %q does not exist", shortName, resName) case "resources/": resSchema, resName := resourceSchema(providerSchema.ResourceSchemas, shortName, relFile) + resIdentitySchema := resourceIdentitySchema(providerSchema.ResourceIdentitySchemas, shortName, relFile) exampleFilePath := filepath.Join(g.ProviderExamplesDir(), "resources", resName, "resource.tf") importFilePath := filepath.Join(g.ProviderExamplesDir(), "resources", resName, "import.sh") importIDConfigFilePath := filepath.Join(g.ProviderExamplesDir(), "resources", resName, "import-by-string-id.tf") + importIdentityConfigFilePath := filepath.Join(g.ProviderExamplesDir(), "resources", resName, "import-by-identity.tf") if resSchema != nil { tmpl := resourceTemplate(tmplData) - render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Resource", exampleFilePath, importIDConfigFilePath, importFilePath, resSchema) + render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Resource", exampleFilePath, importIDConfigFilePath, importIdentityConfigFilePath, importFilePath, resSchema, resIdentitySchema) if err != nil { return fmt.Errorf("unable to render resource template %q: %w", rel, err) } @@ -683,7 +685,7 @@ func (g *generator) renderStaticWebsite(providerSchema *tfjson.ProviderSchema) e if resSchema != nil { tmpl := resourceTemplate(tmplData) - render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Ephemeral Resource", exampleFilePath, "", "", resSchema) + render, err := tmpl.Render(g.providerDir, resName, g.providerName, g.renderedProviderName, "Ephemeral Resource", exampleFilePath, "", "", "", resSchema, nil) if err != nil { return fmt.Errorf("unable to render ephemeral resource template %q: %w", rel, err) } diff --git a/internal/provider/template.go b/internal/provider/template.go index e77792d1..5912ac7a 100644 --- a/internal/provider/template.go +++ b/internal/provider/template.go @@ -158,7 +158,7 @@ func (t providerTemplate) Render(providerDir, providerName, renderedProviderName }) } -func (t resourceTemplate) Render(providerDir, name, providerName, renderedProviderName, typeName, exampleFile, importIDConfigFile, importCmdFile string, schema *tfjson.Schema) (string, error) { +func (t resourceTemplate) Render(providerDir, name, providerName, renderedProviderName, typeName, exampleFile, importIDConfigFile, importIdentityConfigFile, importCmdFile string, schema *tfjson.Schema, identitySchema *tfjson.IdentitySchema) (string, error) { schemaBuffer := bytes.NewBuffer(nil) err := schemamd.Render(schema, schemaBuffer) if err != nil { @@ -170,6 +170,25 @@ func (t resourceTemplate) Render(providerDir, name, providerName, renderedProvid return "", nil } + hasImportIdentityConfig := importIdentityConfigFile != "" && fileExists(importIdentityConfigFile) + identitySchemaBuffer := bytes.NewBuffer(nil) + + // Always render the identity schema if we have one, so it can be used in custom templates. + if identitySchema != nil { + _, err := io.WriteString(identitySchemaBuffer, schemaComment+"\n") + if err != nil { + return "", fmt.Errorf("unable to render identity schema comment: %w", err) + } + + err = schemamd.RenderIdentitySchema(identitySchema, identitySchemaBuffer) + if err != nil { + return "", fmt.Errorf("unable to render identity schema: %w", err) + } + } else if hasImportIdentityConfig { + // If there is an identity example, but we don't have an identity schema, we should return an error to ensure the example file was intended. + return "", fmt.Errorf("unable to render: an identity import example (%q) was provided for a resource (%q) that does not support resource identity", importIdentityConfigFile, name) + } + return renderStringTemplate(providerDir, "resourceTemplate", s, struct { Type string Name string @@ -184,6 +203,10 @@ func (t resourceTemplate) Render(providerDir, name, providerName, renderedProvid HasImportIDConfig bool ImportIDConfigFile string + HasImportIdentityConfig bool + ImportIdentityConfigFile string + IdentitySchemaMarkdown string + ProviderName string ProviderShortName string @@ -204,6 +227,10 @@ func (t resourceTemplate) Render(providerDir, name, providerName, renderedProvid HasImportIDConfig: importIDConfigFile != "" && fileExists(importIDConfigFile), ImportIDConfigFile: importIDConfigFile, + HasImportIdentityConfig: hasImportIdentityConfig, + ImportIdentityConfigFile: importIdentityConfigFile, + IdentitySchemaMarkdown: identitySchemaBuffer.String(), + ProviderName: providerName, ProviderShortName: providerShortName(renderedProviderName), @@ -294,12 +321,20 @@ description: |- {{- end }} {{ .SchemaMarkdown | trimspace }} -{{- if or .HasImport .HasImportIDConfig }} +{{- if or .HasImport .HasImportIDConfig .HasImportIdentityConfig }} ## Import Import is supported using the following syntax: {{- end }} +{{- if .HasImportIdentityConfig }} + +In Terraform v1.12.0 and later, the [` + "`" + `import` + "`" + ` block](https://developer.hashicorp.com/terraform/language/import) can be used with the ` + "`" + `identity` + "`" + ` attribute, for example: + +{{tffile .ImportIdentityConfigFile }} + +{{ .IdentitySchemaMarkdown | trimspace }} +{{- end }} {{- if .HasImportIDConfig }} In Terraform v1.5.0 and later, the [` + "`" + `import` + "`" + ` block](https://developer.hashicorp.com/terraform/language/import) can be used with the ` + "`" + `id` + "`" + ` attribute, for example: diff --git a/internal/provider/template_test.go b/internal/provider/template_test.go index 3760b94d..d60e3992 100644 --- a/internal/provider/template_test.go +++ b/internal/provider/template_test.go @@ -93,7 +93,7 @@ provider "scaffolding" { }, } - result, err := tpl.Render("testdata/test-provider-dir", "testTemplate", "test-provider", "test-provider", "Resource", "provider.tf", "", "", &schema) + result, err := tpl.Render("testdata/test-provider-dir", "testTemplate", "test-provider", "test-provider", "Resource", "provider.tf", "", "", "", &schema, nil) if err != nil { t.Error(err) } diff --git a/internal/provider/util.go b/internal/provider/util.go index bcb8084d..8a879cfa 100644 --- a/internal/provider/util.go +++ b/internal/provider/util.go @@ -89,6 +89,19 @@ func resourceSchema(schemas map[string]*tfjson.Schema, providerShortName, templa return nil, resName } +func resourceIdentitySchema(schemas map[string]*tfjson.IdentitySchema, providerShortName, templateFileName string) *tfjson.IdentitySchema { + resName := providerShortName + "_" + removeAllExt(templateFileName) + if schema, ok := schemas[resName]; ok { + return schema + } + + if schema, ok := schemas[providerShortName]; ok { + return schema + } + + return nil +} + func writeFile(path string, data string) error { dir, _ := filepath.Split(path) diff --git a/internal/schemamd/render.go b/internal/schemamd/render.go index 5033c6ac..cc5cdc45 100644 --- a/internal/schemamd/render.go +++ b/internal/schemamd/render.go @@ -6,6 +6,7 @@ package schemamd import ( "fmt" "io" + "slices" "sort" "strings" @@ -35,6 +36,122 @@ func Render(schema *tfjson.Schema, w io.Writer) error { return nil } +func RenderIdentitySchema(identitySchema *tfjson.IdentitySchema, w io.Writer) error { + _, err := io.WriteString(w, "### Identity Schema\n\n") + if err != nil { + return err + } + + err = writeIdentitySchemaAttributes(w, identitySchema.Attributes) + if err != nil { + return fmt.Errorf("unable to render identity schema: %w", err) + } + + return nil +} + +func writeIdentitySchemaAttributes(w io.Writer, attrs map[string]*tfjson.IdentityAttribute) error { + attrNames := []string{} + for n := range attrs { + attrNames = append(attrNames, n) + } + + requiredForImportNames := []string{} + optionalForImportNames := []string{} + for _, name := range attrNames { + attr := attrs[name] + + if attr.RequiredForImport { + requiredForImportNames = append(requiredForImportNames, name) + continue + } + + if attr.OptionalForImport { + optionalForImportNames = append(optionalForImportNames, name) + continue + } + + return fmt.Errorf("invalid schema: for %q attribute, either RequiredForImport for OptionalForImport must be set to true", name) + } + + slices.Sort(requiredForImportNames) + slices.Sort(optionalForImportNames) + + for i, name := range requiredForImportNames { + requiredAttr := attrs[name] + if i == 0 { + _, err := io.WriteString(w, "#### Required\n\n") + if err != nil { + return err + } + } + + err := writeIdentityAttribute(w, name, requiredAttr) + if err != nil { + return fmt.Errorf("unable to render identity attribute %q: %w", name, err) + } + } + + _, err := io.WriteString(w, "\n") + if err != nil { + return err + } + + for i, name := range optionalForImportNames { + optionalAttr := attrs[name] + if i == 0 { + _, err := io.WriteString(w, "#### Optional\n\n") + if err != nil { + return err + } + } + + err := writeIdentityAttribute(w, name, optionalAttr) + if err != nil { + return fmt.Errorf("unable to render identity attribute %q: %w", name, err) + } + } + + return nil +} + +func writeIdentityAttribute(w io.Writer, name string, attr *tfjson.IdentityAttribute) error { + _, err := io.WriteString(w, "- `"+name+"` ") + if err != nil { + return err + } + + _, err = io.WriteString(w, "(") + if err != nil { + return err + } + + err = WriteType(w, attr.IdentityType) + if err != nil { + return err + } + + _, err = io.WriteString(w, ")") + if err != nil { + return err + } + + desc := strings.TrimSpace(attr.Description) + if desc != "" { + _, err = io.WriteString(w, " "+desc) + if err != nil { + return err + } + } + + _, err = io.WriteString(w, "\n") + if err != nil { + return err + } + + return nil +} + // Group by Attribute/Block characteristics. type groupFilter struct { topLevelTitle string diff --git a/internal/schemamd/render_test.go b/internal/schemamd/render_test.go index 2cf09eb1..f836d6d7 100644 --- a/internal/schemamd/render_test.go +++ b/internal/schemamd/render_test.go @@ -98,3 +98,56 @@ func TestRender(t *testing.T) { }) } } + +func TestRenderIdentitySchema(t *testing.T) { + t.Parallel() + + for _, c := range []struct { + name string + inputFile string + expectedFile string + }{ + { + "identity", + "testdata/identity.schema.json", + "testdata/identity.md", + }, + } { + t.Run(c.name, func(t *testing.T) { + t.Parallel() + + input, err := os.ReadFile(c.inputFile) + if err != nil { + t.Fatal(err) + } + + expected, err := os.ReadFile(c.expectedFile) + if err != nil { + t.Fatal(err) + } + + var identitySchema tfjson.IdentitySchema + + err = json.Unmarshal(input, &identitySchema) + if err != nil { + t.Fatal(err) + } + + b := &strings.Builder{} + err = schemamd.RenderIdentitySchema(&identitySchema, b) + if err != nil { + t.Fatal(err) + } + + // Remove \r characters so tests don't fail on windows + expectedStr := strings.ReplaceAll(string(expected), "\r", "") + + // Remove trailing newlines before comparing (some text editors remove them). + expectedStr = strings.TrimRight(expectedStr, "\n") + actual := strings.TrimRight(b.String(), "\n") + if diff := cmp.Diff(expectedStr, actual); diff != "" { + t.Fatalf("Unexpected diff (-wanted, +got): %s", diff) + } + }) + } +} diff --git a/internal/schemamd/testdata/identity.md b/internal/schemamd/testdata/identity.md new file mode 100644 index 00000000..62c46778 --- /dev/null +++ b/internal/schemamd/testdata/identity.md @@ -0,0 +1,14 @@ +### Identity Schema + +#### Required + +- `bool_attribute` (Boolean) example bool attribute +- `list_of_bools_attribute` (List of Boolean) example list attribute with bool elements +- `list_of_strings_attribute` (List of String) example list attribute with string elements +- `string_attribute` (String) example string attribute + +#### Optional + +- `float64_attribute` (Number) example float64 attribute +- `int64_attribute` (Number) example int64 attribute +- `number_attribute` (Number) example number attribute diff --git a/internal/schemamd/testdata/identity.schema.json b/internal/schemamd/testdata/identity.schema.json new file mode 100644 index 00000000..02561fa4 --- /dev/null +++ b/internal/schemamd/testdata/identity.schema.json @@ -0,0 +1,46 @@ +{ + "version": 0, + "attributes": { + "float64_attribute": { + "type": "number", + "description": "example float64 attribute", + "optional_for_import": true + }, + "number_attribute": { + "type": "number", + "description": "example number attribute", + "optional_for_import": true + }, + "list_of_strings_attribute": { + "type": [ + "list", + "string" + ], + "description": "example list attribute with string elements", + "required_for_import": true + }, + "bool_attribute": { + "type": "bool", + "description": "example bool attribute", + "required_for_import": true + }, + "string_attribute": { + "type": "string", + "description": "example string attribute", + "required_for_import": true + }, + "int64_attribute": { + "type": "number", + "description": "example int64 attribute", + "optional_for_import": true + }, + "list_of_bools_attribute": { + "type": [ + "list", + "bool" + ], + "description": "example list attribute with bool elements", + "required_for_import": true + } + } +} \ No newline at end of file From 0be94a77bdb365b5cfe31e4c21f7815b384d2399 Mon Sep 17 00:00:00 2001 From: hc-github-team-tf-provider-devex Date: Tue, 1 Jul 2025 16:04:52 +0000 Subject: [PATCH 33/33] Update changelog --- .changes/0.22.0.md | 27 +++++++++++++++++++ .../BREAKING CHANGES-20250613-135104.yaml | 6 ----- .../unreleased/BUG FIXES-20250318-151955.yaml | 5 ---- .../unreleased/BUG FIXES-20250613-152846.yaml | 5 ---- .../ENHANCEMENTS-20250318-152238.yaml | 5 ---- .../ENHANCEMENTS-20250318-152345.yaml | 5 ---- .../ENHANCEMENTS-20250613-134814.yaml | 5 ---- .../ENHANCEMENTS-20250613-162958.yaml | 5 ---- .../unreleased/FEATURES-20250616-181322.yaml | 5 ---- .../unreleased/FEATURES-20250625-173710.yaml | 6 ----- .../unreleased/NOTES-20250630-144026.yaml | 6 ----- CHANGELOG.md | 27 +++++++++++++++++++ 12 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 .changes/0.22.0.md delete mode 100644 .changes/unreleased/BREAKING CHANGES-20250613-135104.yaml delete mode 100644 .changes/unreleased/BUG FIXES-20250318-151955.yaml delete mode 100644 .changes/unreleased/BUG FIXES-20250613-152846.yaml delete mode 100644 .changes/unreleased/ENHANCEMENTS-20250318-152238.yaml delete mode 100644 .changes/unreleased/ENHANCEMENTS-20250318-152345.yaml delete mode 100644 .changes/unreleased/ENHANCEMENTS-20250613-134814.yaml delete mode 100644 .changes/unreleased/ENHANCEMENTS-20250613-162958.yaml delete mode 100644 .changes/unreleased/FEATURES-20250616-181322.yaml delete mode 100644 .changes/unreleased/FEATURES-20250625-173710.yaml delete mode 100644 .changes/unreleased/NOTES-20250630-144026.yaml diff --git a/.changes/0.22.0.md b/.changes/0.22.0.md new file mode 100644 index 00000000..c784e679 --- /dev/null +++ b/.changes/0.22.0.md @@ -0,0 +1,27 @@ +## 0.22.0 (July 01, 2025) + +BREAKING CHANGES: + +* generate: The `.ProviderShortName` template function now uses the rendered provider name to derive the provider short name. Users that pass in the `--rendered-provider-name` flag might see a different output for this function ([#492](https://github.com/hashicorp/terraform-plugin-docs/issues/492)) + +NOTES: + +* generate: Generated import documentation will now contain more information about which methods are supported by the provider (CLI command, config by ID, config by identity). ([#495](https://github.com/hashicorp/terraform-plugin-docs/issues/495)) + +FEATURES: + +* generate: Added support for defining import example file (`import-by-string-id.tf`) using Terraform configuration and the `id` attribute ([#472](https://github.com/hashicorp/terraform-plugin-docs/issues/472)) +* generate: Added support for defining import example file (`import-by-identity.tf`) using Terraform configuration and the `identity` attribute (managed resource identity) ([#496](https://github.com/hashicorp/terraform-plugin-docs/issues/496)) + +ENHANCEMENTS: + +* validate: Add `allowed-guide-subcategories` and `allowed-resource-subcategories` to provide a list of allowed subcategories ([#456](https://github.com/hashicorp/terraform-plugin-docs/issues/456)) +* validate: Add `allowed-guide-subcategories-file` and `allowed-resource-subcategories-file` to provide a file containing a list of allowed subcategories ([#456](https://github.com/hashicorp/terraform-plugin-docs/issues/456)) +* generate: Default resource and function templates now use `.RenderedProviderName` instead of `.ProviderName` ([#492](https://github.com/hashicorp/terraform-plugin-docs/issues/492)) +* generate: Remove trailing whitespace from default function template when `.HasVariadic` evaluates to false ([#489](https://github.com/hashicorp/terraform-plugin-docs/issues/489)) + +BUG FIXES: + +* validate: Fixed a bug that caused all non-index files to be detected as guides ([#456](https://github.com/hashicorp/terraform-plugin-docs/issues/456)) +* generate: Remove `subcategory` field from default provider templates ([#446](https://github.com/hashicorp/terraform-plugin-docs/issues/446)) + diff --git a/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml b/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml deleted file mode 100644 index 990825bc..00000000 --- a/.changes/unreleased/BREAKING CHANGES-20250613-135104.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: BREAKING CHANGES -body: 'generate: The `.ProviderShortName` template function now uses the rendered provider name to derive the provider short name. Users that pass in the - `--rendered-provider-name` flag might see a different output for this function' -time: 2025-06-13T13:51:04.745115-04:00 -custom: - Issue: "492" diff --git a/.changes/unreleased/BUG FIXES-20250318-151955.yaml b/.changes/unreleased/BUG FIXES-20250318-151955.yaml deleted file mode 100644 index 94a5dd94..00000000 --- a/.changes/unreleased/BUG FIXES-20250318-151955.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: 'validate: Fixed a bug that caused all non-index files to be detected as guides' -time: 2025-03-18T15:19:55.463729-05:00 -custom: - Issue: "456" diff --git a/.changes/unreleased/BUG FIXES-20250613-152846.yaml b/.changes/unreleased/BUG FIXES-20250613-152846.yaml deleted file mode 100644 index ab5359dd..00000000 --- a/.changes/unreleased/BUG FIXES-20250613-152846.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: 'generate: Remove `subcategory` field from default provider templates' -time: 2025-06-13T15:28:46.039473-04:00 -custom: - Issue: "446" diff --git a/.changes/unreleased/ENHANCEMENTS-20250318-152238.yaml b/.changes/unreleased/ENHANCEMENTS-20250318-152238.yaml deleted file mode 100644 index 5b012c0d..00000000 --- a/.changes/unreleased/ENHANCEMENTS-20250318-152238.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: ENHANCEMENTS -body: 'validate: Add `allowed-guide-subcategories` and `allowed-resource-subcategories` to provide a list of allowed subcategories' -time: 2025-03-18T15:22:38.292714-05:00 -custom: - Issue: "456" diff --git a/.changes/unreleased/ENHANCEMENTS-20250318-152345.yaml b/.changes/unreleased/ENHANCEMENTS-20250318-152345.yaml deleted file mode 100644 index 5b0e6ae7..00000000 --- a/.changes/unreleased/ENHANCEMENTS-20250318-152345.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: ENHANCEMENTS -body: 'validate: Add `allowed-guide-subcategories-file` and `allowed-resource-subcategories-file` to provide a file containing a list of allowed subcategories' -time: 2025-03-18T15:23:45.718553-05:00 -custom: - Issue: "456" diff --git a/.changes/unreleased/ENHANCEMENTS-20250613-134814.yaml b/.changes/unreleased/ENHANCEMENTS-20250613-134814.yaml deleted file mode 100644 index 271fcd99..00000000 --- a/.changes/unreleased/ENHANCEMENTS-20250613-134814.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: ENHANCEMENTS -body: 'generate: Default resource and function templates now use `.RenderedProviderName` instead of `.ProviderName`' -time: 2025-06-13T13:48:14.705452-04:00 -custom: - Issue: "492" diff --git a/.changes/unreleased/ENHANCEMENTS-20250613-162958.yaml b/.changes/unreleased/ENHANCEMENTS-20250613-162958.yaml deleted file mode 100644 index df64549f..00000000 --- a/.changes/unreleased/ENHANCEMENTS-20250613-162958.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: ENHANCEMENTS -body: 'generate: Remove trailing whitespace from default function template when `.HasVariadic` evaluates to false' -time: 2025-06-13T16:29:58.411584-04:00 -custom: - Issue: "489" diff --git a/.changes/unreleased/FEATURES-20250616-181322.yaml b/.changes/unreleased/FEATURES-20250616-181322.yaml deleted file mode 100644 index 0cfe1198..00000000 --- a/.changes/unreleased/FEATURES-20250616-181322.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: FEATURES -body: 'generate: Added support for defining import example file (`import-by-string-id.tf`) using Terraform configuration and the `id` attribute' -time: 2025-06-16T18:13:22.627319-04:00 -custom: - Issue: "472" diff --git a/.changes/unreleased/FEATURES-20250625-173710.yaml b/.changes/unreleased/FEATURES-20250625-173710.yaml deleted file mode 100644 index 1aed0b63..00000000 --- a/.changes/unreleased/FEATURES-20250625-173710.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: FEATURES -body: 'generate: Added support for defining import example file (`import-by-identity.tf`) using Terraform configuration - and the `identity` attribute (managed resource identity)' -time: 2025-06-25T17:37:10.853795-04:00 -custom: - Issue: "496" diff --git a/.changes/unreleased/NOTES-20250630-144026.yaml b/.changes/unreleased/NOTES-20250630-144026.yaml deleted file mode 100644 index 32b45a11..00000000 --- a/.changes/unreleased/NOTES-20250630-144026.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: NOTES -body: 'generate: Generated import documentation will now contain more information about which methods are - supported by the provider (CLI command, config by ID, config by identity).' -time: 2025-06-30T14:40:26.94407-04:00 -custom: - Issue: "495" diff --git a/CHANGELOG.md b/CHANGELOG.md index 7de43e87..9a948f1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ +## 0.22.0 (July 01, 2025) + +BREAKING CHANGES: + +* generate: The `.ProviderShortName` template function now uses the rendered provider name to derive the provider short name. Users that pass in the `--rendered-provider-name` flag might see a different output for this function ([#492](https://github.com/hashicorp/terraform-plugin-docs/issues/492)) + +NOTES: + +* generate: Generated import documentation will now contain more information about which methods are supported by the provider (CLI command, config by ID, config by identity). ([#495](https://github.com/hashicorp/terraform-plugin-docs/issues/495)) + +FEATURES: + +* generate: Added support for defining import example file (`import-by-string-id.tf`) using Terraform configuration and the `id` attribute ([#472](https://github.com/hashicorp/terraform-plugin-docs/issues/472)) +* generate: Added support for defining import example file (`import-by-identity.tf`) using Terraform configuration and the `identity` attribute (managed resource identity) ([#496](https://github.com/hashicorp/terraform-plugin-docs/issues/496)) + +ENHANCEMENTS: + +* validate: Add `allowed-guide-subcategories` and `allowed-resource-subcategories` to provide a list of allowed subcategories ([#456](https://github.com/hashicorp/terraform-plugin-docs/issues/456)) +* validate: Add `allowed-guide-subcategories-file` and `allowed-resource-subcategories-file` to provide a file containing a list of allowed subcategories ([#456](https://github.com/hashicorp/terraform-plugin-docs/issues/456)) +* generate: Default resource and function templates now use `.RenderedProviderName` instead of `.ProviderName` ([#492](https://github.com/hashicorp/terraform-plugin-docs/issues/492)) +* generate: Remove trailing whitespace from default function template when `.HasVariadic` evaluates to false ([#489](https://github.com/hashicorp/terraform-plugin-docs/issues/489)) + +BUG FIXES: + +* validate: Fixed a bug that caused all non-index files to be detected as guides ([#456](https://github.com/hashicorp/terraform-plugin-docs/issues/456)) +* generate: Remove `subcategory` field from default provider templates ([#446](https://github.com/hashicorp/terraform-plugin-docs/issues/446)) + ## 0.21.0 (February 27, 2025) FEATURES: