Update to use latest SDK (#18)

* chore: update provider.go to latest SDK

* chore: update resource_group.go to latest SDK

* chore: update resource_host_catalog.go to latest SDK

* chore: update resource_project.go to latest SDK

* chore: update resource_role.go to latest SDK

* chore: fix group resource to use project client

* chore: update resource_users.go to latest SDK

* chore: update resource_group_test.go to latest SDK

* chore: refactor resource_host_catalog_test.go to latest sdk

* chore: refactor resource_project_test.go to latest sdk

* chore: refactor resource_user_test.go to latest sdk

* chore: update to latest SDK usage

* update to use latest test controller

* feat: make project_id optional and override scope if set

* test: test org and project level group creation

* chore: pass around authToken info for using principal ID in setting grant scope

* build: update deps
This commit is contained in:
Jeff Malnick authored and GitHub committed 2020-08-13 11:18:36 -07:00
1 parent c89a39c067
commit 0bcb0ed506
14 files changed
+759 -416

No files matched your search

+11 -5
View File
@@ -6,8 +6,10 @@ require (
cloud.google.com/go v0.63.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/aws/aws-sdk-go v1.34.2 // indirect
github.com/hashicorp/boundary v0.0.0-20200813015744-f1d69ea1eeb9
github.com/aws/aws-sdk-go v1.34.3 // indirect
github.com/corbym/gocrest v1.0.3 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.14.6 // indirect
github.com/hashicorp/boundary v0.0.0-20200813180015-7ac4be51c026
github.com/hashicorp/go-getter v1.4.1 // indirect
github.com/hashicorp/go-plugin v1.3.0 // indirect
github.com/hashicorp/go-retryablehttp v0.6.7 // indirect
@@ -25,7 +27,11 @@ require (
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/zclconf/go-cty v1.5.1 // indirect
github.com/zclconf/go-cty-yaml v1.0.2 // indirect
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed // indirect
golang.org/x/tools v0.0.0-20200811215021-48a8ffc5b207 // indirect
google.golang.org/genproto v0.0.0-20200808173500-a06252235341 // indirect
go.opencensus.io v0.22.4 // indirect
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc // indirect
golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d // indirect
golang.org/x/text v0.3.3 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
golang.org/x/tools v0.0.0-20200813181007-d926bd178cf0 // indirect
google.golang.org/genproto v0.0.0-20200813001606-1ccf2a5ae4fd // indirect
)
+164 -10
View File
@@ -93,7 +93,11 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/ClickHouse/clickhouse-go v1.3.12/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU=
@@ -111,7 +115,10 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
@@ -156,8 +163,8 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
github.com/armon/go-metrics v0.3.0/go.mod h1:zXjbSimjXTd7vOpY8B0/2LpvNvDoXBuplAD+gJD3GYs=
github.com/armon/go-metrics v0.3.3 h1:a9F4rlj7EWWrbj7BYw8J8+x+ZZkJeqzNyRk8hdPF+ro=
github.com/armon/go-metrics v0.3.3/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-metrics v0.3.4 h1:Xqf+7f2Vhl9tsqDYmXhnXInUdcrtgpRNpIA15/uldSc=
github.com/armon/go-metrics v0.3.4/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-proxyproto v0.0.0-20190211145416-68259f75880e/go.mod h1:QmP9hvJ91BbJmGVGSbutW19IC0Q9phDCLGaomwTJbgU=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
@@ -177,6 +184,8 @@ github.com/aws/aws-sdk-go v1.30.27 h1:9gPjZWVDSoQrBO2AvqrWObS6KAZByfEJxQoCYo4ZfK
github.com/aws/aws-sdk-go v1.30.27/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.34.2 h1:9vCknCdTAmmV4ht7lPuda7aJXzllXwEQyCMZKJHjBrM=
github.com/aws/aws-sdk-go v1.34.2/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.34.3 h1:pkbLkV9Q/KY86rbV/WG+yzjNektJbjNRdsTNGtNDZcY=
github.com/aws/aws-sdk-go v1.34.3/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
@@ -219,6 +228,7 @@ github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMe
github.com/cockroachdb/cockroach-go v0.0.0-20190925194419-606b3d062051/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko=
github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw=
github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=
@@ -245,8 +255,10 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
@@ -286,6 +298,8 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elazarl/go-bindata-assetfs v1.0.1-0.20200509193318-234c15e7648f/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/elazarl/goproxy v0.0.0-20170405201442-c4fc26588b6e/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -303,7 +317,9 @@ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga
github.com/favadi/protoc-go-inject-tag v1.1.0/go.mod h1:13goAxKedbu5IbfI0n2wIKh1CCgZOwPNZQd0igDWvko=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/frankban/quicktest v1.10.0 h1:Gfh+GAJZOAoKZsIZeZbdn2JF10kN1XHNvjsvQK8gVkE=
github.com/frankban/quicktest v1.4.0/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ=
github.com/frankban/quicktest v1.4.1 h1:Wv2VwvNn73pAdFIVUQRXYDFp31lXKbqblIXo/Q5GPSg=
github.com/frankban/quicktest v1.4.1/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ=
github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
@@ -327,6 +343,9 @@ github.com/go-ldap/ldap/v3 v3.1.10/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9p
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI=
github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
@@ -433,6 +452,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
github.com/golang-migrate/migrate/v4 v4.11.0 h1:uqtd0ysK5WyBQ/T1K2uDIooJV0o2Obt6uPwP062DupQ=
github.com/golang-migrate/migrate/v4 v4.11.0/go.mod h1:nqbpDbckcYjsCD5I8q5+NI9Tkk7SVcmaF40Ax1eAWhg=
github.com/golang-migrate/migrate/v4 v4.12.2 h1:QI43Tlouiwpp2dK5Y767OouX0snJNRP/NubsVaArzDU=
github.com/golang-migrate/migrate/v4 v4.12.2/go.mod h1:HQ1DaC8uLHkg4afY8ZQ8D/P5SG+YW9X5INZBVvm+d2k=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
@@ -536,15 +557,30 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.14.5 h1:aiLxiiVzAXb7wb3lAmubA69IokWOoUNe+E7TdGKh8yw=
github.com/grpc-ecosystem/grpc-gateway v1.14.5/go.mod h1:UJ0EZAp832vCd54Wev9N1BMKEyvcZ5+IM0AwDrnlkEc=
github.com/grpc-ecosystem/grpc-gateway v1.14.6 h1:8ERzHx8aj1Sc47mu9n/AksaKCSWrMchFtkdrS4BIj5o=
github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.0.0-beta.3 h1:VwE1I7k5WTM4e1XxrbjEcraydH0r0YANCkIdBak58y4=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.0.0-beta.3/go.mod h1:Nhd2bO7zTYI3aNQDhaYPeydn78AIRtcAa2NabL5nRjU=
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
github.com/hashicorp/boundary v0.0.0-20200813015744-f1d69ea1eeb9 h1:vZho04YM4O8Wj61/v73I8ucvk64jeVrOkuDehqWNLrg=
github.com/hashicorp/boundary v0.0.0-20200813015744-f1d69ea1eeb9/go.mod h1:NAJ0S5yTsnBjZmHwju9Bfi8AlhqFDLL1lEgw0AYwTy0=
github.com/hashicorp/boundary v0.0.0-20200811212500-4cfab0430733 h1:ggLC4NzAsPGlIj/MTUG4Uvi9VQWMOQIPxJ7JmgcWszs=
github.com/hashicorp/boundary v0.0.0-20200811212500-4cfab0430733/go.mod h1:8yA/eQFUtqTeK2g3XT0Tq49cixWE9/hQOej/lgDwmwY=
github.com/hashicorp/boundary v0.0.0-20200812152719-012967e91b99 h1:gv1LUuj0aUsZuWxWQhqEw0OWJttksrnckAN/4RncukQ=
github.com/hashicorp/boundary v0.0.0-20200812152719-012967e91b99/go.mod h1:8g7VFkhWUIiXYlL50RDdCLBzWfeIEwSDu7+k/k9g38Y=
github.com/hashicorp/boundary v0.0.0-20200813180015-7ac4be51c026 h1:XW4AWxDmcrNzjUst6+4HW4sJ73pDcBZOgGH1ytcTYCU=
github.com/hashicorp/boundary v0.0.0-20200813180015-7ac4be51c026/go.mod h1:NAJ0S5yTsnBjZmHwju9Bfi8AlhqFDLL1lEgw0AYwTy0=
github.com/hashicorp/consul-template v0.22.0/go.mod h1:lHrykBIcPobCuEcIMLJryKxDyk2lUMnQWmffOEONH0k=
github.com/hashicorp/consul-template v0.25.0/go.mod h1:/vUsrJvDuuQHcxEw0zik+YXTS7ZKWZjQeaQhshBmfH0=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/api v1.2.1-0.20200128105449-6681be918a6e/go.mod h1:ztzLK20HA5O27oTf2j/wbNgq8qj/crN8xsSx7pzX0sc=
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.2.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM=
github.com/hashicorp/dbassert v0.0.0-20200602132714-30dfb78f0133/go.mod h1:+B5eZq7vXqN4Gxkgjm4ub1bwG6OTcYzFL0r+bMvWorg=
github.com/hashicorp/dbassert v0.0.0-20200602142727-a6709b436ad6 h1:Nejn3Kli0VXWf26vr9XQEGDjw5CELP8rxOwbG4ruFa8=
github.com/hashicorp/dbassert v0.0.0-20200602142727-a6709b436ad6/go.mod h1:+B5eZq7vXqN4Gxkgjm4ub1bwG6OTcYzFL0r+bMvWorg=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
@@ -572,6 +608,10 @@ github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.1.0 h1:vN9wG1D6KG6YHRTWr8512cxGOVgTMEfgEdSj/hr8MPc=
github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-kms-wrapping v0.5.9 h1:XVl5Ip7LDWBBY0szU9O9d8Ev1+UH/BCWI0swJ2JqU/w=
github.com/hashicorp/go-kms-wrapping v0.5.9/go.mod h1:yVIWtGOTh/cdGc++/NOlXLus0hJ19Lz4iFrpF6WsZh4=
github.com/hashicorp/go-kms-wrapping v0.5.10 h1:n6a1ggDgoP75SoJ3OzVnTBzB0H5fJ5XX1rvuZIBWVaM=
github.com/hashicorp/go-kms-wrapping v0.5.10/go.mod h1:yVIWtGOTh/cdGc++/NOlXLus0hJ19Lz4iFrpF6WsZh4=
github.com/hashicorp/go-kms-wrapping v0.5.12 h1:4zZCaLqOob5moaAmpS6ZtGZYm4yOcqvmt2lO+zNXHls=
github.com/hashicorp/go-kms-wrapping v0.5.12/go.mod h1:yVIWtGOTh/cdGc++/NOlXLus0hJ19Lz4iFrpF6WsZh4=
github.com/hashicorp/go-kms-wrapping/entropy v0.1.0/go.mod h1:d1g9WGtAunDNpek8jUIEJnBlbgKS1N2Q61QkHiZyR1g=
@@ -631,7 +671,7 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hashicorp/shared-secure-libs v0.0.2 h1:+izKlB8vxpBK+K6zNmB4DZtDEl1a7fB8JmqdBNhnhjs=
github.com/hashicorp/serf v0.8.3/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k=
github.com/hashicorp/shared-secure-libs v0.0.2/go.mod h1:xhtA0FH6AYYFOy0sir7u0O0zzdLi7ofU6oWxy+gjnuc=
github.com/hashicorp/terraform-config-inspect v0.0.0-20191115094559-17f92b0546e8 h1:+RyjwU+Gnd/aTJBPZVDNm903eXVjjqhbaR4Ypx3xYyY=
github.com/hashicorp/terraform-config-inspect v0.0.0-20191115094559-17f92b0546e8/go.mod h1:p+ivJws3dpqbp1iP84+npOyAmTTOLMgCzrXd3GSdn/A=
@@ -647,6 +687,50 @@ github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 h1:hjy
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
github.com/hashicorp/vault v1.2.1-0.20200519221912-a8c2591d3641 h1:sFzGh4bThye9dcV3XhO6xOtWlhXY73cgfod/B3eqdf0=
github.com/hashicorp/vault v1.2.1-0.20200519221912-a8c2591d3641/go.mod h1:AxZRQLEuX4UQt4GIITGJE/s/dpQJjwQnPfufvchqxFM=
github.com/hashicorp/vault v1.2.1-0.20200521015612-812a92b26b19 h1:UnyS8rJUziC7TLs/0blpiCpbnq3l3fwzkpZG+VLLUWI=
github.com/hashicorp/vault v1.2.1-0.20200521015612-812a92b26b19/go.mod h1:m42VsHQcRRfOQWFUF7eDOjYE18W+ZH2KgQzJezt7YKo=
github.com/hashicorp/vault v1.2.1-0.20200717203022-646babcf458c h1:jROPEF3fbeoBr7l0d4f/6FsIegvMg1kF++T+LFxR6Qs=
github.com/hashicorp/vault v1.2.1-0.20200717203022-646babcf458c/go.mod h1:WoMsvlANd2ANpNMCepzzPlZXd0cpONrtBUE0a5rVqOY=
github.com/hashicorp/vault-plugin-auth-alicloud v0.5.5/go.mod h1:sQ+VNwPQlemgXHXikYH6onfH9gPwDZ1GUVRLz0ZvHx8=
github.com/hashicorp/vault-plugin-auth-azure v0.5.5/go.mod h1:RCVBsf8AJndh4c6iGZtvVZFui9SG0Bj9fnF0SodNIkw=
github.com/hashicorp/vault-plugin-auth-azure v0.5.6/go.mod h1:xUpcusehlkR1cNbA+wNta9W4slS64pYe7CXx5UYM2OQ=
github.com/hashicorp/vault-plugin-auth-centrify v0.5.5/go.mod h1:GfRoy7NHsuR/ogmZtbExdJXUwbfwcxPrS9xzkyy2J/c=
github.com/hashicorp/vault-plugin-auth-cf v0.5.4/go.mod h1:idkFYHc6ske2BE7fe00SpH+SBIlqDKz8vk/IPLJuX2o=
github.com/hashicorp/vault-plugin-auth-gcp v0.5.1/go.mod h1:eLj92eX8MPI4vY1jaazVLF2sVbSAJ3LRHLRhF/pUmlI=
github.com/hashicorp/vault-plugin-auth-gcp v0.6.1/go.mod h1:8eBRzg+JIhAaDBfDndDAQKIhDrQ3WW8OPklxAYftNFs=
github.com/hashicorp/vault-plugin-auth-gcp v0.7.0/go.mod h1:sHDguHmyGScoalGLEjuxvDCrMPVlw2c3f+ieeiHcv6w=
github.com/hashicorp/vault-plugin-auth-jwt v0.6.2/go.mod h1:SFadxIfoLGzugEjwUUmUaCGbsYEz2/jJymZDDQjEqYg=
github.com/hashicorp/vault-plugin-auth-jwt v0.7.0/go.mod h1:ZJJy4b0H3N7CSoJ6iPlWhV9EjHLSoB5NhP06CNm6ImU=
github.com/hashicorp/vault-plugin-auth-kerberos v0.1.5/go.mod h1:r4UqWITHYKmBeAMKPWqLo4V8bl/wNqoSIaQcMpeK9ss=
github.com/hashicorp/vault-plugin-auth-kerberos v0.1.6/go.mod h1:IM/n7LY1rIM4MVzOfSH6cRmY/C2rGkrjGrEr0B/yO9c=
github.com/hashicorp/vault-plugin-auth-kubernetes v0.6.1/go.mod h1:/Y9W5aZULfPeNVRQK0/nrFGpHWyNm0J3UWhOdsAu0vM=
github.com/hashicorp/vault-plugin-auth-kubernetes v0.7.0/go.mod h1:2c/k3nsoGPKV+zpAWCiajt4e66vncEq8Li/eKLqErAc=
github.com/hashicorp/vault-plugin-auth-oci v0.5.4/go.mod h1:j05O2b9fw2Q82NxDPhHMYVfHKvitUYGWfmqmpBdqmmc=
github.com/hashicorp/vault-plugin-auth-oci v0.5.5/go.mod h1:Cn5cjR279Y+snw8LTaiLTko3KGrbigRbsQPOd2D5xDw=
github.com/hashicorp/vault-plugin-database-elasticsearch v0.5.4/go.mod h1:QjGrrxcRXv/4XkEZAlM0VMZEa3uxKAICFqDj27FP/48=
github.com/hashicorp/vault-plugin-database-mongodbatlas v0.1.1/go.mod h1:MP3kfr0N+7miOTZFwKv952b9VkXM4S2Q6YtQCiNKWq8=
github.com/hashicorp/vault-plugin-database-mongodbatlas v0.1.2/go.mod h1:HTXNzFr/SAVtJOs7jz0XxZ69jlKtaceEwp37l86UAQ0=
github.com/hashicorp/vault-plugin-secrets-ad v0.6.4-beta1.0.20200518124111-3dceeb3ce90e/go.mod h1:SCsKcChP8yrtOHXOeTD7oRk0oflj3IxA9y9zTOGtQ8s=
github.com/hashicorp/vault-plugin-secrets-ad v0.6.5/go.mod h1:kk98nB+cwDbt3I7UGQq3ota7+eHZrGSTQZfSRGpluvA=
github.com/hashicorp/vault-plugin-secrets-ad v0.6.6/go.mod h1:L5L6NoJFxRvgxhuA2sWhloc3sbgmE7KxhNcoRxcaH9U=
github.com/hashicorp/vault-plugin-secrets-alicloud v0.5.5/go.mod h1:gAoReoUpBHaBwkxQqTK7FY8nQC0MuaZHLiW5WOSny5g=
github.com/hashicorp/vault-plugin-secrets-azure v0.5.6/go.mod h1:Q0cIL4kZWnMmQWkBfWtyOd7+JXTEpAyU4L932PMHq3E=
github.com/hashicorp/vault-plugin-secrets-azure v0.6.1/go.mod h1:w5eMWJUQPNgxij3WpeJKGs+Ng2Mm7mD/IeCI1ZAgbfk=
github.com/hashicorp/vault-plugin-secrets-gcp v0.6.1/go.mod h1:jVTE1fuhRcBOb/gnCT9W++AnlwiyQEX4S8iVCKhKQsE=
github.com/hashicorp/vault-plugin-secrets-gcp v0.6.3/go.mod h1:psRQ/dm5XatoUKLDUeWrpP9icMJNtu/jmscUr37YGK4=
github.com/hashicorp/vault-plugin-secrets-gcpkms v0.5.5/go.mod h1:b6RwFD1bny1zbfqhD35iGJdQYHRtJLx3HfBD109GO38=
github.com/hashicorp/vault-plugin-secrets-gcpkms v0.5.6/go.mod h1:hhwps56f2ATeC4Smgghrc5JH9dXR31b4ehSf1HblP5Q=
github.com/hashicorp/vault-plugin-secrets-kv v0.5.5/go.mod h1:oNyUoMMQq6uNTwyYPnkldiedaknYbPfQIdKoyKQdy2g=
github.com/hashicorp/vault-plugin-secrets-kv v0.5.6/go.mod h1:B/Cybh5aVF7LNAMHwVBxY8t7r2eL0C6HVGgTyP4nKK4=
github.com/hashicorp/vault-plugin-secrets-mongodbatlas v0.1.2/go.mod h1:YRW9zn9NZNitRlPYNAWRp/YEdKCF/X8aOg8IYSxFT5Y=
github.com/hashicorp/vault-plugin-secrets-openldap v0.1.0-beta1.0.20200515114020-e19ec0ccabc3/go.mod h1:mfMeH+oOuVMgJVQahScA7ic+q8HfzHTocE3xJhmk4Co=
github.com/hashicorp/vault-plugin-secrets-openldap v0.1.4/go.mod h1:SeP/cV0AF4gxkPOvbsLyOIjNjbI6hsIs6fQb8IZldM4=
github.com/hashicorp/vault/api v1.0.1/go.mod h1:AV/+M5VPDpB90arloVX0rVDUIHkONiwz5Uza9HRtpUE=
github.com/hashicorp/vault/api v1.0.5-0.20190730042357-746c0b111519/go.mod h1:i9PKqwFko/s/aihU1uuHGh/FaQS+Xcgvd9dvnfAvQb0=
github.com/hashicorp/vault/api v1.0.5-0.20200215224050-f6547fa8e820/go.mod h1:3f12BMfgDGjTsTtIUj+ZKZwSobQpZtYGFIEehOv5z1o=
github.com/hashicorp/vault/api v1.0.5-0.20200317185738-82f498082f02/go.mod h1:3f12BMfgDGjTsTtIUj+ZKZwSobQpZtYGFIEehOv5z1o=
github.com/hashicorp/vault/api v1.0.5-0.20200514164214-89b1987e38c2 h1:lfjJouPlC/inHjTOqe48N/BiLshU2YZqkxkUbNPj4fU=
github.com/hashicorp/vault/api v1.0.5-0.20200514164214-89b1987e38c2/go.mod h1:P8A7gn1a6j/7qQ4zOaWI6FC/Q9jQWEBRTOwZH33tC9o=
github.com/hashicorp/vault/api v1.0.5-0.20200519221902-385fac77e20f h1:PYtnlUZzFSZxPcq7mYp5oC9N+BcJ8IKYf6/EG0GHM2Y=
@@ -659,8 +743,36 @@ github.com/hashicorp/vault/sdk v0.1.14-0.20200514164214-89b1987e38c2 h1:nFnSG20c
github.com/hashicorp/vault/sdk v0.1.14-0.20200514164214-89b1987e38c2/go.mod h1:WX57W2PwkrOPQ6rVQk+dy5/htHIaB4aBM70EwKThu10=
github.com/hashicorp/vault/sdk v0.1.14-0.20200519221530-14615acda45f/go.mod h1:WX57W2PwkrOPQ6rVQk+dy5/htHIaB4aBM70EwKThu10=
github.com/hashicorp/vault/sdk v0.1.14-0.20200519221838-e0cfd64bc267/go.mod h1:WX57W2PwkrOPQ6rVQk+dy5/htHIaB4aBM70EwKThu10=
github.com/hashicorp/vault/sdk v0.1.14-0.20200805123347-1ef507638af6 h1:8bzfSEdW5ztWR73O5ByXbOAx8V6lHL1qTH7PYDLRITI=
github.com/hashicorp/vault/sdk v0.1.14-0.20200519221912-a8c2591d3641 h1:9xAZq2ZUPFaDfNwMq4TFJ5LP6+Mtx8Sp0ZPhGOdF5Lk=
github.com/hashicorp/vault/sdk v0.1.14-0.20200519221912-a8c2591d3641/go.mod h1:WX57W2PwkrOPQ6rVQk+dy5/htHIaB4aBM70EwKThu10=
github.com/hashicorp/vault/sdk v0.1.14-0.20200527182800-ad90e0b39d2f/go.mod h1:B2Cbv/tzj8btUA5FF4SvYclTujJhlWU6siK4vo8tgXM=
github.com/hashicorp/vault/sdk v0.1.14-0.20200717191844-f687267c8086 h1:ghsgn2TvpQNvpQngqXoqfKmahdi8e4AHmxvMjOPyih4=
github.com/hashicorp/vault/sdk v0.1.14-0.20200717191844-f687267c8086/go.mod h1:/dxrWZeq4ThnQCgTqVibr1LpONG7AXU7RFFPsd8lqNs=
github.com/hashicorp/vault/sdk v0.1.14-0.20200805123347-1ef507638af6/go.mod h1:+S2qzS1Tex9JgbHxb/Jv7CdZyKydxqg09G/qVvyVmUc=
github.com/hashicorp/watchtower v0.0.0-20200521055752-236ff297b244 h1:UPz7iN1vdZHW9tPlIK4KXiPojQSeWdhREJ8OjLS5lcs=
github.com/hashicorp/watchtower v0.0.0-20200521055752-236ff297b244/go.mod h1:C7SdCixAYS6HEDs1vdvy/DFjGTScNQQ/lUbgqt6rPCg=
github.com/hashicorp/watchtower v0.0.0-20200526204621-44152ae63ead h1:oiRLv6gJegNclrkDJ0fBV14igEx3DLmJHoxVCiCDyQw=
github.com/hashicorp/watchtower v0.0.0-20200526204621-44152ae63ead/go.mod h1:2MX4EmOXUbH1IUKOw/0Ov+p0dqSLJcDnFXaU7nLrwuY=
github.com/hashicorp/watchtower v0.0.0-20200605200258-d374ac6d4cdc h1:SxZA348gv1yCLSvLEBVCxSF0cw2F1nchNf81cGGg5T0=
github.com/hashicorp/watchtower v0.0.0-20200605200258-d374ac6d4cdc/go.mod h1:sMFje9U/WYZKIiEzmcuJfWb8i7Uqh+y0ET0Fck2HZk4=
github.com/hashicorp/watchtower v0.0.0-20200609011200-5333482ff89f h1:wP70LU8w0LjK3Z/WNjf5uMZduvCTwZn+RFSR784rCu4=
github.com/hashicorp/watchtower v0.0.0-20200609011200-5333482ff89f/go.mod h1:sMFje9U/WYZKIiEzmcuJfWb8i7Uqh+y0ET0Fck2HZk4=
github.com/hashicorp/watchtower v0.0.0-20200622202726-0c8385b42359 h1:rDuxADQN0Mqqwm1moGQTWdjB+z929vmXH6KMcm43Voo=
github.com/hashicorp/watchtower v0.0.0-20200622202726-0c8385b42359/go.mod h1:dkyM9Wf1hgp6XEQJhPO03SQ93XJ78KjUYzRJfp+Essc=
github.com/hashicorp/watchtower v0.0.0-20200708212020-732c07126d09 h1:lgozYOFpXTKqGSvNG8wW3cxHHFi/RyEuj6B7c6REmrs=
github.com/hashicorp/watchtower v0.0.0-20200708212020-732c07126d09/go.mod h1:y22wYAss3hsYe/BtE0p7xSH1NeZQp8UKhpbTA8tVOl0=
github.com/hashicorp/watchtower v0.0.0-20200708220901-3d2677293aa1 h1:Q7ss1fVPAowQ1ZdjPlsFeykUmK0BCQCcKUIIXldlBFo=
github.com/hashicorp/watchtower v0.0.0-20200708220901-3d2677293aa1/go.mod h1:y22wYAss3hsYe/BtE0p7xSH1NeZQp8UKhpbTA8tVOl0=
github.com/hashicorp/watchtower v0.0.0-20200711160049-acce195dcb9b h1:LOdNdNjahdp6shYc0V/OOWO8Z31vwkcQTSiWWZ0NpPc=
github.com/hashicorp/watchtower v0.0.0-20200711160049-acce195dcb9b/go.mod h1:y22wYAss3hsYe/BtE0p7xSH1NeZQp8UKhpbTA8tVOl0=
github.com/hashicorp/watchtower v0.0.0-20200712191642-8210960f2118 h1:L0Ahw70N3ixb38rFlMsL1LkIws0xDEhcmbOkJ4MP7lY=
github.com/hashicorp/watchtower v0.0.0-20200712191642-8210960f2118/go.mod h1:QqWMjDaiUBRW9AafTTqb1HFXZEK4wCqOkeYMvlx1CaM=
github.com/hashicorp/watchtower v0.0.0-20200712212453-26d36ec7460c h1:ZlGmrFEcPWruehrI5Hl1IyTCv3jnvkxgbGtKrF4IAk0=
github.com/hashicorp/watchtower v0.0.0-20200712212453-26d36ec7460c/go.mod h1:QqWMjDaiUBRW9AafTTqb1HFXZEK4wCqOkeYMvlx1CaM=
github.com/hashicorp/watchtower v0.0.0-20200713025149-b46cdad3c52e h1:3SXFlSQm7d2EuL0tBCbnRoelKZN7cT3+BZJdwIJzIC8=
github.com/hashicorp/watchtower v0.0.0-20200713025149-b46cdad3c52e/go.mod h1:i9wJ1Q4eQ0ES4NWpc57eDfZBpKLlji2m1x4pJJtNb44=
github.com/hashicorp/watchtower v0.0.0-20200724221034-4fa8c5415bb5 h1:CeE14NAlvBh8eZu1cwf98JrL9rFYwUfIyY8BxxPvgPw=
github.com/hashicorp/watchtower v0.0.0-20200724221034-4fa8c5415bb5/go.mod h1:pCvcDbaKuYRCOGrGF2eE92T3OaMnUkcModOecy7CMQI=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
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=
@@ -673,6 +785,7 @@ github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmK
github.com/iancoleman/strcase v0.0.0-20180726023541-3605ed457bf7/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb v0.0.0-20190411212539-d24b7ba8c4c4/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
@@ -763,14 +876,15 @@ github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeY
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/joyent/triton-go v1.7.1-0.20200416154420-6801d15b779f/go.mod h1:KDSfL7qe5ZfQqvlDMkVjCztbmcpp/c8M77vhQP8ZPvk=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v0.0.0-20180701071628-ab8a2e0c74be/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=
@@ -822,12 +936,16 @@ github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.6.0 h1:I5DPxhYJChW9KYc66se+oKFFQX6VuQrKiprsX6ivRZc=
github.com/lib/pq v1.6.0/go.mod h1:4vXEAYvW1fRQ2/FhZ78H73A60MHw1geSm145z2mdY1g=
github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY=
github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.7.1/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg=
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lyft/protoc-gen-star v0.4.10/go.mod h1:mE8fbna26u7aEA2QCVvvfBU/ZrPgocG1206xAFPcs94=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
@@ -913,7 +1031,9 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA=
github.com/natefinch/atomic v0.0.0-20150920032501-a62ce929ffcc/go.mod h1:1rLVY/DWf3U6vSZgH16S7pymfrhK2lcUlXjgGglw/lY=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
@@ -921,10 +1041,15 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/neo4j-drivers/gobolt v1.7.4/go.mod h1:O9AUbip4Dgre+CD3p40dnMD4a4r52QBIfblg5k7CTbE=
github.com/neo4j/neo4j-go-driver v1.7.4/go.mod h1:aPO0vVr+WnhEJne+FgFjfsjzAnssPFLucHgGZ76Zb/U=
github.com/neo4j/neo4j-go-driver v1.8.1-0.20200803113522-b626aa943eba/go.mod h1:ncO5VaFWh0Nrt+4KT4mOZboaczBZcLuHrG+/sUeP8gI=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso=
github.com/nwaples/rardecode v1.0.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
@@ -959,17 +1084,21 @@ github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKw
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
github.com/oracle/oci-go-sdk v12.5.0+incompatible h1:pr08ECoaDKHWO9tnzJB1YqClEs7ZK1CFOez2DQocH14=
github.com/oracle/oci-go-sdk v12.5.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
github.com/ory/dockertest/v3 v3.6.0 h1:I6KNJ6izxGduLACQii2SP/g7GN0JM9Xfaik6aAVaw6Y=
github.com/ory/dockertest/v3 v3.6.0/go.mod h1:4ZOpj8qBUmh8fcBSVzkH2bws2s91JdGvHUqan4GHEuQ=
github.com/oxtoacart/bpool v0.0.0-20150712133111-4e1c5567d7c2/go.mod h1:L3UMQOThbttwfYRNFOWLLVXMhk5Lkio4GGOtw5UrxS0=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
@@ -977,8 +1106,12 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9
github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo=
github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs=
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4 v2.2.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4 v2.2.6+incompatible h1:6aCX4/YZ9v8q69hTyiR7dNLnTA3fgtKHVVW5BCd5Znw=
github.com/pierrec/lz4 v2.2.6+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4 v2.5.2+incompatible h1:WCjObylUIOlKy/+7Abdn34TLIkXiA4UWUMhxq9m9ZXI=
github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pires/go-proxyproto v0.1.3 h1:2XEuhsQluSNA5QIQkiUv8PfgZ51sNYIQkq/yFquiSQM=
@@ -990,6 +1123,7 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pkg/profile v1.4.0/go.mod h1:NWz/XGvpEW1FyYQ7fCx4dqYBLlfTcE+A9FLAkNKqjFE=
github.com/pkg/profile v1.5.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -1008,7 +1142,6 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.4.0 h1:YVIb/fVcOTMSqtqZWSKnHpSLBxu8DKgxq8z6RuBZwqI=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
@@ -1026,7 +1159,6 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2
github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.11.1 h1:0ZISXCMRuCZcxF77aT1BXY5m74mX2vrGYl1dSwBI0Jo=
github.com/prometheus/common v0.11.1/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
@@ -1036,7 +1168,6 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
@@ -1055,7 +1186,9 @@ github.com/ryanuber/columnize v2.1.0+incompatible h1:j1Wcmh8OrK4Q7GXY+V7SVSY8nUW
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
@@ -1140,6 +1273,7 @@ github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oW
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvcciqcxEHac4CYj89xI=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU=
@@ -1171,7 +1305,9 @@ github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxt
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
go.etcd.io/etcd v0.5.0-alpha.5.0.20200425165423-262c93980547/go.mod h1:YoUyTScD3Vcv2RBm3eGVOq7i1ULiz3OuXoQFWOirmAM=
go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.1.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
@@ -1201,6 +1337,7 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@@ -1320,6 +1457,8 @@ golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1397,6 +1536,8 @@ golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 h1:5/PjkGUjvEU5Gl6BxmvKRPpqo2uNMv4rcHBMwzk/st8=
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c h1:UIcGWL6/wpCfyGuJnRFJRurA+yj8RrW7Q6x2YMCXt6c=
@@ -1404,6 +1545,8 @@ golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed h1:WBkVNH1zd9jg/dK4HCM4lNANnmd12EHC9z+LmcCG4ns=
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d h1:QQrM/CCYEzTs91GZylDCQjGHudbPTxF/1fvXdVh5lMo=
golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -1486,6 +1629,8 @@ golang.org/x/tools v0.0.0-20200807210451-92211316783d h1:0SXIh1o35VoSHeXm4dE5uYl
golang.org/x/tools v0.0.0-20200807210451-92211316783d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200811215021-48a8ffc5b207 h1:8Kg+JssU1jBZs8GIrL5pl4nVyaqyyhdmHAR4D1zGErg=
golang.org/x/tools v0.0.0-20200811215021-48a8ffc5b207/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200813181007-d926bd178cf0 h1:KFeeZ1lg7PGYIr3m8fLUdHoZ0Aqo9sI4gqdsqrmVYkE=
golang.org/x/tools v0.0.0-20200813181007-d926bd178cf0/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -1537,6 +1682,7 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRn
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190513181449-d00d292a067c/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
@@ -1575,10 +1721,13 @@ google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98 h1:LCO0fg4kb6WwkXQ
google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200808173500-a06252235341 h1:Kceb+1TNS2X7Cj/A+IUTljNerF/4wOFjlFJ0RGHYKKE=
google.golang.org/genproto v0.0.0-20200808173500-a06252235341/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200813001606-1ccf2a5ae4fd h1:pCOIJgz7MD1XjLsF1K0X2xI97dR8sEXS34ZcYl7fcNE=
google.golang.org/genproto v0.0.0-20200813001606-1ccf2a5ae4fd/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
@@ -1632,6 +1781,9 @@ gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:a
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.54.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.55.0 h1:E8yzL5unfpW3M6fz/eB7Cb5MQAYSZ7GKo4Qth+N2sgQ=
gopkg.in/ini.v1 v1.55.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.57.0 h1:9unxIsFcTt4I55uWluz+UmL95q4kdJ0buvQ1ZIqVQww=
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
@@ -1641,6 +1793,8 @@ gopkg.in/jcmturner/gokrb5.v7 v7.5.0/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuv
gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/square/go-jose.v2 v2.4.1 h1:H0TmLt7/KmzlrDOpa1F+zr0Tk90PbJYBfsVUmRLrf9Y=
gopkg.in/square/go-jose.v2 v2.4.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w=
gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+26 -22
View File
@@ -4,20 +4,20 @@ import (
"context"
"errors"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/authmethods"
"github.com/hashicorp/boundary/api/authtokens"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/scopes"
)
func New() terraform.ResourceProvider {
p := &schema.Provider{
Schema: map[string]*schema.Schema{
"default_organization": {
"default_scope": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("BOUNDARY_DEFAULT_ORG", ""),
Description: "The Boundary organization scope to operate all actions in if not provided in the individual resources.",
Description: "The Boundary scope to operate all actions in if not provided in the individual resources. This is the scope at which the provider authenticates itself.",
},
"base_url": {
Type: schema.TypeString,
@@ -55,43 +55,42 @@ func New() terraform.ResourceProvider {
}
type metaData struct {
client *api.Client
ctx context.Context
client *api.Client
authToken *authtokens.AuthToken
ctx context.Context
}
func providerAuthenticate(d *schema.ResourceData, client *api.Client) error {
func providerAuthenticate(d *schema.ResourceData, client *api.Client) (*authtokens.AuthToken, error) {
authMethodID, ok := d.GetOk("auth_method_id")
if !ok {
return errors.New("auth method ID not set, please set auth_method_id on the provider")
return nil, errors.New("auth method ID not set, please set auth_method_id on the provider")
}
authMethodUser, ok := d.GetOk("auth_method_username")
if !ok {
return errors.New("auth method username not set, please set auth_method_username on the provider")
return nil, errors.New("auth method username not set, please set auth_method_username on the provider")
}
authMethodPass, ok := d.GetOk("auth_method_password")
if !ok {
return errors.New("auth method password not set, please set the auth_method_password on the provider")
return nil, errors.New("auth method password not set, please set the auth_method_password on the provider")
}
org := &scopes.Org{
Client: client,
}
am := authmethods.NewAuthMethodsClient(client)
ctx := context.Background()
// note: Authenticate() calls SetToken() under the hood to set the
// auth bearer on the client so we do not need to do anything with the
// returned token after this call, so we ignore it
_, apiErr, err := org.Authenticate(ctx, authMethodID.(string), authMethodUser.(string), authMethodPass.(string))
at, apiErr, err := am.Authenticate(ctx, authMethodID.(string), authMethodUser.(string), authMethodPass.(string))
if apiErr != nil {
return errors.New(apiErr.Message)
return at, errors.New(apiErr.Message)
}
if err != nil {
return err
return at, err
}
return nil
return at, nil
}
func providerConfigure(p *schema.Provider) schema.ConfigureFunc {
@@ -103,15 +102,20 @@ func providerConfigure(p *schema.Provider) schema.ConfigureFunc {
if err := client.SetAddr(d.Get("base_url").(string)); err != nil {
return nil, err
}
client.SetOrg(d.Get("default_organization").(string))
client.SetScopeId(d.Get("default_organization").(string))
// TODO: Pass these in through the config, add token, etc...
client.SetLimiter(5, 5)
if err := providerAuthenticate(d, client); err != nil {
at, err := providerAuthenticate(d, client)
if err != nil {
return nil, err
}
return &metaData{client: client, ctx: p.StopContext()}, nil
// need to use 'at' in the provider config to get the principal ID for use
// in overriding grant scope for project level configuration
return &metaData{
client: client,
authToken: at,
ctx: p.StopContext()}, nil
}
}
+38 -5
View File
@@ -1,10 +1,14 @@
package provider
import (
"context"
"fmt"
"strings"
"testing"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/roles"
"github.com/hashicorp/boundary/testing/controller"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)
@@ -12,6 +16,24 @@ import (
var testProvider *schema.Provider
var testProviders map[string]terraform.ResourceProvider
var fooProject = `
resource "boundary_project" "foo" {
name = "test"
}`
var (
tcUsername = "user"
tcPassword = "passpass"
tcPAUM = "paum_0000000000"
tcOrg = "o_0000000000"
tcConfig = []controller.Option{
controller.WithDefaultOrgId(tcOrg),
controller.WithDefaultAuthMethodId(tcPAUM),
controller.WithDefaultLoginName(tcUsername),
controller.WithDefaultPassword(tcPassword),
}
)
func init() {
testProvider = New().(*schema.Provider)
testProviders = map[string]terraform.ResourceProvider{
@@ -23,17 +45,28 @@ func testConfig(url string, res ...string) string {
provider := fmt.Sprintf(`
provider "boundary" {
base_url = "%s"
default_organization = "o_0000000000"
auth_method_id = "am_1234567890"
auth_method_username = "foo"
auth_method_password = "bar"
}`, url)
default_organization = "%s"
auth_method_id = "%s"
auth_method_username = "%s"
auth_method_password = "%s"
}`, url, tcOrg, tcPAUM, tcUsername, tcPassword)
c := []string{provider}
c = append(c, res...)
return strings.Join(c, "\n")
}
func setGrantScopeIDonProject(projID string, principalID string, client *api.Client) error {
roleClient := roles.NewRolesClient(client)
_, err, _ := roleClient.Create(
context.Background(),
roles.WithName(fmt.Sprintf("TestRole_%s", projID)),
roles.WithDescription(fmt.Sprintf("Terraform test management role for %s", projID)),
roles.WithGrantScopeId(projID))
return err
}
func TestProvider(t *testing.T) {
if err := New().(*schema.Provider).InternalValidate(); err != nil {
t.Fatalf("err: %s", err)
+66 -42
View File
@@ -3,14 +3,15 @@ package provider
import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/boundary/api/groups"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
const (
groupNameKey = "name"
groupDescriptionKey = "description"
groupProjectIDKey = "project_id"
)
func resourceGroup() *schema.Resource {
@@ -28,47 +29,58 @@ func resourceGroup() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
groupProjectIDKey: {
Type: schema.TypeString,
Optional: true,
},
},
}
}
// convertGroupToResourceData creates a ResourceData type from a Group
func convertGroupToResourceData(u *groups.Group, d *schema.ResourceData) error {
if u.Name != nil {
if err := d.Set(groupNameKey, u.Name); err != nil {
func convertGroupToResourceData(g *groups.Group, d *schema.ResourceData) error {
if g.Name != "" {
if err := d.Set(groupNameKey, g.Name); err != nil {
return err
}
}
if u.Description != nil {
if err := d.Set(groupDescriptionKey, u.Description); err != nil {
if g.Description != "" {
if err := d.Set(groupDescriptionKey, g.Description); err != nil {
return err
}
}
d.SetId(u.Id)
if g.Scope.Id != "" {
if err := d.Set(groupProjectIDKey, g.Scope.Id); err != nil {
return err
}
}
d.SetId(g.Id)
return nil
}
// convertResourceDataToGroup returns a localy built Group using the values provided in the ResourceData.
func convertResourceDataToGroup(d *schema.ResourceData) *groups.Group {
u := &groups.Group{}
g := &groups.Group{Scope: &scopes.ScopeInfo{}}
if descVal, ok := d.GetOk(groupDescriptionKey); ok {
desc := descVal.(string)
u.Description = &desc
g.Description = descVal.(string)
}
if nameVal, ok := d.GetOk(groupNameKey); ok {
name := nameVal.(string)
u.Name = &name
g.Name = nameVal.(string)
}
if projIDVal, ok := d.GetOk(groupProjectIDKey); ok {
g.Scope.Id = projIDVal.(string)
}
if d.Id() != "" {
u.Id = d.Id()
g.Id = d.Id()
}
return u
return g
}
func resourceGroupCreate(d *schema.ResourceData, meta interface{}) error {
@@ -76,21 +88,23 @@ func resourceGroupCreate(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
g := convertResourceDataToGroup(d)
projClient := client.Clone()
if g.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", g.Name, g.Scope.Id)
projClient.SetScopeId(g.Scope.Id)
}
grps := groups.NewGroupsClient(projClient)
u := convertResourceDataToGroup(d)
u, apiErr, err := o.CreateGroup(ctx, u)
g, apiErr, err := grps.Create(ctx, groups.WithName(g.Name), groups.WithDescription(g.Description))
if err != nil {
return fmt.Errorf("error calling new group: %s", err.Error())
return fmt.Errorf("error creating group: %s", err.Error())
}
if apiErr != nil {
return fmt.Errorf("error creating group: %s", apiErr.Message)
}
d.SetId(u.Id)
d.SetId(g.Id)
return nil
}
@@ -100,13 +114,15 @@ func resourceGroupRead(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
g := convertResourceDataToGroup(d)
projClient := client.Clone()
if g.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", g.Name, g.Scope.Id)
projClient.SetScopeId(g.Scope.Id)
}
grps := groups.NewGroupsClient(projClient)
u := convertResourceDataToGroup(d)
u, apiErr, err := o.ReadGroup(ctx, u)
g, apiErr, err := grps.Read(ctx, g.Id)
if err != nil {
return fmt.Errorf("error reading group: %s", err.Error())
}
@@ -114,7 +130,7 @@ func resourceGroupRead(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("error reading group: %s", apiErr.Message)
}
return convertGroupToResourceData(u, d)
return convertGroupToResourceData(g, d)
}
func resourceGroupUpdate(d *schema.ResourceData, meta interface{}) error {
@@ -122,23 +138,29 @@ func resourceGroupUpdate(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
g := convertResourceDataToGroup(d)
projClient := client.Clone()
if g.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", g.Name, g.Scope.Id)
projClient.SetScopeId(g.Scope.Id)
}
u := convertResourceDataToGroup(d)
grps := groups.NewGroupsClient(projClient)
if d.HasChange(groupNameKey) {
n := d.Get(groupNameKey).(string)
u.Name = &n
g.Name = d.Get(groupNameKey).(string)
}
if d.HasChange(groupDescriptionKey) {
d := d.Get(groupDescriptionKey).(string)
u.Description = &d
g.Description = d.Get(groupDescriptionKey).(string)
}
u, apiErr, err := o.UpdateGroup(ctx, u)
g, apiErr, err := grps.Update(
ctx,
g.Id,
0,
groups.WithAutomaticVersioning(),
groups.WithName(g.Name),
groups.WithDescription(g.Description))
if err != nil {
return err
}
@@ -146,7 +168,7 @@ func resourceGroupUpdate(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("error updating group: %s\n Invalid request fields: %v\n", apiErr.Message, apiErr.Details.RequestFields)
}
return convertGroupToResourceData(u, d)
return convertGroupToResourceData(g, d)
}
func resourceGroupDelete(d *schema.ResourceData, meta interface{}) error {
@@ -154,13 +176,15 @@ func resourceGroupDelete(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
g := convertResourceDataToGroup(d)
projClient := client.Clone()
if g.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", g.Name, g.Scope.Id)
projClient.SetScopeId(g.Scope.Id)
}
grps := groups.NewGroupsClient(projClient)
u := convertResourceDataToGroup(d)
_, apiErr, err := o.DeleteGroup(ctx, u)
_, apiErr, err := grps.Delete(ctx, g.Id)
if err != nil {
return fmt.Errorf("error deleting group: %s", err.Error())
}
+69 -31
View File
@@ -7,11 +7,10 @@ import (
"strings"
"testing"
"github.com/hashicorp/boundary/api/groups"
"github.com/hashicorp/boundary/testing/controller"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/boundary/api/groups"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/testing/controller"
)
const (
@@ -20,21 +19,36 @@ const (
)
var (
fooGroup = fmt.Sprintf(`
orgGroup = fmt.Sprintf(`
resource "boundary_group" "foo" {
name = "test"
description = "%s"
}`, fooGroupDescription)
fooGroupUpdate = fmt.Sprintf(`
orgGroupUpdate = fmt.Sprintf(`
resource "boundary_group" "foo" {
name = "test"
description = "%s"
}`, fooGroupDescriptionUpdate)
projGroup = fmt.Sprintf(`
resource "boundary_group" "foo" {
name = "test"
description = "%s"
project_id = boundary_project.foo.id
}`, fooGroupDescription)
projGroupUpdate = fmt.Sprintf(`
resource "boundary_group" "foo" {
name = "test"
description = "%s"
project_id = boundary_project.foo.id
}`, fooGroupDescriptionUpdate)
)
func TestAccGroup(t *testing.T) {
tc := controller.NewTestController(t, controller.WithDefaultOrgId("o_0000000000"))
tc := controller.NewTestController(t, tcConfig...)
defer tc.Shutdown()
url := tc.ApiAddrs()[0]
@@ -44,7 +58,7 @@ func TestAccGroup(t *testing.T) {
Steps: []resource.TestStep{
{
// test create
Config: testConfig(url, fooGroup),
Config: testConfig(url, fooProject, projGroup),
Check: resource.ComposeTestCheckFunc(
testAccCheckGroupResourceExists("boundary_group.foo"),
resource.TestCheckResourceAttr("boundary_group.foo", groupDescriptionKey, fooGroupDescription),
@@ -53,7 +67,24 @@ func TestAccGroup(t *testing.T) {
},
{
// test update
Config: testConfig(url, fooGroupUpdate),
Config: testConfig(url, fooProject, projGroupUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckGroupResourceExists("boundary_group.foo"),
resource.TestCheckResourceAttr("boundary_group.foo", groupDescriptionKey, fooGroupDescriptionUpdate),
),
},
{
// test create
Config: testConfig(url, orgGroup),
Check: resource.ComposeTestCheckFunc(
testAccCheckGroupResourceExists("boundary_group.foo"),
resource.TestCheckResourceAttr("boundary_group.foo", groupDescriptionKey, fooGroupDescription),
resource.TestCheckResourceAttr("boundary_group.foo", groupNameKey, "test"),
),
},
{
// test update
Config: testConfig(url, orgGroupUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckGroupResourceExists("boundary_group.foo"),
resource.TestCheckResourceAttr("boundary_group.foo", groupDescriptionKey, fooGroupDescriptionUpdate),
@@ -92,20 +123,21 @@ func testAccCheckGroupDestroyed(name string) resource.TestCheckFunc {
errs := []string{}
errs = append(errs, fmt.Sprintf("Found group resource in state: %s", name))
id := rs.Primary.ID
if id == "" {
expectedGroupID := rs.Primary.ID
if expectedGroupID == "" {
return fmt.Errorf("No ID is set")
}
md := testProvider.Meta().(*metaData)
u := groups.Group{Id: id}
o := &scopes.Org{
Client: md.client,
projID, ok := rs.Primary.Attributes["project_id"]
projClient := md.client.Clone()
if ok {
projClient.SetScopeId(projID)
}
if _, apiErr, _ := o.ReadGroup(md.ctx, &u); apiErr == nil || apiErr.Status != http.StatusNotFound {
errs = append(errs, fmt.Sprintf("Group not destroyed %q: %v", id, apiErr))
grps := groups.NewGroupsClient(projClient)
if _, apiErr, _ := grps.Read(md.ctx, expectedGroupID); apiErr == nil || apiErr.Status != http.StatusNotFound {
errs = append(errs, fmt.Sprintf("Group not destroyed %q: %v", expectedGroupID, apiErr))
}
return errors.New(strings.Join(errs, ","))
@@ -125,13 +157,14 @@ func testAccCheckGroupResourceExists(name string) resource.TestCheckFunc {
}
md := testProvider.Meta().(*metaData)
u := groups.Group{Id: id}
o := &scopes.Org{
Client: md.client,
projClient := md.client.Clone()
projID, ok := rs.Primary.Attributes["project_id"]
if ok {
projClient.SetScopeId(projID)
}
if _, _, err := o.ReadGroup(md.ctx, &u); err != nil {
grps := groups.NewGroupsClient(projClient)
if _, _, err := grps.Read(md.ctx, id); err != nil {
return fmt.Errorf("Got an error when reading group %q: %v", id, err)
}
@@ -141,22 +174,27 @@ func testAccCheckGroupResourceExists(name string) resource.TestCheckFunc {
func testAccCheckGroupResourceDestroy(t *testing.T) resource.TestCheckFunc {
return func(s *terraform.State) error {
if testProvider.Meta() == nil {
t.Fatal("got nil provider metadata")
}
md := testProvider.Meta().(*metaData)
client := md.client
for _, rs := range s.RootModule().Resources {
switch rs.Type {
case "boundary_project":
continue
case "boundary_group":
projClient := md.client.Clone()
projID, ok := rs.Primary.Attributes["project_id"]
if ok {
projClient.SetScopeId(projID)
}
grps := groups.NewGroupsClient(projClient)
id := rs.Primary.ID
u := groups.Group{Id: id}
o := &scopes.Org{
Client: client,
}
_, apiErr, _ := o.ReadGroup(md.ctx, &u)
_, apiErr, _ := grps.Read(md.ctx, id)
if apiErr == nil || apiErr.Status != http.StatusNotFound {
return fmt.Errorf("Didn't get a 404 when reading destroyed group %q: %v", id, apiErr)
}
+33 -38
View File
@@ -4,9 +4,8 @@ import (
"errors"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/boundary/api/hosts"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
const (
@@ -63,19 +62,19 @@ func validateHostCatalogType(val interface{}, key string) (warns []string, errs
// convertHostCatalogToResourceData creates a ResourceData type from a HostCatalog
func convertHostCatalogToResourceData(projectID string, h *hosts.HostCatalog, d *schema.ResourceData) error {
if h.Name != nil {
if h.Name != "" {
if err := d.Set(hostCatalogNameKey, h.Name); err != nil {
return err
}
}
if h.Description != nil {
if h.Description != "" {
if err := d.Set(hostCatalogDescriptionKey, h.Description); err != nil {
return err
}
}
if h.Type != nil {
if h.Type != "" {
if err := d.Set(hostCatalogTypeKey, h.Type); err != nil {
return err
}
@@ -96,16 +95,13 @@ func convertHostCatalogToResourceData(projectID string, h *hosts.HostCatalog, d
func convertResourceDataToHostCatalog(d *schema.ResourceData) (string, *hosts.HostCatalog) {
h := &hosts.HostCatalog{}
if descVal, ok := d.GetOk(hostCatalogDescriptionKey); ok {
desc := descVal.(string)
h.Description = &desc
h.Description = descVal.(string)
}
if nameVal, ok := d.GetOk(hostCatalogNameKey); ok {
name := nameVal.(string)
h.Name = &name
h.Name = nameVal.(string)
}
if typeVal, ok := d.GetOk(hostCatalogTypeKey); ok {
t := typeVal.(string)
h.Type = &t
h.Type = typeVal.(string)
}
if d.Id() != "" {
h.Id = d.Id()
@@ -125,12 +121,11 @@ func resourceHostCatalogCreate(d *schema.ResourceData, meta interface{}) error {
ctx := md.ctx
projID, h := convertResourceDataToHostCatalog(d)
p := &scopes.Project{
Client: client,
Id: projID,
}
projClient := client.Clone()
projClient.SetScopeId(projID)
hcClient := hosts.NewHostCatalogsClient(projClient)
h, apiErr, err := p.CreateHostCatalog(ctx, h)
h, apiErr, err := hcClient.Create(ctx, hosts.WithName(h.Name), hosts.WithType(h.Type), hosts.WithDescription(h.Description))
if err != nil {
return fmt.Errorf("error calling new host catalog: %s", err.Error())
}
@@ -149,12 +144,11 @@ func resourceHostCatalogRead(d *schema.ResourceData, meta interface{}) error {
ctx := md.ctx
projID, h := convertResourceDataToHostCatalog(d)
p := &scopes.Project{
Client: client,
Id: projID,
}
projClient := client.Clone()
projClient.SetScopeId(projID)
hcClient := hosts.NewHostCatalogsClient(projClient)
h, apiErr, err := p.ReadHostCatalog(ctx, h)
h, apiErr, err := hcClient.Read(ctx, h.Id)
if err != nil {
return fmt.Errorf("error calling new host catalog: %s", err.Error())
}
@@ -171,24 +165,20 @@ func resourceHostCatalogUpdate(d *schema.ResourceData, meta interface{}) error {
ctx := md.ctx
projID, h := convertResourceDataToHostCatalog(d)
p := &scopes.Project{
Client: client,
Id: projID,
}
projClient := client.Clone()
projClient.SetScopeId(projID)
hcClient := hosts.NewHostCatalogsClient(projClient)
if d.HasChange(hostCatalogNameKey) {
n := d.Get(hostCatalogNameKey).(string)
h.Name = &n
h.Name = d.Get(hostCatalogNameKey).(string)
}
if d.HasChange(hostCatalogDescriptionKey) {
d := d.Get(hostCatalogDescriptionKey).(string)
h.Description = &d
h.Description = d.Get(hostCatalogDescriptionKey).(string)
}
if d.HasChange(hostCatalogProjectIDKey) {
id := d.Get(hostCatalogProjectIDKey).(string)
p.Id = id
projClient.SetScopeId(d.Get(hostCatalogProjectIDKey).(string))
}
if d.HasChange(hostCatalogTypeKey) {
@@ -197,8 +187,14 @@ func resourceHostCatalogUpdate(d *schema.ResourceData, meta interface{}) error {
// Type is a read-only value that can not be updated. It is added in the method to convert from a
// resource to a HostCatalog type, so it needs to be unset when calling update.
h.Type = nil
h, apiErr, err := p.UpdateHostCatalog(ctx, h)
h.Type = ""
h, apiErr, err := hcClient.Update(
ctx,
h.Id,
0,
hosts.WithAutomaticVersioning(),
hosts.WithName(h.Name),
hosts.WithDescription(h.Description))
if err != nil {
return err
}
@@ -215,12 +211,11 @@ func resourceHostCatalogDelete(d *schema.ResourceData, meta interface{}) error {
ctx := md.ctx
projID, h := convertResourceDataToHostCatalog(d)
p := &scopes.Project{
Client: client,
Id: projID,
}
projClient := client.Clone()
projClient.SetScopeId(projID)
hcClient := hosts.NewHostCatalogsClient(projClient)
_, apiErr, err := p.DeleteHostCatalog(ctx, h)
_, apiErr, err := hcClient.Delete(ctx, h.Id)
if err != nil {
return fmt.Errorf("error calling new host catalog: %s", err.Error())
}
+23 -24
View File
@@ -7,11 +7,10 @@ import (
"strings"
"testing"
"github.com/hashicorp/boundary/api/hosts"
"github.com/hashicorp/boundary/testing/controller"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/boundary/api/hosts"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/testing/controller"
"github.com/stretchr/testify/assert"
)
@@ -102,15 +101,15 @@ func testAccCheckHostCatalogDestroyed(name string) resource.TestCheckFunc {
}
md := testProvider.Meta().(*metaData)
h := hosts.HostCatalog{Id: id}
p := &scopes.Project{
Client: md.client,
Id: rs.Primary.Attributes["project_id"],
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
projClient := md.client.Clone()
projClient.SetScopeId(projID)
hcClient := hosts.NewHostCatalogsClient(projClient)
if _, apiErr, _ := p.ReadHostCatalog(md.ctx, &h); apiErr == nil || apiErr.Status != http.StatusNotFound {
if _, apiErr, _ := hcClient.Read(md.ctx, id); apiErr == nil || apiErr.Status != http.StatusNotFound {
errs = append(errs, fmt.Sprintf("Host catalog not destroyed %q: %v", id, apiErr))
}
@@ -131,15 +130,15 @@ func testAccCheckHostCatalogResourceExists(name string) resource.TestCheckFunc {
}
md := testProvider.Meta().(*metaData)
h := hosts.HostCatalog{Id: id}
p := &scopes.Project{
Client: md.client,
Id: rs.Primary.Attributes["project_id"],
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
projClient := md.client.Clone()
projClient.SetScopeId(projID)
hcClient := hosts.NewHostCatalogsClient(projClient)
if _, _, err := p.ReadHostCatalog(md.ctx, &h); err != nil {
if _, _, err := hcClient.Read(md.ctx, id); err != nil {
return fmt.Errorf("Got an error when reading host catalog %q: %v", id, err)
}
@@ -150,7 +149,6 @@ func testAccCheckHostCatalogResourceExists(name string) resource.TestCheckFunc {
func testAccCheckHostCatalogResourceDestroy(t *testing.T) resource.TestCheckFunc {
return func(s *terraform.State) error {
md := testProvider.Meta().(*metaData)
client := md.client
for _, rs := range s.RootModule().Resources {
switch rs.Type {
@@ -159,14 +157,15 @@ func testAccCheckHostCatalogResourceDestroy(t *testing.T) resource.TestCheckFunc
case "boundary_host_catalog":
id := rs.Primary.ID
h := hosts.HostCatalog{Id: id}
p := &scopes.Project{
Client: client,
Id: rs.Primary.Attributes["project_id"],
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
projClient := md.client.Clone()
projClient.SetScopeId(projID)
hcClient := hosts.NewHostCatalogsClient(projClient)
_, apiErr, _ := p.ReadHostCatalog(md.ctx, &h)
_, apiErr, _ := hcClient.Read(md.ctx, id)
if apiErr == nil || apiErr.Status != http.StatusNotFound {
return fmt.Errorf("Didn't get a 404 when reading destroyed host catalog %q: %v", id, apiErr)
}
+36 -41
View File
@@ -3,8 +3,8 @@ package provider
import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
const (
@@ -35,13 +35,13 @@ func resourceProject() *schema.Resource {
// convertProjectToResourceData populates the provided ResourceData with the appropriate values from the provided Project.
// The project passed into thie function should be one read from the boundary API with all fields populated.
func convertProjectToResourceData(p *scopes.Project, d *schema.ResourceData) error {
if p.Name != nil {
func convertProjectToResourceData(p *scopes.Scope, d *schema.ResourceData) error {
if p.Name != "" {
if err := d.Set(projectNameKey, p.Name); err != nil {
return err
}
}
if p.Description != nil {
if p.Description != "" {
if err := d.Set(projectDescriptionKey, p.Description); err != nil {
return err
}
@@ -51,15 +51,13 @@ func convertProjectToResourceData(p *scopes.Project, d *schema.ResourceData) err
}
// convertResourceDataToProject returns a localy built Project using the values provided in the ResourceData.
func convertResourceDataToProject(d *schema.ResourceData) *scopes.Project {
p := &scopes.Project{}
func convertResourceDataToProject(d *schema.ResourceData) *scopes.Scope {
p := &scopes.Scope{}
if descVal, ok := d.GetOk(projectDescriptionKey); ok {
desc := descVal.(string)
p.Description = &desc
p.Description = descVal.(string)
}
if nameVal, ok := d.GetOk(projectNameKey); ok {
name := nameVal.(string)
p.Name = &name
p.Name = nameVal.(string)
}
if d.Id() != "" {
p.Id = d.Id()
@@ -72,12 +70,13 @@ func resourceProjectCreate(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
// The org id is declared in the client, so no need to specify that here.
o := &scopes.Org{
Client: client,
}
scp := scopes.NewScopesClient(client)
p := convertResourceDataToProject(d)
p, _, err := o.CreateProject(ctx, p)
p, _, err := scp.Create(
ctx,
client.ScopeId(),
scopes.WithName(p.Name),
scopes.WithDescription(p.Description))
if err != nil {
return err
}
@@ -91,11 +90,9 @@ func resourceProjectRead(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
p := &scopes.Project{Id: d.Id()}
p, _, err := o.ReadProject(ctx, p)
scp := scopes.NewScopesClient(client)
p, _, err := scp.Read(ctx, d.Id())
if err != nil {
return err
}
@@ -107,32 +104,29 @@ func resourceProjectUpdate(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
p := &scopes.Project{
Id: d.Id(),
}
projClient := client.Clone()
projClient.SetScopeId(d.Id())
scp := scopes.NewScopesClient(projClient)
p := convertResourceDataToProject(d)
if d.HasChange(projectDescriptionKey) {
desc := d.Get(projectDescriptionKey).(string)
if desc == "" {
p.SetDefault(projectDescriptionKey)
} else {
p.Description = &desc
}
p.Description = desc
}
if d.HasChange(projectNameKey) {
name := d.Get(projectNameKey).(string)
if name == "" {
p.SetDefault(projectNameKey)
} else {
p.Name = &name
}
p.Name = name
}
p, _, err := o.UpdateProject(ctx, p)
p, _, err := scp.Update(
ctx,
d.Id(),
0,
scopes.WithAutomaticVersioning(),
scopes.WithDescription(p.Description),
scopes.WithName(p.Name),
)
if err != nil {
return err
}
@@ -145,11 +139,12 @@ func resourceProjectDelete(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
projClient := client.Clone()
projClient.SetScopeId(d.Id())
scp := scopes.NewScopesClient(projClient)
p := convertResourceDataToProject(d)
_, _, err := o.DeleteProject(ctx, p)
_, _, err := scp.Delete(ctx, p.Id)
if err != nil {
return fmt.Errorf("failed deleting project: %w", err)
}
+25 -29
View File
@@ -6,11 +6,10 @@ import (
"strings"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/testing/controller"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/stretchr/testify/assert"
)
@@ -67,10 +66,9 @@ func testAccCheckProjectResourceExists(name string) resource.TestCheckFunc {
return fmt.Errorf("ID not formatted as expected")
}
md := testProvider.Meta().(*metaData)
o := scopes.Org{
Client: md.client,
}
if _, _, err := o.ReadProject(md.ctx, &scopes.Project{Id: id}); err != nil {
scp := scopes.NewScopesClient(md.client)
if _, _, err := scp.Read(md.ctx, id); err != nil {
return fmt.Errorf("Got an error when reading project %q: %v", id, err)
}
@@ -82,15 +80,13 @@ func testAccCheckProjectResourceDestroy(t *testing.T) resource.TestCheckFunc {
return func(s *terraform.State) error {
// retrieve the connection established in Provider configuration
md := testProvider.Meta().(*metaData)
o := scopes.Org{
Client: md.client,
}
scp := scopes.NewScopesClient(md.client)
for _, rs := range s.RootModule().Resources {
id := rs.Primary.ID
switch rs.Type {
case "boundary_project":
if _, apiErr, _ := o.ReadProject(md.ctx, &scopes.Project{Id: id}); apiErr == nil || apiErr.Status != http.StatusNotFound {
if _, apiErr, _ := scp.Read(md.ctx, id); apiErr == nil || apiErr.Status != http.StatusNotFound {
return fmt.Errorf("Didn't get a 404 when reading destroyed project %q: %v", id, apiErr)
}
default:
@@ -106,7 +102,7 @@ func TestResourceDataToProject(t *testing.T) {
testCases := []struct {
name string
rData map[string]interface{}
expected *scopes.Project
expected *scopes.Scope
}{
{
name: "Fully populated",
@@ -114,9 +110,9 @@ func TestResourceDataToProject(t *testing.T) {
projectNameKey: "name",
projectDescriptionKey: "desc",
},
expected: &scopes.Project{
Name: api.String("name"),
Description: api.String("desc"),
expected: &scopes.Scope{
Name: "name",
Description: "desc",
},
},
{
@@ -124,8 +120,8 @@ func TestResourceDataToProject(t *testing.T) {
rData: map[string]interface{}{
projectNameKey: "name",
},
expected: &scopes.Project{
Name: api.String("name"),
expected: &scopes.Scope{
Name: "name",
},
},
{
@@ -133,14 +129,14 @@ func TestResourceDataToProject(t *testing.T) {
rData: map[string]interface{}{
projectDescriptionKey: "desc",
},
expected: &scopes.Project{
Description: api.String("desc"),
expected: &scopes.Scope{
Description: "desc",
},
},
{
name: "Not populated",
rData: map[string]interface{}{},
expected: &scopes.Project{},
expected: &scopes.Scope{},
},
}
for _, tc := range testCases {
@@ -160,14 +156,14 @@ func TestProjectToResourceData(t *testing.T) {
testCases := []struct {
name string
expected map[string]interface{}
proj *scopes.Project
proj *scopes.Scope
}{
{
name: "Fully populated",
proj: &scopes.Project{
proj: &scopes.Scope{
Id: "someid",
Name: api.String("name"),
Description: api.String("desc"),
Name: "name",
Description: "desc",
},
expected: map[string]interface{}{
projectNameKey: "name",
@@ -176,9 +172,9 @@ func TestProjectToResourceData(t *testing.T) {
},
{
name: "Name populated",
proj: &scopes.Project{
proj: &scopes.Scope{
Id: "someid",
Name: api.String("name"),
Name: "name",
},
expected: map[string]interface{}{
projectNameKey: "name",
@@ -186,9 +182,9 @@ func TestProjectToResourceData(t *testing.T) {
},
{
name: "Description populated",
proj: &scopes.Project{
proj: &scopes.Scope{
Id: "someid",
Description: api.String("desc"),
Description: "desc",
},
expected: map[string]interface{}{
projectDescriptionKey: "desc",
@@ -196,7 +192,7 @@ func TestProjectToResourceData(t *testing.T) {
},
{
name: "Not populated",
proj: &scopes.Project{
proj: &scopes.Scope{
Id: "someid",
},
expected: map[string]interface{}{},
+100 -60
View File
@@ -3,9 +3,8 @@ package provider
import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/boundary/api/roles"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
const (
@@ -13,6 +12,7 @@ const (
roleDescriptionKey = "description"
rolePrincipalsKey = "principals"
roleGrantsKey = "grants"
roleProjectIDKey = "project_id"
)
func resourceRole() *schema.Resource {
@@ -40,70 +40,82 @@ func resourceRole() *schema.Resource {
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
roleProjectIDKey: {
Type: schema.TypeString,
Optional: true,
},
},
}
}
// convertRoleToResourceData creates a ResourceData type from a Role
func convertRoleToResourceData(u *roles.Role, d *schema.ResourceData) error {
if u.Name != nil {
if err := d.Set(roleNameKey, u.Name); err != nil {
func convertRoleToResourceData(r *roles.Role, d *schema.ResourceData) error {
if r.Name != "" {
if err := d.Set(roleNameKey, r.Name); err != nil {
return err
}
}
if u.Description != nil {
if err := d.Set(roleDescriptionKey, u.Description); err != nil {
if r.Description != "" {
if err := d.Set(roleDescriptionKey, r.Description); err != nil {
return err
}
}
if u.PrincipalIds != nil {
if err := d.Set(rolePrincipalsKey, u.PrincipalIds); err != nil {
if r.PrincipalIds != nil {
if err := d.Set(rolePrincipalsKey, r.PrincipalIds); err != nil {
return err
}
}
if u.Grants != nil {
if err := d.Set(roleGrantsKey, u.Grants); err != nil {
if r.Grants != nil {
if err := d.Set(roleGrantsKey, r.Grants); err != nil {
return err
}
}
d.SetId(u.Id)
if r.Scope.Id != "" {
if err := d.Set(roleProjectIDKey, r.Scope.Id); err != nil {
return err
}
}
d.SetId(r.Id)
return nil
}
// convertResourceDataToRole returns a localy built Role using the values provided in the ResourceData.
func convertResourceDataToRole(d *schema.ResourceData) *roles.Role {
u := &roles.Role{}
r := &roles.Role{}
if projIDVal, ok := d.GetOk(roleProjectIDKey); ok {
r.Scope.Id = projIDVal.(string)
}
if descVal, ok := d.GetOk(roleDescriptionKey); ok {
desc := descVal.(string)
u.Description = &desc
r.Description = descVal.(string)
}
if nameVal, ok := d.GetOk(roleNameKey); ok {
name := nameVal.(string)
u.Name = &name
r.Name = nameVal.(string)
}
if val, ok := d.GetOk(rolePrincipalsKey); ok {
principalIds := val.(*schema.Set).List()
for _, i := range principalIds {
u.PrincipalIds = append(u.PrincipalIds, i.(string))
r.PrincipalIds = append(r.PrincipalIds, i.(string))
}
}
if val, ok := d.GetOk(roleGrantsKey); ok {
grants := val.(*schema.Set).List()
for _, i := range grants {
u.Grants = append(u.Grants, i.(string))
g := &roles.Grant{Raw: i.(string)}
r.Grants = append(r.Grants, g)
}
}
if d.Id() != "" {
u.Id = d.Id()
r.Id = d.Id()
}
return u
return r
}
func resourceRoleCreate(d *schema.ResourceData, meta interface{}) error {
@@ -111,15 +123,24 @@ func resourceRoleCreate(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
r := convertResourceDataToRole(d)
projClient := client.Clone()
if r.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", r.Name, r.Scope.Id)
projClient.SetScopeId(r.Scope.Id)
}
rolesClient := roles.NewRolesClient(projClient)
principals := r.PrincipalIds
grants := []string{}
for _, g := range r.Grants {
grants = append(grants, g.Raw)
}
r := convertResourceDataToRole(d)
principals := r.PrincipalIds
grants := r.Grants
newRole, apiErr, err := o.CreateRole(ctx, r)
r, apiErr, err := rolesClient.Create(
ctx,
roles.WithName(r.Name),
roles.WithDescription(r.Description))
if apiErr != nil {
return fmt.Errorf("error creating role: %s\n", apiErr.Message)
}
@@ -131,7 +152,11 @@ func resourceRoleCreate(d *schema.ResourceData, meta interface{}) error {
// running AddGrants it claims the role is not found. This
// doesn't occur in the test case but only on a live cluster.
if len(grants) > 0 {
r, apiErr, err = newRole.AddGrants(ctx, grants)
r, apiErr, err = rolesClient.AddGrants(
ctx,
r.Id,
r.Version,
grants)
if apiErr != nil {
return fmt.Errorf("error setting grants on role:: %s\n", apiErr.Message)
}
@@ -141,7 +166,11 @@ func resourceRoleCreate(d *schema.ResourceData, meta interface{}) error {
}
if len(principals) > 0 {
r, apiErr, err = r.SetPrincipals(ctx, principals)
r, apiErr, err = rolesClient.SetPrincipals(
ctx,
r.Id,
r.Version,
principals)
if apiErr != nil {
return fmt.Errorf("error setting principals on role: %s\n", apiErr.Message)
}
@@ -160,13 +189,15 @@ func resourceRoleRead(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
r := convertResourceDataToRole(d)
projClient := client.Clone()
if r.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", r.Name, r.Scope.Id)
projClient.SetScopeId(r.Scope.Id)
}
rolesClient := roles.NewRolesClient(projClient)
r, apiErr, err := o.ReadRole(ctx, r)
r, apiErr, err := rolesClient.Read(ctx, r.Id)
if err != nil {
return fmt.Errorf("error reading role: %s", err.Error())
}
@@ -182,55 +213,62 @@ func resourceRoleUpdate(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
r := convertResourceDataToRole(d)
projClient := client.Clone()
if r.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", r.Name, r.Scope.Id)
projClient.SetScopeId(r.Scope.Id)
}
rolesClient := roles.NewRolesClient(projClient)
if d.HasChange(roleNameKey) {
n := d.Get(roleNameKey).(string)
r.Name = &n
r.Name = d.Get(roleNameKey).(string)
}
if d.HasChange(roleDescriptionKey) {
d := d.Get(roleDescriptionKey).(string)
r.Description = &d
r.Description = d.Get(roleDescriptionKey).(string)
}
r.PrincipalIds = nil
r.Grants = nil
r, apiErr, err := o.UpdateRole(ctx, r)
r, apiErr, err := rolesClient.Update(
ctx,
r.Id,
0,
roles.WithAutomaticVersioning(),
roles.WithName(r.Name),
roles.WithDescription(r.Description))
if apiErr != nil || err != nil {
return fmt.Errorf("error updating role:\n API Err: %+v\n Err: %+v\n", *apiErr, err)
}
grants := []string{}
if d.HasChange(roleGrantsKey) {
grants := []string{}
grantSet := d.Get(roleGrantsKey).(*schema.Set).List()
for _, grant := range grantSet {
grants = append(grants, grant.(string))
}
}
if d.HasChange(roleGrantsKey) {
_, apiErr, err := r.SetGrants(ctx, grants)
_, apiErr, err := rolesClient.SetGrants(
ctx,
r.Id,
r.Version,
grants)
if apiErr != nil || err != nil {
return fmt.Errorf("error setting grants on role:\n API Err: %+v\n Err: %+v\n", *apiErr, err)
}
}
principalIds := []string{}
if d.HasChange(rolePrincipalsKey) {
principalIds := []string{}
principals := d.Get(rolePrincipalsKey).(*schema.Set).List()
for _, principal := range principals {
principalIds = append(principalIds, principal.(string))
}
}
if d.HasChange(rolePrincipalsKey) {
r, apiErr, err = r.SetPrincipals(ctx, principalIds)
r, apiErr, err = rolesClient.SetPrincipals(
ctx,
r.Id,
r.Version,
principalIds)
if apiErr != nil || err != nil {
return fmt.Errorf("error updating principal on role:\n API Err: %+v\n Err: %+v\n", *apiErr, err)
}
@@ -244,13 +282,15 @@ func resourceRoleDelete(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
r := convertResourceDataToRole(d)
projClient := client.Clone()
if r.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", r.Name, r.Scope.Id)
projClient.SetScopeId(r.Scope.Id)
}
rolesClient := roles.NewRolesClient(projClient)
_, apiErr, err := o.DeleteRole(ctx, r)
_, apiErr, err := rolesClient.Delete(ctx, r.Id)
if apiErr != nil || err != nil {
return fmt.Errorf("error deleting role:\n API Err: %+v\n Err: %+v\n", *apiErr, err)
}
+76 -51
View File
@@ -7,11 +7,10 @@ import (
"strings"
"testing"
"github.com/hashicorp/boundary/api/roles"
"github.com/hashicorp/boundary/testing/controller"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/boundary/api/roles"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/testing/controller"
)
const (
@@ -24,79 +23,95 @@ var (
resource "boundary_role" "foo" {
name = "test"
description = "%s"
project_id = boundary_project.foo.id
}`, fooRoleDescription)
fooRoleUpdate = fmt.Sprintf(`
resource "boundary_role" "foo" {
name = "test"
description = "%s"
project_id = boundary_project.foo.id
}`, fooRoleDescriptionUpdate)
fooRoleWithUser = `
resource "boundary_user" "foo" {
name = "foo"
project_id = boundary_project.foo.id
}
resource "boundary_role" "foo" {
name = "test"
description = "test description"
users = [boundary_user.foo.id]
project_id = boundary_project.foo.id
}`
fooRoleWithUserUpdate = `
resource "boundary_user" "foo" {
name = "foo"
project_id = boundary_project.foo.id
}
resource "boundary_user" "bar" {
name = "bar"
project_id = boundary_project.foo.id
}
resource "boundary_role" "foo" {
name = "test"
description = "test description"
users = [boundary_user.foo.id, boundary_user.bar.id]
project_id = boundary_project.foo.id
}`
fooRoleWithGroups = `
resource "boundary_group" "foo" {
name = "foo"
project_id = boundary_project.foo.id
}
resource "boundary_role" "foo" {
name = "test"
description = "test description"
groups = [boundary_group.foo.id]
project_id = boundary_project.foo.id
}`
fooRoleWithGroupsUpdate = `
resource "boundary_group" "foo" {
name = "foo"
project_id = boundary_project.foo.id
}
resource "boundary_group" "bar" {
name = "bar"
project_id = boundary_project.foo.id
}
resource "boundary_role" "foo" {
name = "test"
description = "test description"
groups = [boundary_group.foo.id, boundary_group.bar.id]
project_id = boundary_project.foo.id
}`
readonlyGrant = "id=*;actions=read"
readonlyGrantUpdate = "id=*;actions=read,create"
fooRoleWithGrants = fmt.Sprintf(`
fooRoleWithGrants = fmt.Sprintf(`
resource "boundary_role" "foo" {
name = "readonly"
description = "test description"
grants = ["%s"]
project_id = boundary_project.foo.id
}`, readonlyGrant)
fooRoleWithGrantsUpdate = fmt.Sprintf(`
resource "boundary_role" "foo" {
name = "readonly"
description = "test description"
grants = ["%s", "%s"]
project_id = boundary_project.foo.id
}`, readonlyGrant, readonlyGrantUpdate)
)
@@ -111,7 +126,7 @@ func TestAccRoleWithGrants(t *testing.T) {
Steps: []resource.TestStep{
{
// test create
Config: testConfig(url, fooRoleWithGrants),
Config: testConfig(url, fooProject, fooRoleWithGrants),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists("boundary_role.foo"),
testAccCheckRoleResourceGrantsSet("boundary_role.foo", []string{readonlyGrant}),
@@ -121,7 +136,7 @@ func TestAccRoleWithGrants(t *testing.T) {
},
{
// test update
Config: testConfig(url, fooRoleWithGrantsUpdate),
Config: testConfig(url, fooProject, fooRoleWithGrantsUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists("boundary_role.foo"),
testAccCheckRoleResourceGrantsSet("boundary_role.foo", []string{readonlyGrant, readonlyGrantUpdate}),
@@ -144,7 +159,7 @@ func TestAccRoleWithUsers(t *testing.T) {
Steps: []resource.TestStep{
{
// test create
Config: testConfig(url, fooRoleWithUser),
Config: testConfig(url, fooProject, fooRoleWithUser),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists("boundary_role.foo"),
testAccCheckRoleResourceUsersSet("boundary_role.foo", []string{"boundary_user.foo"}),
@@ -156,7 +171,7 @@ func TestAccRoleWithUsers(t *testing.T) {
},
{
// test update
Config: testConfig(url, fooRoleWithUserUpdate),
Config: testConfig(url, fooProject, fooRoleWithUserUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists("boundary_role.foo"),
testAccCheckUserResourceExists("boundary_user.foo"),
@@ -179,7 +194,7 @@ func TestAccRoleWithGroups(t *testing.T) {
Steps: []resource.TestStep{
{
// test create
Config: testConfig(url, fooRoleWithGroups),
Config: testConfig(url, fooProject, fooRoleWithGroups),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists("boundary_role.foo"),
testAccCheckRoleResourceGroupsSet("boundary_role.foo", []string{"boundary_group.foo"}),
@@ -191,7 +206,7 @@ func TestAccRoleWithGroups(t *testing.T) {
},
{
// test update
Config: testConfig(url, fooRoleWithGroupsUpdate),
Config: testConfig(url, fooProject, fooRoleWithGroupsUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists("boundary_role.foo"),
testAccCheckUserResourceExists("boundary_group.foo"),
@@ -214,7 +229,7 @@ func TestAccRole(t *testing.T) {
Steps: []resource.TestStep{
{
// test create
Config: testConfig(url, fooRole),
Config: testConfig(url, fooProject, fooRole),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists("boundary_role.foo"),
resource.TestCheckResourceAttr("boundary_role.foo", roleDescriptionKey, fooRoleDescription),
@@ -223,7 +238,7 @@ func TestAccRole(t *testing.T) {
},
{
// test update
Config: testConfig(url, fooRoleUpdate),
Config: testConfig(url, fooProject, fooRoleUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists("boundary_role.foo"),
resource.TestCheckResourceAttr("boundary_role.foo", roleDescriptionKey, fooRoleDescriptionUpdate),
@@ -268,13 +283,15 @@ func testAccCheckRoleDestroyed(name string) resource.TestCheckFunc {
}
md := testProvider.Meta().(*metaData)
u := roles.Role{Id: id}
o := &scopes.Org{
Client: md.client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
if _, apiErr, _ := o.ReadRole(md.ctx, &u); apiErr == nil || apiErr.Status != http.StatusNotFound {
projClient := md.client.Clone()
projClient.SetScopeId(projID)
rolesClient := roles.NewRolesClient(projClient)
if _, apiErr, _ := rolesClient.Read(md.ctx, id); apiErr == nil || apiErr.Status != http.StatusNotFound {
errs = append(errs, fmt.Sprintf("Role not destroyed %q: %v", id, apiErr))
}
@@ -295,13 +312,15 @@ func testAccCheckRoleResourceExists(name string) resource.TestCheckFunc {
}
md := testProvider.Meta().(*metaData)
u := roles.Role{Id: id}
o := &scopes.Org{
Client: md.client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
if _, _, err := o.ReadRole(md.ctx, &u); err != nil {
projClient := md.client.Clone()
projClient.SetScopeId(projID)
rolesClient := roles.NewRolesClient(projClient)
if _, _, err := rolesClient.Read(md.ctx, id); err != nil {
return fmt.Errorf("Got an error when reading role %q: %v", id, err)
}
@@ -337,14 +356,15 @@ func testAccCheckRoleResourceUsersSet(name string, users []string) resource.Test
}
md := testProvider.Meta().(*metaData)
u := roles.Role{Id: id}
o := &scopes.Org{
Client: md.client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
projClient := md.client.Clone()
projClient.SetScopeId(projID)
rolesClient := roles.NewRolesClient(projClient)
r, _, err := o.ReadRole(md.ctx, &u)
r, _, err := rolesClient.Read(md.ctx, id)
if err != nil {
return fmt.Errorf("Got an error when reading role %q: %v", id, err)
}
@@ -399,14 +419,15 @@ func testAccCheckRoleResourceGroupsSet(name string, groups []string) resource.Te
}
md := testProvider.Meta().(*metaData)
u := roles.Role{Id: id}
o := &scopes.Org{
Client: md.client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
projClient := md.client.Clone()
projClient.SetScopeId(projID)
rolesClient := roles.NewRolesClient(projClient)
r, _, err := o.ReadRole(md.ctx, &u)
r, _, err := rolesClient.Read(md.ctx, id)
if err != nil {
return fmt.Errorf("Got an error when reading role %q: %v", id, err)
}
@@ -446,14 +467,15 @@ func testAccCheckRoleResourceGrantsSet(name string, expectedGrants []string) res
}
md := testProvider.Meta().(*metaData)
u := roles.Role{Id: id}
o := &scopes.Org{
Client: md.client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
projClient := md.client.Clone()
projClient.SetScopeId(projID)
rolesClient := roles.NewRolesClient(projClient)
r, _, err := o.ReadRole(md.ctx, &u)
r, _, err := rolesClient.Read(md.ctx, id)
if err != nil {
return fmt.Errorf("Got an error when reading role %q: %v", id, err)
}
@@ -466,12 +488,12 @@ func testAccCheckRoleResourceGrantsSet(name string, expectedGrants []string) res
for _, grant := range expectedGrants {
ok = false
for _, gotGrant := range r.Grants {
if gotGrant == grant {
if gotGrant.Raw == grant {
ok = true
}
}
if !ok {
return fmt.Errorf("expected grant not found on role, %s: %s\n Have: %v\n", *r.Name, grant, r)
return fmt.Errorf("expected grant not found on role, %s: %s\n Have: %v\n", r.Name, grant, r)
}
}
@@ -481,8 +503,10 @@ func testAccCheckRoleResourceGrantsSet(name string, expectedGrants []string) res
func testAccCheckRoleResourceDestroy(t *testing.T) resource.TestCheckFunc {
return func(s *terraform.State) error {
if testProvider.Meta() == nil {
t.Fatal("got nil provider metadata")
}
md := testProvider.Meta().(*metaData)
client := md.client
for _, rs := range s.RootModule().Resources {
switch rs.Type {
@@ -493,14 +517,15 @@ func testAccCheckRoleResourceDestroy(t *testing.T) resource.TestCheckFunc {
case "boundary_role":
id := rs.Primary.ID
u := roles.Role{Id: id}
o := &scopes.Org{
Client: client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
projClient := md.client.Clone()
projClient.SetScopeId(projID)
rolesClient := roles.NewRolesClient(projClient)
_, apiErr, _ := o.ReadRole(md.ctx, &u)
_, apiErr, _ := rolesClient.Read(md.ctx, id)
if apiErr == nil || apiErr.Status != http.StatusNotFound {
return fmt.Errorf("Didn't get a 404 when reading destroyed role %q: %v", id, apiErr)
}
+58 -33
View File
@@ -3,14 +3,14 @@ package provider
import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/api/users"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
const (
userNameKey = "name"
userDescriptionKey = "description"
userProjectIDKey = "project_id"
)
func resourceUser() *schema.Resource {
@@ -28,25 +28,34 @@ func resourceUser() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
userProjectIDKey: {
Type: schema.TypeString,
Optional: true,
},
},
}
}
// convertUserToResourceData creates a ResourceData type from a User
func convertUserToResourceData(u *users.User, d *schema.ResourceData) error {
if u.Name != nil {
if u.Name != "" {
if err := d.Set(userNameKey, u.Name); err != nil {
return err
}
}
if u.Description != nil {
if u.Description != "" {
if err := d.Set(userDescriptionKey, u.Description); err != nil {
return err
}
}
if u.Scope.Id != "" {
if err := d.Set(userProjectIDKey, u.Scope.Id); err != nil {
return err
}
}
d.SetId(u.Id)
return nil
@@ -56,12 +65,13 @@ func convertUserToResourceData(u *users.User, d *schema.ResourceData) error {
func convertResourceDataToUser(d *schema.ResourceData) *users.User {
u := &users.User{}
if descVal, ok := d.GetOk(userDescriptionKey); ok {
desc := descVal.(string)
u.Description = &desc
u.Description = descVal.(string)
}
if nameVal, ok := d.GetOk(userNameKey); ok {
name := nameVal.(string)
u.Name = &name
u.Name = nameVal.(string)
}
if projIDVal, ok := d.GetOk(userProjectIDKey); ok {
u.Scope.Id = projIDVal.(string)
}
if d.Id() != "" {
@@ -76,13 +86,18 @@ func resourceUserCreate(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
u := convertResourceDataToUser(d)
projClient := client.Clone()
if u.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", u.Name, u.Scope.Id)
projClient.SetScopeId(u.Scope.Id)
}
usrs := users.NewUsersClient(projClient)
u, apiErr, err := o.CreateUser(ctx, u)
u, apiErr, err := usrs.Create(
ctx,
users.WithName(u.Name),
users.WithDescription(u.Description))
if err != nil {
return fmt.Errorf("error calling new user: %s", err.Error())
}
@@ -100,13 +115,15 @@ func resourceUserRead(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
u := convertResourceDataToUser(d)
projClient := client.Clone()
if u.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", u.Name, u.Scope.Id)
projClient.SetScopeId(u.Scope.Id)
}
usrs := users.NewUsersClient(projClient)
u, apiErr, err := o.ReadUser(ctx, u)
u, apiErr, err := usrs.Read(ctx, u.Id)
if err != nil {
return fmt.Errorf("error reading user: %s", err.Error())
}
@@ -122,23 +139,29 @@ func resourceUserUpdate(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
u := convertResourceDataToUser(d)
projClient := client.Clone()
if u.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", u.Name, u.Scope.Id)
projClient.SetScopeId(u.Scope.Id)
}
usrs := users.NewUsersClient(projClient)
if d.HasChange(userNameKey) {
n := d.Get(userNameKey).(string)
u.Name = &n
u.Name = d.Get(userNameKey).(string)
}
if d.HasChange(userDescriptionKey) {
d := d.Get(userDescriptionKey).(string)
u.Description = &d
u.Description = d.Get(userDescriptionKey).(string)
}
u, apiErr, err := o.UpdateUser(ctx, u)
u, apiErr, err := usrs.Update(
ctx,
u.Id,
0,
users.WithAutomaticVersioning(),
users.WithName(u.Name),
users.WithDescription(u.Description))
if err != nil {
return err
}
@@ -154,13 +177,15 @@ func resourceUserDelete(d *schema.ResourceData, meta interface{}) error {
client := md.client
ctx := md.ctx
o := &scopes.Org{
Client: client,
}
u := convertResourceDataToUser(d)
projClient := client.Clone()
if u.Scope.Id != "" {
fmt.Printf("[DEBUG] project_id detected, resetting client scope for %s to %s\n", u.Name, u.Scope.Id)
projClient.SetScopeId(u.Scope.Id)
}
usrs := users.NewUsersClient(projClient)
_, apiErr, err := o.DeleteUser(ctx, u)
_, apiErr, err := usrs.Delete(ctx, u.Id)
if err != nil {
return fmt.Errorf("error deleting user: %s", err.Error())
}
+34 -25
View File
@@ -7,11 +7,10 @@ import (
"strings"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
"github.com/hashicorp/boundary/api/scopes"
"github.com/hashicorp/boundary/api/users"
"github.com/hashicorp/boundary/testing/controller"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
)
const (
@@ -25,17 +24,20 @@ var (
resource "boundary_user" "foo" {
name = "test"
description = "%s"
project_id = boundary_project.foo.id
}`, fooUserDescription)
fooUserUpdate = fmt.Sprintf(`
resource "boundary_user" "foo" {
name = "test"
description = "%s"
project_id = boundary_project.foo.id
}`, fooUserDescriptionUpdate)
fooUserUnset = fmt.Sprintf(`
resource "boundary_user" "foo" {
name = "test"
description = "%s"
project_id = boundary_project.foo.id
}`, fooUserDescriptionUnset)
)
@@ -50,7 +52,7 @@ func TestAccUser(t *testing.T) {
Steps: []resource.TestStep{
{
// test create
Config: testConfig(url, fooUser),
Config: testConfig(url, fooProject, fooUser),
Check: resource.ComposeTestCheckFunc(
testAccCheckUserResourceExists("boundary_user.foo"),
resource.TestCheckResourceAttr("boundary_user.foo", userDescriptionKey, fooUserDescription),
@@ -59,7 +61,7 @@ func TestAccUser(t *testing.T) {
},
{
// test update
Config: testConfig(url, fooUserUnset),
Config: testConfig(url, fooProject, fooUserUnset),
Check: resource.ComposeTestCheckFunc(
testAccCheckUserResourceExists("boundary_user.foo"),
resource.TestCheckResourceAttr("boundary_user.foo", userDescriptionKey, fooUserDescriptionUnset),
@@ -67,7 +69,7 @@ func TestAccUser(t *testing.T) {
},
{
// test unset
Config: testConfig(url, fooUserUpdate),
Config: testConfig(url, fooProject, fooUserUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckUserResourceExists("boundary_user.foo"),
resource.TestCheckResourceAttr("boundary_user.foo", userDescriptionKey, fooUserDescriptionUpdate),
@@ -113,13 +115,15 @@ func testAccCheckUserDestroyed(name string) resource.TestCheckFunc {
}
md := testProvider.Meta().(*metaData)
u := users.User{Id: id}
o := &scopes.Org{
Client: md.client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
if _, apiErr, _ := o.ReadUser(md.ctx, &u); apiErr == nil || apiErr.Status != http.StatusNotFound {
projClient := md.client.Clone()
projClient.SetScopeId(projID)
usrs := users.NewUsersClient(projClient)
if _, apiErr, _ := usrs.Read(md.ctx, id); apiErr == nil || apiErr.Status != http.StatusNotFound {
errs = append(errs, fmt.Sprintf("User not destroyed %q: %v", id, apiErr))
}
@@ -140,13 +144,15 @@ func testAccCheckUserResourceExists(name string) resource.TestCheckFunc {
}
md := testProvider.Meta().(*metaData)
u := users.User{Id: id}
o := &scopes.Org{
Client: md.client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
if _, _, err := o.ReadUser(md.ctx, &u); err != nil {
projClient := md.client.Clone()
projClient.SetScopeId(projID)
usrs := users.NewUsersClient(projClient)
if _, _, err := usrs.Read(md.ctx, id); err != nil {
return fmt.Errorf("Got an error when reading user %q: %v", id, err)
}
@@ -156,22 +162,25 @@ func testAccCheckUserResourceExists(name string) resource.TestCheckFunc {
func testAccCheckUserResourceDestroy(t *testing.T) resource.TestCheckFunc {
return func(s *terraform.State) error {
if testProvider.Meta() == nil {
t.Fatal("got nil provider metadata")
}
md := testProvider.Meta().(*metaData)
client := md.client
for _, rs := range s.RootModule().Resources {
switch rs.Type {
case "boundary_user":
id := rs.Primary.ID
u := users.User{Id: id}
o := &scopes.Org{
Client: client,
projID, ok := rs.Primary.Attributes["project_id"]
if !ok {
return fmt.Errorf("project_id is not set")
}
projClient := md.client.Clone()
projClient.SetScopeId(projID)
usrs := users.NewUsersClient(projClient)
_, apiErr, _ := o.ReadUser(md.ctx, &u)
_, apiErr, _ := usrs.Read(md.ctx, id)
if apiErr == nil || apiErr.Status != http.StatusNotFound {
return fmt.Errorf("Didn't get a 404 when reading destroyed user %q: %v", id, apiErr)
}