Skip to content

Commit f266d1e

Browse files
"Add cloud integration option"
A more native integration for Terraform Cloud and its CLI-driven run workflow. Instead of a backend, users declare a special block in the top-level terraform settings block to configure Terraform Cloud, then run terraform init. Full documentation will follow in later commits.
2 parents 9b62dd6 + 3692648 commit f266d1e

143 files changed

Lines changed: 12561 additions & 608 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎go.mod‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require (
44
cloud.google.com/go/storage v1.10.0
55
github.com/Azure/azure-sdk-for-go v52.5.0+incompatible
66
github.com/Azure/go-autorest/autorest v0.11.18
7+
github.com/Netflix/go-expect v0.0.0-20211003183012-e1a7c020ce25
78
github.com/agext/levenshtein v1.2.3
89
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190329064014-6e358769c32a
910
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190103054945-8205d1f41e70
@@ -22,7 +23,7 @@ require (
2223
github.com/davecgh/go-spew v1.1.1
2324
github.com/dylanmei/winrmtest v0.0.0-20190225150635-99b7fe2fddf1
2425
github.com/go-test/deep v1.0.3
25-
github.com/golang/mock v1.5.0
26+
github.com/golang/mock v1.6.0
2627
github.com/golang/protobuf v1.5.2
2728
github.com/google/go-cmp v0.5.5
2829
github.com/google/uuid v1.2.0
@@ -39,9 +40,9 @@ require (
3940
github.com/hashicorp/go-hclog v0.15.0
4041
github.com/hashicorp/go-multierror v1.1.1
4142
github.com/hashicorp/go-plugin v1.4.3
42-
github.com/hashicorp/go-retryablehttp v0.5.2
43-
github.com/hashicorp/go-tfe v0.15.0
44-
github.com/hashicorp/go-uuid v1.0.1
43+
github.com/hashicorp/go-retryablehttp v0.7.0
44+
github.com/hashicorp/go-tfe v0.19.1-0.20211020175229-e52963e079d0
45+
github.com/hashicorp/go-uuid v1.0.2
4546
github.com/hashicorp/go-version v1.2.1
4647
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f
4748
github.com/hashicorp/hcl/v2 v2.10.1
@@ -143,9 +144,9 @@ require (
143144
github.com/hashicorp/go-msgpack v0.5.4 // indirect
144145
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
145146
github.com/hashicorp/go-safetemp v1.0.0 // indirect
146-
github.com/hashicorp/go-slug v0.4.1 // indirect
147+
github.com/hashicorp/go-slug v0.7.0 // indirect
147148
github.com/hashicorp/golang-lru v0.5.1 // indirect
148-
github.com/hashicorp/jsonapi v0.0.0-20210518035559-1e50d74c8db3 // indirect
149+
github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d // indirect
149150
github.com/hashicorp/serf v0.9.5 // indirect
150151
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
151152
github.com/huandu/xstrings v1.3.2 // indirect
@@ -154,6 +155,7 @@ require (
154155
github.com/jstemmer/go-junit-report v0.9.1 // indirect
155156
github.com/jtolds/gls v4.2.1+incompatible // indirect
156157
github.com/klauspost/compress v1.11.2 // indirect
158+
github.com/kr/pty v1.1.1 // indirect
157159
github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect
158160
github.com/mattn/go-colorable v0.1.6 // indirect
159161
github.com/mitchellh/go-testing-interface v1.0.0 // indirect

‎go.sum‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuN
8989
github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU=
9090
github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
9191
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
92+
github.com/Netflix/go-expect v0.0.0-20211003183012-e1a7c020ce25 h1:hWfsqBaNZUHztXA78g7Y2Jj3rDQaTCZhhFwz43i2VlA=
93+
github.com/Netflix/go-expect v0.0.0-20211003183012-e1a7c020ce25/go.mod h1:68ORG0HSEWDuH5Eh73AFbYWZ1zT4Y+b0vhOa+vZRUdI=
9294
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
9395
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
9496
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
@@ -241,8 +243,9 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU
241243
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
242244
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
243245
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
244-
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
245246
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
247+
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
248+
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
246249
github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
247250
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
248251
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -349,6 +352,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
349352
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
350353
github.com/hashicorp/go-getter v1.5.2 h1:XDo8LiAcDisiqZdv0TKgz+HtX3WN7zA2JD1R1tjsabE=
351354
github.com/hashicorp/go-getter v1.5.2/go.mod h1:orNH3BTYLu/fIxGIdLjLoAJHWMDQ/UKQr5O4m3iBuoo=
355+
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
352356
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
353357
github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
354358
github.com/hashicorp/go-hclog v0.15.0 h1:qMuK0wxsoW4D0ddCCYwPSTm4KQv1X1ke3WmPWZ0Mvsk=
@@ -364,22 +368,23 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
364368
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
365369
github.com/hashicorp/go-plugin v1.4.3 h1:DXmvivbWD5qdiBts9TpBC7BYL1Aia5sxbRgQB+v6UZM=
366370
github.com/hashicorp/go-plugin v1.4.3/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ=
367-
github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4=
368-
github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
371+
github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4=
372+
github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
369373
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
370374
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
371375
github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
372376
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
373-
github.com/hashicorp/go-slug v0.4.1 h1:/jAo8dNuLgSImoLXaX7Od7QB4TfYCVPam+OpAt5bZqc=
374-
github.com/hashicorp/go-slug v0.4.1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=
377+
github.com/hashicorp/go-slug v0.7.0 h1:8HIi6oreWPtnhpYd8lIGQBgp4rXzDWQTOhfILZm+nok=
378+
github.com/hashicorp/go-slug v0.7.0/go.mod h1:Ib+IWBYfEfJGI1ZyXMGNbu2BU+aa3Dzu41RKLH301v4=
375379
github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs=
376380
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
377381
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
378-
github.com/hashicorp/go-tfe v0.15.0 h1:vdnz1NjOhvmap+cj8iPsL8SbS4iFFVuNYFkGpF5SdoA=
379-
github.com/hashicorp/go-tfe v0.15.0/go.mod h1:c8glB5p6XzocEWLNkuy5RxcjqN5X2PpY6NF3f2W6nIo=
382+
github.com/hashicorp/go-tfe v0.19.1-0.20211020175229-e52963e079d0 h1:64o1fy8p4a9J/5Gooy1S9iuEJQqXTVGYk5ZrXwFDZ8w=
383+
github.com/hashicorp/go-tfe v0.19.1-0.20211020175229-e52963e079d0/go.mod h1:gyXLXbpBVxA2F/6opah8XBsOkZJxHYQmghl0OWi8keI=
380384
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
381-
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
382385
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
386+
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
387+
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
383388
github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
384389
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
385390
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
@@ -393,8 +398,8 @@ github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh
393398
github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90=
394399
github.com/hashicorp/hcl/v2 v2.10.1 h1:h4Xx4fsrRE26ohAk/1iGF/JBqRQbyUqu5Lvj60U54ys=
395400
github.com/hashicorp/hcl/v2 v2.10.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg=
396-
github.com/hashicorp/jsonapi v0.0.0-20210518035559-1e50d74c8db3 h1:mzwkutymYIXR5oQT9YnfbLuuw7LZmksiHKRPUTN5ijo=
397-
github.com/hashicorp/jsonapi v0.0.0-20210518035559-1e50d74c8db3/go.mod h1:Yog5+CPEM3c99L1CL2CFCYoSzgWm5vTU58idbRUaLik=
401+
github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d h1:9ARUJJ1VVynB176G1HCwleORqCaXm/Vx0uUi0dL26I0=
402+
github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d/go.mod h1:Yog5+CPEM3c99L1CL2CFCYoSzgWm5vTU58idbRUaLik=
398403
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
399404
github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY=
400405
github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g=
@@ -452,6 +457,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB
452457
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
453458
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
454459
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
460+
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
455461
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
456462
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
457463
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
@@ -610,8 +616,9 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
610616
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
611617
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
612618
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
613-
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
614619
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
620+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
621+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
615622
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
616623
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.232 h1:kwsWbh4rEw42ZDe9/812ebhbwNZxlQyZ2sTmxBOKhN4=
617624
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.232/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
@@ -932,6 +939,7 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f
932939
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
933940
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
934941
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
942+
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
935943
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
936944
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
937945
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=

‎internal/backend/init/init.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
backendPg "github.com/hashicorp/terraform/internal/backend/remote-state/pg"
2828
backendS3 "github.com/hashicorp/terraform/internal/backend/remote-state/s3"
2929
backendSwift "github.com/hashicorp/terraform/internal/backend/remote-state/swift"
30+
backendCloud "github.com/hashicorp/terraform/internal/cloud"
3031
)
3132

3233
// backends is the list of available backends. This is a global variable
@@ -49,7 +50,6 @@ func Init(services *disco.Disco) {
4950
defer backendsLock.Unlock()
5051

5152
backends = map[string]backend.InitFn{
52-
// Enhanced backends.
5353
"local": func() backend.Backend { return backendLocal.New() },
5454
"remote": func() backend.Backend { return backendRemote.New(services) },
5555

@@ -70,6 +70,10 @@ func Init(services *disco.Disco) {
7070
"s3": func() backend.Backend { return backendS3.New() },
7171
"swift": func() backend.Backend { return backendSwift.New() },
7272

73+
// Terraform Cloud 'backend'
74+
// This is an implementation detail only, used for the cloud package
75+
"cloud": func() backend.Backend { return backendCloud.New(services) },
76+
7377
// Deprecated backends.
7478
"azure": func() backend.Backend {
7579
return deprecateBackend(

‎internal/backend/remote/backend_apply_test.go‎

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
version "github.com/hashicorp/go-version"
1515
"github.com/hashicorp/terraform/internal/addrs"
1616
"github.com/hashicorp/terraform/internal/backend"
17+
"github.com/hashicorp/terraform/internal/cloud"
1718
"github.com/hashicorp/terraform/internal/command/arguments"
1819
"github.com/hashicorp/terraform/internal/command/clistate"
1920
"github.com/hashicorp/terraform/internal/command/views"
@@ -308,11 +309,11 @@ func TestRemote_applyWithoutRefresh(t *testing.T) {
308309

309310
// We should find a run inside the mock client that has refresh set
310311
// to false.
311-
runsAPI := b.client.Runs.(*mockRuns)
312-
if got, want := len(runsAPI.runs), 1; got != want {
312+
runsAPI := b.client.Runs.(*cloud.MockRuns)
313+
if got, want := len(runsAPI.Runs), 1; got != want {
313314
t.Fatalf("wrong number of runs in the mock client %d; want %d", got, want)
314315
}
315-
for _, run := range runsAPI.runs {
316+
for _, run := range runsAPI.Runs {
316317
if diff := cmp.Diff(false, run.Refresh); diff != "" {
317318
t.Errorf("wrong Refresh setting in the created run\n%s", diff)
318319
}
@@ -377,11 +378,11 @@ func TestRemote_applyWithRefreshOnly(t *testing.T) {
377378

378379
// We should find a run inside the mock client that has refresh-only set
379380
// to true.
380-
runsAPI := b.client.Runs.(*mockRuns)
381-
if got, want := len(runsAPI.runs), 1; got != want {
381+
runsAPI := b.client.Runs.(*cloud.MockRuns)
382+
if got, want := len(runsAPI.Runs), 1; got != want {
382383
t.Fatalf("wrong number of runs in the mock client %d; want %d", got, want)
383384
}
384-
for _, run := range runsAPI.runs {
385+
for _, run := range runsAPI.Runs {
385386
if diff := cmp.Diff(true, run.RefreshOnly); diff != "" {
386387
t.Errorf("wrong RefreshOnly setting in the created run\n%s", diff)
387388
}
@@ -448,11 +449,11 @@ func TestRemote_applyWithTarget(t *testing.T) {
448449

449450
// We should find a run inside the mock client that has the same
450451
// target address we requested above.
451-
runsAPI := b.client.Runs.(*mockRuns)
452-
if got, want := len(runsAPI.runs), 1; got != want {
452+
runsAPI := b.client.Runs.(*cloud.MockRuns)
453+
if got, want := len(runsAPI.Runs), 1; got != want {
453454
t.Fatalf("wrong number of runs in the mock client %d; want %d", got, want)
454455
}
455-
for _, run := range runsAPI.runs {
456+
for _, run := range runsAPI.Runs {
456457
if diff := cmp.Diff([]string{"null_resource.foo"}, run.TargetAddrs); diff != "" {
457458
t.Errorf("wrong TargetAddrs in the created run\n%s", diff)
458459
}
@@ -523,11 +524,11 @@ func TestRemote_applyWithReplace(t *testing.T) {
523524

524525
// We should find a run inside the mock client that has the same
525526
// refresh address we requested above.
526-
runsAPI := b.client.Runs.(*mockRuns)
527-
if got, want := len(runsAPI.runs), 1; got != want {
527+
runsAPI := b.client.Runs.(*cloud.MockRuns)
528+
if got, want := len(runsAPI.Runs), 1; got != want {
528529
t.Fatalf("wrong number of runs in the mock client %d; want %d", got, want)
529530
}
530-
for _, run := range runsAPI.runs {
531+
for _, run := range runsAPI.Runs {
531532
if diff := cmp.Diff([]string{"null_resource.foo"}, run.ReplaceAddrs); diff != "" {
532533
t.Errorf("wrong ReplaceAddrs in the created run\n%s", diff)
533534
}
@@ -776,9 +777,7 @@ func TestRemote_applyApprovedExternally(t *testing.T) {
776777
wl, err := b.client.Workspaces.List(
777778
ctx,
778779
b.organization,
779-
tfe.WorkspaceListOptions{
780-
ListOptions: tfe.ListOptions{PageNumber: 2, PageSize: 10},
781-
},
780+
tfe.WorkspaceListOptions{},
782781
)
783782
if err != nil {
784783
t.Fatalf("unexpected error listing workspaces: %v", err)
@@ -852,9 +851,7 @@ func TestRemote_applyDiscardedExternally(t *testing.T) {
852851
wl, err := b.client.Workspaces.List(
853852
ctx,
854853
b.organization,
855-
tfe.WorkspaceListOptions{
856-
ListOptions: tfe.ListOptions{PageNumber: 2, PageSize: 10},
857-
},
854+
tfe.WorkspaceListOptions{},
858855
)
859856
if err != nil {
860857
t.Fatalf("unexpected error listing workspaces: %v", err)

0 commit comments

Comments
 (0)