Compare commits

..
8 Commits
Author SHA1 Message Date
tf-release-bot 5f4fa20ca8 v1.0.5 2021-09-09 15:26:00 +00:00
Louis Ruch 6374cb307b 1.0.5 release update dependencies (#140)
* chore: bump dependencies

* chore: update changelog for release 1.0.5
2021-09-09 08:22:25 -07:00
DevOps RobandLouis Ruch 9c054c1ac8 updating examples to use new grants_strings syntax (#132)
* updating examples to use new grants_strings syntax

* Make docs

Co-authored-by: Louis Ruch <louisruch@gmail.com>
2021-09-08 13:02:12 -07:00
Louis Ruchandgrantorchard 725f2d8fb9 Deprecate target host_set_ids and credential_library_ids (#134)
* Deprecate target host_set_ids and credential_library_ids

* Update changelog

* Include the 'type' attribute in the boundary_target documentation example. (#88)

* Include the 'type' attribute in the example.

* run tfplugindocs to generate the new markdown with type attribute change included

Co-authored-by: grantorchard <go@hashicorp.com>
2021-09-08 11:15:10 -07:00
Louis Ruch 7372487f84 Fix white space 2021-09-01 14:37:22 -07:00
Edgaras f202fbc06d docs: fix examples (#96) 2021-09-01 14:36:33 -07:00
grantorchard 8bb1490ebd Include the 'type' attribute in the boundary_target documentation example. (#88)
* Include the 'type' attribute in the example.

* run tfplugindocs to generate the new markdown with type attribute change included
2021-09-01 14:15:36 -07:00
Louis Ruch 45c1a8c5cc Make docs 2021-08-19 21:13:33 +02:00
17 changed files with 503 additions and 146 deletions

No files matched your search

+8
View File
@@ -1,3 +1,11 @@
## 1.0.5 (September 09, 2021)
### Deprecations/Changes
* Deprecate fields `host_set_ids` and `application_credential_library_ids` of the
`target` resource. See boundary 0.5.0 [changelog](https://github.com/hashicorp/boundary/blob/main/CHANGELOG.md#deprecationschanges) for more detail on the deprecation.
([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/134)).
## 1.0.4 (August 19, 2021)
### New and Improved
+11 -4
View File
@@ -28,12 +28,19 @@ resource "boundary_scope" "project" {
auto_create_admin_role = true
}
resource "boundary_host" "example" {
name = "example_host"
description = "My first host!"
address = "10.0.0.1"
resource "boundary_host_catalog" "static" {
name = "My catalog"
description = "My first host catalog!"
type = "static"
scope_id = boundary_scope.project.id
}
resource "boundary_host" "example" {
name = "example_host"
description = "My first host!"
address = "10.0.0.1"
host_catalog_id = boundary_host_catalog.static.id
}
```
<!-- schema generated by tfplugindocs -->
+1
View File
@@ -50,6 +50,7 @@ resource "boundary_host" "2" {
resource "boundary_host_set" "web" {
host_catalog_id = boundary_host_catalog.static.id
type = "static"
host_ids = [
boundary_host.1.id,
boundary_host.2.id,
+32
View File
@@ -0,0 +1,32 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "boundary_managed_group Resource - terraform-provider-boundary"
subcategory: ""
description: |-
The managed group resource allows you to configure a Boundary group.
---
# boundary_managed_group (Resource)
The managed group resource allows you to configure a Boundary group.
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- **auth_method_id** (String) The resource ID for the auth method.
- **filter** (String) Boolean expression to filter the workers for this managed group.
### Optional
- **description** (String) The managed group description.
- **name** (String) The managed group name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the group.
+14 -14
View File
@@ -51,10 +51,10 @@ resource "boundary_user" "bar" {
}
resource "boundary_role" "example" {
name = "My role"
description = "My first role!"
principals = [boundary_user.foo.id, boundary_user.bar.id]
scope_id = boundary_scope.org.id
name = "My role"
description = "My first role!"
principal_ids = [boundary_user.foo.id, boundary_user.bar.id]
scope_id = boundary_scope.org.id
}
```
@@ -76,11 +76,11 @@ resource "boundary_user" "readonly" {
}
resource "boundary_role" "readonly" {
name = "readonly"
description = "A readonly role"
principals = [boundary_user.readonly.id]
grants = ["id=*;action=read"]
scope_id = boundary_scope.org.id
name = "readonly"
description = "A readonly role"
principal_ids = [boundary_user.readonly.id]
grant_strings = ["id=*;type=*;actions=read"]
scope_id = boundary_scope.org.id
}
```
@@ -109,11 +109,11 @@ resource "boundary_user" "readonly" {
}
resource "boundary_role" "readonly" {
name = "readonly"
description = "A readonly role"
principals = [boundary_user.readonly.id]
grants = ["id=*;action=read"]
scope_id = boundary_scope.project.id
name = "readonly"
description = "A readonly role"
principal_ids = [boundary_user.readonly.id]
grant_strings = ["id=*;type=*;actions=read"]
scope_id = boundary_scope.project.id
}
```
+7 -4
View File
@@ -83,12 +83,13 @@ resource "boundary_host_set" "foo" {
resource "boundary_target" "foo" {
name = "foo"
description = "Foo target"
type = "tcp"
default_port = "22"
scope_id = boundary_scope.project.id
host_set_ids = [
host_source_ids = [
boundary_host_set.foo.id
]
application_credential_library_ids = [
application_credential_source_ids = [
boundary_credential_library_vault.foo.id
]
}
@@ -104,10 +105,12 @@ resource "boundary_target" "foo" {
### Optional
- **application_credential_library_ids** (Set of String) A list of application credential library ID's.
- **application_credential_library_ids** (Set of String, Deprecated) A list of application credential library ID's.
- **application_credential_source_ids** (Set of String) A list of application credential source ID's.
- **default_port** (Number) The default port for this target.
- **description** (String) The target description.
- **host_set_ids** (Set of String) A list of host set ID's.
- **host_set_ids** (Set of String, Deprecated) A list of host set ID's.
- **host_source_ids** (Set of String) A list of host source ID's.
- **name** (String) The target name. Defaults to the resource name.
- **session_connection_limit** (Number)
- **session_max_seconds** (Number)
+11 -4
View File
@@ -13,9 +13,16 @@ resource "boundary_scope" "project" {
auto_create_admin_role = true
}
resource "boundary_host" "example" {
name = "example_host"
description = "My first host!"
address = "10.0.0.1"
resource "boundary_host_catalog" "static" {
name = "My catalog"
description = "My first host catalog!"
type = "static"
scope_id = boundary_scope.project.id
}
resource "boundary_host" "example" {
name = "example_host"
description = "My first host!"
address = "10.0.0.1"
host_catalog_id = boundary_host_catalog.static.id
}
@@ -35,6 +35,7 @@ resource "boundary_host" "2" {
resource "boundary_host_set" "web" {
host_catalog_id = boundary_host_catalog.static.id
type = "static"
host_ids = [
boundary_host.1.id,
boundary_host.2.id,
@@ -20,9 +20,9 @@ resource "boundary_user" "readonly" {
}
resource "boundary_role" "readonly" {
name = "readonly"
description = "A readonly role"
principals = [boundary_user.readonly.id]
grants = ["id=*;action=read"]
scope_id = boundary_scope.project.id
name = "readonly"
description = "A readonly role"
principal_ids = [boundary_user.readonly.id]
grant_strings = ["id=*;type=*;actions=read"]
scope_id = boundary_scope.project.id
}
@@ -13,9 +13,9 @@ resource "boundary_user" "readonly" {
}
resource "boundary_role" "readonly" {
name = "readonly"
description = "A readonly role"
principals = [boundary_user.readonly.id]
grants = ["id=*;action=read"]
scope_id = boundary_scope.org.id
name = "readonly"
description = "A readonly role"
principal_ids = [boundary_user.readonly.id]
grant_strings = ["id=*;type=*;actions=read"]
scope_id = boundary_scope.org.id
}
@@ -17,8 +17,8 @@ resource "boundary_user" "bar" {
}
resource "boundary_role" "example" {
name = "My role"
description = "My first role!"
principals = [boundary_user.foo.id, boundary_user.bar.id]
scope_id = boundary_scope.org.id
name = "My role"
description = "My first role!"
principal_ids = [boundary_user.foo.id, boundary_user.bar.id]
scope_id = boundary_scope.org.id
}
@@ -68,12 +68,13 @@ resource "boundary_host_set" "foo" {
resource "boundary_target" "foo" {
name = "foo"
description = "Foo target"
type = "tcp"
default_port = "22"
scope_id = boundary_scope.project.id
host_set_ids = [
host_source_ids = [
boundary_host_set.foo.id
]
application_credential_library_ids = [
application_credential_source_ids = [
boundary_credential_library_vault.foo.id
]
}
+6 -6
View File
@@ -14,16 +14,16 @@ require (
github.com/aws/aws-sdk-go v1.35.4 // indirect
github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe // indirect
github.com/golang/snappy v0.0.2 // indirect
github.com/hashicorp/boundary v0.5.1
github.com/hashicorp/boundary/api v0.0.15
github.com/hashicorp/boundary/sdk v0.0.7
github.com/hashicorp/boundary v0.6.0
github.com/hashicorp/boundary/api v0.0.18
github.com/hashicorp/boundary/sdk v0.0.10
github.com/hashicorp/cap v0.1.1
github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
github.com/hashicorp/go-kms-wrapping v0.6.5
github.com/hashicorp/go-kms-wrapping v0.6.6
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl/v2 v2.6.0 // indirect
github.com/hashicorp/terraform-plugin-docs v0.4.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0
github.com/hashicorp/terraform-plugin-docs v0.5.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.1
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
+18 -33
View File
@@ -116,7 +116,6 @@ github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
@@ -293,13 +292,10 @@ github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aev
github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34=
github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0=
github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM=
github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
@@ -441,14 +437,12 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/grpc-ecosystem/grpc-gateway/v2 v2.3.0 h1:IvO4FbbQL6n3v3M1rQNobZ61SGL0gJLdvKA5KETM7Xs=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.3.0/go.mod h1:d2gYTOTUQklu06xp0AJYYmRdTVU1VKrqhkYfYag2L08=
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
github.com/hashicorp/boundary v0.5.1 h1:2AYMOdZ7hG/gNOXmjb+rPYX0cxSJ8AfpnNy6IUtIR0c=
github.com/hashicorp/boundary v0.5.1/go.mod h1:vV9WCTfUvyCswxWogsWxlmgQw1NESPtm+vPKzzdZeUU=
github.com/hashicorp/boundary/api v0.0.14/go.mod h1:LHdyywcqngZNY6VwvGTfvkriX9gFeFJQwA/mkYFD3WY=
github.com/hashicorp/boundary/api v0.0.15 h1:3SvLcJD9veA1eLU5sSa2Oq08+PmolyISEouKnuBvJew=
github.com/hashicorp/boundary/api v0.0.15/go.mod h1:LHdyywcqngZNY6VwvGTfvkriX9gFeFJQwA/mkYFD3WY=
github.com/hashicorp/boundary/sdk v0.0.6/go.mod h1:2wF9tZZH+8EQc48spyQvsEJmF20YDVj1ngqtje3TRRE=
github.com/hashicorp/boundary/sdk v0.0.7 h1:pNh7a7E3IR1VK/4eQr+O4Sifi34at2TJ1Axs2BE9XmM=
github.com/hashicorp/boundary/sdk v0.0.7/go.mod h1:Giwls9jMXm50BAJoIXWpWYUwWTyqAbZXATwoFc3MkRY=
github.com/hashicorp/boundary v0.6.0 h1:EmacGyNYCxcznizoAbxuA9mExAPTsNZmPqELL7REOls=
github.com/hashicorp/boundary v0.6.0/go.mod h1:NYYYJXzJuUc9Mn7Ils/yjR9jApXvsM+8eoEDTID7YNg=
github.com/hashicorp/boundary/api v0.0.18 h1:+l/UP1QUOYQK4lmznW/oyKeZ4wd8B18ir551fKoy6RM=
github.com/hashicorp/boundary/api v0.0.18/go.mod h1:0S0ne+tioMQAc+mzeWd7+6lh7TQANkXRlYwzIyexKng=
github.com/hashicorp/boundary/sdk v0.0.10 h1:S+MqSpnpx3mlDNh9d9H5p3T8olziM7LxpJrVZP/G+TU=
github.com/hashicorp/boundary/sdk v0.0.10/go.mod h1:cAHY1icFXqEDZqYx0ufkeYTuriIe/laNtJfN/kIsVEw=
github.com/hashicorp/cap v0.1.1 h1:GjO4+9+H0wv/89YoEsxeVc2jIizL19r5v5l2lpaH8Kg=
github.com/hashicorp/cap v0.1.1/go.mod h1:VfBvK2ULRyqsuqAnjgZl7HJ7/CGMC7ro4H5eXiZuun8=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
@@ -461,6 +455,8 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/eventlogger v0.1.0 h1:S6xc4gZVzewuDUP4R4Ngko419h/CGDuV/b4ADL3XLik=
github.com/hashicorp/eventlogger v0.1.0/go.mod h1:a3IXf1aEJfpCPzseTOrwKj4fVW/Qn3oEmpQeaIznzH0=
github.com/hashicorp/eventlogger/filters/encrypt v0.1.3 h1:RKYUGplnpDoE/Cj2vupQqUJS/wWBVvmpxEYeEpGL88s=
github.com/hashicorp/eventlogger/filters/encrypt v0.1.3/go.mod h1:8rcez7Kw1zanB0/074qnOuGu7zxmNh9Xr2ZI+K4xVIA=
github.com/hashicorp/go-bexpr v0.1.9 h1:ouAaFgGdp28SwSFYbJycLo9hNWwbtgESzTVKeBC21pw=
github.com/hashicorp/go-bexpr v0.1.9/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0=
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
@@ -471,7 +467,6 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
github.com/hashicorp/go-getter v1.4.0/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY=
github.com/hashicorp/go-getter v1.5.3 h1:NF5+zOlQegim+w/EUhSLh6QhXHmZMEeHLQzllkQ3ROU=
github.com/hashicorp/go-getter v1.5.3/go.mod h1:BrrV/1clo8cCYu6mxvboYg+KutTiFnXjMEgDD8+i7ZI=
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=
@@ -487,9 +482,10 @@ github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjh
github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.0 h1:8exGP7ego3OmkfksihtSouGMZ+hQrhxx+FVELeXpVPE=
github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-kms-wrapping v0.6.3/go.mod h1:1DTKimjuT1g8KaS8rwYxF0kkjaFMXKtJif9KXxsrr+s=
github.com/hashicorp/go-kms-wrapping v0.6.5 h1:iKcwiqpm2dvkMLymEyJQpbazwR70l7XINUPFduLdbAs=
github.com/hashicorp/go-kms-wrapping v0.6.4/go.mod h1:pRK4UPSmNLEAjLE2qVz7nvS4NTZyyypQCn2G4q7vkps=
github.com/hashicorp/go-kms-wrapping v0.6.5/go.mod h1:9aLqFi2fqK1WMCyTe9bVjB0X6XxCxD+oINL1ovxpgJE=
github.com/hashicorp/go-kms-wrapping v0.6.6 h1:S2lw/8CFAw5kcztPD9iABG8ekjOs5san9C2oZrY6Syw=
github.com/hashicorp/go-kms-wrapping v0.6.6/go.mod h1:9aLqFi2fqK1WMCyTe9bVjB0X6XxCxD+oINL1ovxpgJE=
github.com/hashicorp/go-kms-wrapping/entropy v0.1.0/go.mod h1:d1g9WGtAunDNpek8jUIEJnBlbgKS1N2Q61QkHiZyR1g=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
@@ -512,11 +508,11 @@ github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5O
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-secure-stdlib/awsutil v0.1.1/go.mod h1:QRJZ7siKie+SZJB9jLbfKrs0Gd0yPWMtbneg0iU1PrY=
github.com/hashicorp/go-secure-stdlib/awsutil v0.1.2 h1:AEcLbDoaRC9JMmtZXsuCykztH53rvHsQFnwhoKtpNQM=
github.com/hashicorp/go-secure-stdlib/awsutil v0.1.2/go.mod h1:QRJZ7siKie+SZJB9jLbfKrs0Gd0yPWMtbneg0iU1PrY=
github.com/hashicorp/go-secure-stdlib/base62 v0.1.1 h1:6KMBnfEv0/kLAz0O76sliN5mXbCDcLfs2kP7ssP7+DQ=
github.com/hashicorp/go-secure-stdlib/base62 v0.1.1/go.mod h1:EdWO6czbmthiwZ3/PUsDV+UD1D5IRU4ActiaWGwt0Yw=
github.com/hashicorp/go-secure-stdlib/configutil v0.1.1/go.mod h1:5CQ5+MqV+qf46nta8piifri5TdcZ0sE/PCz9vgzeh0U=
github.com/hashicorp/go-secure-stdlib/configutil v0.1.2 h1:ai0P91rxlyGWkYUH/zFr7mduW2Q+2FMrXawkLM8e7NU=
github.com/hashicorp/go-secure-stdlib/configutil v0.1.2/go.mod h1:EN1DJMjv9y5e/uRAuP2WPibAox5KHEiq2BjZl00aNPQ=
github.com/hashicorp/go-secure-stdlib/gatedwriter v0.1.1 h1:9um9R8i0+HbRHS9d64kdvWR0/LJvo12sIonvR9zr1+U=
@@ -547,7 +543,6 @@ github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw=
github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
@@ -566,18 +561,16 @@ 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/terraform-exec v0.12.0/go.mod h1:SGhto91bVRlgXQWcJ5znSz+29UZIa8kpBbkGwQ+g9E8=
github.com/hashicorp/terraform-exec v0.14.0 h1:UQoUcxKTZZXhyyK68Cwn4mApT4mnFPmEXPiqaHL9r+w=
github.com/hashicorp/terraform-exec v0.14.0/go.mod h1:qrAASDq28KZiMPDnQ02sFS9udcqEkRly002EA2izXTA=
github.com/hashicorp/terraform-json v0.8.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+umhSQnvJwORXbprE=
github.com/hashicorp/terraform-json v0.12.0 h1:8czPgEEWWPROStjkWPUnTQDXmpmZPlkQAwYYLETaTvw=
github.com/hashicorp/terraform-json v0.12.0/go.mod h1:pmbq9o4EuL43db5+0ogX10Yofv1nozM+wskr/bGFJpI=
github.com/hashicorp/terraform-plugin-docs v0.4.0 h1:xJIXsMzBFwBvC1zcjoNz743GL2tNEfYFFU9+Hjp4Uek=
github.com/hashicorp/terraform-plugin-docs v0.4.0/go.mod h1:fKj/V3t45tiXpSlUms/0G4OrBayyWpbUJ4WtLjBkINU=
github.com/hashicorp/terraform-plugin-docs v0.5.0 h1:Rso/yNznoGl7KVb/Z5RefiHsLJaGTbok9sEnad+V1t4=
github.com/hashicorp/terraform-plugin-docs v0.5.0/go.mod h1:Z4q6unfv05W7fjpEy8ZC+nFijZmcm64Iag6I2HKRMSA=
github.com/hashicorp/terraform-plugin-go v0.3.0 h1:AJqYzP52JFYl9NABRI7smXI1pNjgR5Q/y2WyVJ/BOZA=
github.com/hashicorp/terraform-plugin-go v0.3.0/go.mod h1:dFHsQMaTLpON2gWhVWT96fvtlc/MF1vSy3OdMhWBzdM=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0 h1:SuI59MqNjYDrL7EfqHX9V6P/24isgqYx/FdglwVs9bg=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0/go.mod h1:grseeRo9g3yNkYW09iFlV8LG78jTa1ssBgouogQg/RU=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.1 h1:vpzKKP2dIFb9n89AG8Wxl758/5JSZWZH0OuKdlq0M38=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.1/go.mod h1:o3pdss6ynDZW9FfiZ+rETUH5LEVufrXdhwLU+5OiRo0=
github.com/hashicorp/vault/api v1.0.5-0.20200519221902-385fac77e20f/go.mod h1:euTFbi2YJgwcju3imEt919lhJKF68nN1cQPq3aA+kBE=
github.com/hashicorp/vault/api v1.1.1 h1:907ld+Z9cALyvbZK2qUX9cLwvSaEQsMVQB3x2KE8+AI=
github.com/hashicorp/vault/api v1.1.1/go.mod h1:29UXcn/1cLOPHQNMWA7bCz2By4PSd0VKPAydKXS5yN0=
@@ -596,7 +589,6 @@ github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq
github.com/huaweicloud/golangsdk v0.0.0-20200304081349-45ec0797f2a4/go.mod h1:WQBcHRNX9shz3928lWEvstQJtAtYI7ks6XlgtRT9Tcw=
github.com/iancoleman/strcase v0.1.3/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
@@ -639,7 +631,6 @@ github.com/jefferai/isbadcipher v0.0.0-20190226160619-51d2077c035f h1:E87tDTVS5W
github.com/jefferai/isbadcipher v0.0.0-20190226160619-51d2077c035f/go.mod h1:3J2qVK16Lq8V+wfiL2lPeDZ7UWMxk5LemerHa1p6N00=
github.com/jefferai/keyring v1.1.7-0.20210105022822-8749b3d9ce79 h1:7opZgeTbZEBfZSK6OXO6HSnWIDUBn6wlxBuG13pSuEM=
github.com/jefferai/keyring v1.1.7-0.20210105022822-8749b3d9ce79/go.mod h1:Y6M+VPkRv4aOcVNvvSWma4aMRLY+xvPhzZX3tDmPoPY=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74=
github.com/jhump/protoreflect v1.8.1 h1:z7Ciiz3Bz37zSd485fbiTW8ABafIasyOWZI0N9EUUdo=
@@ -677,7 +668,6 @@ github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q
github.com/k0kubun/pp v2.3.0+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM=
@@ -749,7 +739,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/cli v1.1.1/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
github.com/mitchellh/cli v1.1.2 h1:PvH+lL2B7IQ101xQL63Of8yFS2y+aDlsFcsqNc+u/Kw=
github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
@@ -959,7 +948,6 @@ github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqri
github.com/twitchtv/twirp v7.1.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
@@ -970,7 +958,6 @@ github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6Ac
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/xanzy/go-gitlab v0.15.0/go.mod h1:8zdQa/ri1dfn8eS3Ir1SyfvOKlw7WBJ8DVThkpGiXrs=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
@@ -988,9 +975,9 @@ github.com/zalando/go-keyring v0.1.1 h1:w2V9lcx/Uj4l+dzAf1m9s+DJ1O8ROkEHnynonHjT
github.com/zalando/go-keyring v0.1.1/go.mod h1:OIC+OZ28XbmwFxU/Rp9V7eKzZjamBJwRzC8UFJH9+L8=
github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
github.com/zclconf/go-cty v1.2.1/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=
github.com/zclconf/go-cty v1.7.1/go.mod h1:VDR4+I79ubFBGm1uJac1226K5yANQFHeauxPBoP54+o=
github.com/zclconf/go-cty v1.8.4 h1:pwhhz5P+Fjxse7S7UriBrMu6AUJSZM5pKqGem1PjGAs=
github.com/zclconf/go-cty v1.8.4/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
github.com/zclconf/go-cty v1.9.1 h1:viqrgQwFl5UpSxc046qblj78wZXVDFnSOufaOTER+cc=
github.com/zclconf/go-cty v1.9.1/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=
@@ -1036,7 +1023,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -1168,7 +1154,6 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+1 -1
View File
@@ -51,7 +51,7 @@ func resourceManagedGroup() *schema.Resource {
managedGroupFilterKey: {
Description: "Boolean expression to filter the workers for this managed group.",
Type: schema.TypeString,
Optional: true,
Required: true,
},
},
}
+148 -55
View File
@@ -12,12 +12,12 @@ import (
)
const (
targetHostSetIdsKey = "host_set_ids"
targetApplicationCredentialLibraryIdsKey = "application_credential_library_ids"
targetDefaultPortKey = "default_port"
targetSessionMaxSecondsKey = "session_max_seconds"
targetSessionConnectionLimitKey = "session_connection_limit"
targetWorkerFilterKey = "worker_filter"
targetHostSourceIdsKey = "host_source_ids"
targetApplicationCredentialSourceIdsKey = "application_credential_source_ids"
targetDefaultPortKey = "default_port"
targetSessionMaxSecondsKey = "session_max_seconds"
targetSessionConnectionLimitKey = "session_connection_limit"
targetWorkerFilterKey = "worker_filter"
targetTypeTcp = "tcp"
)
@@ -67,17 +67,35 @@ func resourceTarget() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
},
targetHostSetIdsKey: {
Description: "A list of host set ID's.",
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
"host_set_ids": {
Description: "A list of host set ID's.",
Type: schema.TypeSet,
Optional: true,
Deprecated: "Please use 'host_source_ids' instead",
ConflictsWith: []string{targetHostSourceIdsKey},
Elem: &schema.Schema{Type: schema.TypeString},
},
targetApplicationCredentialLibraryIdsKey: {
Description: "A list of application credential library ID's.",
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
"application_credential_library_ids": {
Description: "A list of application credential library ID's.",
Type: schema.TypeSet,
Optional: true,
Deprecated: "Please use 'application_credential_source_ids' instead",
ConflictsWith: []string{targetApplicationCredentialSourceIdsKey},
Elem: &schema.Schema{Type: schema.TypeString},
},
targetHostSourceIdsKey: {
Description: "A list of host source ID's.",
Type: schema.TypeSet,
Optional: true,
ConflictsWith: []string{"host_set_ids"},
Elem: &schema.Schema{Type: schema.TypeString},
},
targetApplicationCredentialSourceIdsKey: {
Description: "A list of application credential source ID's.",
Type: schema.TypeSet,
Optional: true,
ConflictsWith: []string{"application_credential_library_ids"},
Elem: &schema.Schema{Type: schema.TypeString},
},
targetSessionMaxSecondsKey: {
Type: schema.TypeInt,
@@ -111,11 +129,23 @@ func setFromTargetResponseMap(d *schema.ResourceData, raw map[string]interface{}
if err := d.Set(TypeKey, raw["type"]); err != nil {
return err
}
if err := d.Set(targetHostSetIdsKey, raw["host_set_ids"]); err != nil {
return err
if _, ok := d.GetOk("host_set_ids"); ok {
if err := d.Set("host_set_ids", raw["host_set_ids"]); err != nil {
return err
}
} else {
if err := d.Set(targetHostSourceIdsKey, raw["host_source_ids"]); err != nil {
return err
}
}
if err := d.Set(targetApplicationCredentialLibraryIdsKey, raw["application_credential_library_ids"]); err != nil {
return err
if _, ok := d.GetOk("application_credential_library_ids"); ok {
if err := d.Set("application_credential_library_ids", raw["application_credential_library_ids"]); err != nil {
return err
}
} else {
if err := d.Set(targetApplicationCredentialSourceIdsKey, raw["application_credential_source_ids"]); err != nil {
return err
}
}
if err := d.Set(targetSessionMaxSecondsKey, raw["session_max_seconds"]); err != nil {
return err
@@ -206,21 +236,39 @@ func resourceTargetCreate(ctx context.Context, d *schema.ResourceData, meta inte
opts = append(opts, targets.WithSessionConnectionLimit(int32(sessionConnectionLimitInt)))
}
var hostSetIds []string
if hostSetIdsVal, ok := d.GetOk(targetHostSetIdsKey); ok {
list := hostSetIdsVal.(*schema.Set).List()
hostSetIds = make([]string, 0, len(list))
var hostSourceIds []string
if hostSourceIdsVal, ok := d.GetOk(targetHostSourceIdsKey); ok {
list := hostSourceIdsVal.(*schema.Set).List()
hostSourceIds = make([]string, 0, len(list))
for _, i := range list {
hostSetIds = append(hostSetIds, i.(string))
hostSourceIds = append(hostSourceIds, i.(string))
}
}
var credentialLibraryIds []string
if credentialLibraryIdsVal, ok := d.GetOk(targetApplicationCredentialLibraryIdsKey); ok {
list := credentialLibraryIdsVal.(*schema.Set).List()
credentialLibraryIds = make([]string, 0, len(list))
// TODO: remove when host_set_ids is fully deprecated
if hostSetIdsVal, ok := d.GetOk("host_set_ids"); ok {
list := hostSetIdsVal.(*schema.Set).List()
hostSourceIds = make([]string, 0, len(list))
for _, i := range list {
credentialLibraryIds = append(credentialLibraryIds, i.(string))
hostSourceIds = append(hostSourceIds, i.(string))
}
}
var credentialSourceIds []string
if credentialSourceIdsVal, ok := d.GetOk(targetApplicationCredentialSourceIdsKey); ok {
list := credentialSourceIdsVal.(*schema.Set).List()
credentialSourceIds = make([]string, 0, len(list))
for _, i := range list {
credentialSourceIds = append(credentialSourceIds, i.(string))
}
}
// TODO: remove when application_credential_library_ids is fully deprecated
if credentialLibIdsVal, ok := d.GetOk("application_credential_library_ids"); ok {
list := credentialLibIdsVal.(*schema.Set).List()
credentialSourceIds = make([]string, 0, len(list))
for _, i := range list {
credentialSourceIds = append(credentialSourceIds, i.(string))
}
}
@@ -242,19 +290,19 @@ func resourceTargetCreate(ctx context.Context, d *schema.ResourceData, meta inte
raw := tcr.GetResponse().Map
version := tcr.Item.Version
if hostSetIds != nil {
tur, err := tc.SetHostSets(ctx, tcr.Item.Id, version, hostSetIds)
if hostSourceIds != nil {
tur, err := tc.SetHostSources(ctx, tcr.Item.Id, version, hostSourceIds)
if err != nil {
return diag.Errorf("error setting host sets on target: %v", err)
return diag.Errorf("error setting host sources on target: %v", err)
}
raw = tur.GetResponse().Map
version = tur.Item.Version
}
if credentialLibraryIds != nil {
tur, err := tc.SetCredentialLibraries(ctx, tcr.Item.Id, version, targets.WithApplicationCredentialLibraryIds(credentialLibraryIds))
if credentialSourceIds != nil {
tur, err := tc.SetCredentialSources(ctx, tcr.Item.Id, version, targets.WithApplicationCredentialSourceIds(credentialSourceIds))
if err != nil {
return diag.Errorf("error setting credential libraries on target: %v", err)
return diag.Errorf("error setting credential sources on target: %v", err)
}
raw = tur.GetResponse().Map
}
@@ -411,31 +459,76 @@ func resourceTargetUpdate(ctx context.Context, d *schema.ResourceData, meta inte
// The above call may not actually happen, so we use d.Id() and automatic
// versioning here
if d.HasChange(targetHostSetIdsKey) {
var hostSetIds []string
if hostSetIdsVal, ok := d.GetOk(targetHostSetIdsKey); ok {
hostSets := hostSetIdsVal.(*schema.Set).List()
for _, hostSet := range hostSets {
hostSetIds = append(hostSetIds, hostSet.(string))
if d.HasChange(targetHostSourceIdsKey) {
var hostSourceIds []string
if hostSourceIdsVal, ok := d.GetOk(targetHostSourceIdsKey); ok {
hostSources := hostSourceIdsVal.(*schema.Set).List()
for _, hostSource := range hostSources {
hostSourceIds = append(hostSourceIds, hostSource.(string))
}
}
_, err := tc.SetHostSets(ctx, d.Id(), 0, hostSetIds, targets.WithAutomaticVersioning(true))
_, err := tc.SetHostSources(ctx, d.Id(), 0, hostSourceIds, targets.WithAutomaticVersioning(true))
if err != nil {
return diag.Errorf("error updating host sets in target: %v", err)
return diag.Errorf("error updating host sources in target: %v", err)
}
if err := d.Set(targetHostSetIdsKey, hostSetIds); err != nil {
if err := d.Set(targetHostSourceIdsKey, hostSourceIds); err != nil {
return diag.FromErr(err)
}
}
// // TODO: remove when host_set_ids is fully deprecated
if d.HasChange("host_set_ids") {
var hostSourceIds []string
if hostSourceIdsVal, ok := d.GetOk("host_set_ids"); ok {
hostSources := hostSourceIdsVal.(*schema.Set).List()
for _, hostSource := range hostSources {
hostSourceIds = append(hostSourceIds, hostSource.(string))
}
}
_, err := tc.SetHostSets(ctx, d.Id(), 0, hostSourceIds, targets.WithAutomaticVersioning(true))
if err != nil {
return diag.Errorf("error updating host sources in target: %v", err)
}
if err := d.Set("host_set_ids", hostSourceIds); err != nil {
return diag.FromErr(err)
}
}
// The above calls may not actually happen, so we use d.Id() and automatic
// versioning here
if d.HasChange(targetApplicationCredentialLibraryIdsKey) {
var credentialLibraryIds []string
if credentialLibraryIdsVal, ok := d.GetOk(targetApplicationCredentialLibraryIdsKey); ok {
credLibsIds := credentialLibraryIdsVal.(*schema.Set).List()
for _, credLibId := range credLibsIds {
credentialLibraryIds = append(credentialLibraryIds, credLibId.(string))
if d.HasChange(targetApplicationCredentialSourceIdsKey) {
var credentialSourceIds []string
if credentialSourceIdsVal, ok := d.GetOk(targetApplicationCredentialSourceIdsKey); ok {
credSourceIds := credentialSourceIdsVal.(*schema.Set).List()
for _, credSourceId := range credSourceIds {
credentialSourceIds = append(credentialSourceIds, credSourceId.(string))
}
}
opts := []targets.Option{
targets.WithAutomaticVersioning(true),
targets.DefaultApplicationCredentialSourceIds(),
}
if len(credentialSourceIds) > 0 {
opts = append(opts, targets.WithApplicationCredentialSourceIds(credentialSourceIds))
}
_, err := tc.SetCredentialSources(ctx, d.Id(), 0, opts...)
if err != nil {
return diag.Errorf("error updating credential sources in target: %v", err)
}
if err := d.Set(targetApplicationCredentialSourceIdsKey, credentialSourceIds); err != nil {
return diag.FromErr(err)
}
}
// TODO: remove when application_credential_library_ids is fully deprecated
if d.HasChange("application_credential_library_ids") {
var credentialSourceIds []string
if credentialSourceIdsVal, ok := d.GetOk("application_credential_library_ids"); ok {
credSourceIds := credentialSourceIdsVal.(*schema.Set).List()
for _, credSourceId := range credSourceIds {
credentialSourceIds = append(credentialSourceIds, credSourceId.(string))
}
}
@@ -443,15 +536,15 @@ func resourceTargetUpdate(ctx context.Context, d *schema.ResourceData, meta inte
targets.WithAutomaticVersioning(true),
targets.DefaultApplicationCredentialLibraryIds(),
}
if len(credentialLibraryIds) > 0 {
opts = append(opts, targets.WithApplicationCredentialLibraryIds(credentialLibraryIds))
if len(credentialSourceIds) > 0 {
opts = append(opts, targets.WithApplicationCredentialLibraryIds(credentialSourceIds))
}
_, err := tc.SetCredentialLibraries(ctx, d.Id(), 0, opts...)
if err != nil {
return diag.Errorf("error updating credential libraries in target: %v", err)
return diag.Errorf("error updating credential sources in target: %v", err)
}
if err := d.Set(targetApplicationCredentialLibraryIdsKey, credentialLibraryIds); err != nil {
if err := d.Set("application_credential_library_ids", credentialSourceIds); err != nil {
return diag.FromErr(err)
}
}
+228 -9
View File
@@ -6,11 +6,10 @@ import (
"net/http"
"testing"
"github.com/hashicorp/boundary/testing/vault"
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/targets"
"github.com/hashicorp/boundary/testing/controller"
"github.com/hashicorp/boundary/testing/vault"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
@@ -87,10 +86,10 @@ resource "boundary_target" "foo" {
description = "%s"
type = "tcp"
scope_id = boundary_scope.proj1.id
host_set_ids = [
host_source_ids = [
boundary_host_set.foo.id
]
application_credential_library_ids = [
application_credential_source_ids = [
boundary_credential_library_vault.foo.id
]
default_port = 22
@@ -106,10 +105,10 @@ resource "boundary_target" "foo" {
description = "%s"
type = "tcp"
scope_id = boundary_scope.proj1.id
host_set_ids = [
host_source_ids = [
boundary_host_set.bar.id
]
application_credential_library_ids = [
application_credential_source_ids = [
boundary_credential_library_vault.bar.id
]
default_port = 80
@@ -119,7 +118,7 @@ resource "boundary_target" "foo" {
worker_filter = "type == \"bar\""
}`, fooTargetDescriptionUpdate)
fooTargetUpdateUnsetHostAndCredLibs = fmt.Sprintf(`
fooTargetUpdateUnsetHostAndCredSources = fmt.Sprintf(`
resource "boundary_target" "foo" {
name = "test"
description = "%s"
@@ -131,6 +130,44 @@ resource "boundary_target" "foo" {
session_connection_limit = 7
worker_filter = "type == \"bar\""
}`, fooTargetDescriptionUpdate)
// TODO: remove this when host_set_ids and application_credential_library_ids
// are fully deprecated
fooTargetDeprecatedFields = `
resource "boundary_target" "foo" {
name = "test_deprecated"
type = "tcp"
scope_id = boundary_scope.proj1.id
host_set_ids = [
boundary_host_set.foo.id
]
application_credential_library_ids = [
boundary_credential_library_vault.foo.id
]
depends_on = [boundary_role.proj1_admin]
}`
fooTargetDeprecatedFieldsUpdate = `
resource "boundary_target" "foo" {
name = "test_deprecated"
type = "tcp"
scope_id = boundary_scope.proj1.id
host_set_ids = [
boundary_host_set.bar.id
]
application_credential_library_ids = [
boundary_credential_library_vault.bar.id
]
depends_on = [boundary_role.proj1_admin]
}`
fooTargetDeprecatedFieldsUnset = `
resource "boundary_target" "foo" {
name = "test_deprecated"
type = "tcp"
scope_id = boundary_scope.proj1.id
depends_on = [boundary_role.proj1_admin]
}`
)
func TestAccTarget(t *testing.T) {
@@ -151,6 +188,7 @@ func TestAccTarget(t *testing.T) {
var provider *schema.Provider
resource.Test(t, resource.TestCase{
IsUnitTest: true,
ProviderFactories: providerFactories(&provider),
CheckDestroy: testAccCheckTargetResourceDestroy(t, provider),
Steps: []resource.TestStep{
@@ -165,6 +203,8 @@ func TestAccTarget(t *testing.T) {
resource.TestCheckResourceAttr("boundary_target.foo", targetSessionMaxSecondsKey, "6000"),
resource.TestCheckResourceAttr("boundary_target.foo", targetSessionConnectionLimitKey, "6"),
resource.TestCheckResourceAttr("boundary_target.foo", targetWorkerFilterKey, `type == "foo"`),
testAccCheckTargetResourceHostSource(provider, "boundary_target.foo", []string{"boundary_host_set.foo"}),
testAccCheckTargetResourceAppCredSources(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.foo"}),
testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", []string{"boundary_host_set.foo"}),
testAccCheckTargetResourceAppCredLibs(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.foo"}),
),
@@ -180,14 +220,16 @@ func TestAccTarget(t *testing.T) {
resource.TestCheckResourceAttr("boundary_target.foo", targetSessionMaxSecondsKey, "7000"),
resource.TestCheckResourceAttr("boundary_target.foo", targetSessionConnectionLimitKey, "7"),
resource.TestCheckResourceAttr("boundary_target.foo", targetWorkerFilterKey, `type == "bar"`),
testAccCheckTargetResourceHostSource(provider, "boundary_target.foo", []string{"boundary_host_set.bar"}),
testAccCheckTargetResourceAppCredSources(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.bar"}),
testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", []string{"boundary_host_set.bar"}),
testAccCheckTargetResourceAppCredLibs(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.bar"}),
),
},
importStep("boundary_target.foo"),
{
// test unset hosts and cred libs
Config: testConfig(url, fooOrg, firstProjectFoo, credStoreRes, fooBarCredLibs, fooBarHostSet, fooTargetUpdateUnsetHostAndCredLibs),
// test unset hosts and cred sources
Config: testConfig(url, fooOrg, firstProjectFoo, credStoreRes, fooBarCredLibs, fooBarHostSet, fooTargetUpdateUnsetHostAndCredSources),
Check: resource.ComposeTestCheckFunc(
testAccCheckTargetResourceExists(provider, "boundary_target.foo"),
resource.TestCheckResourceAttr("boundary_target.foo", DescriptionKey, fooTargetDescriptionUpdate),
@@ -195,6 +237,8 @@ func TestAccTarget(t *testing.T) {
resource.TestCheckResourceAttr("boundary_target.foo", targetSessionMaxSecondsKey, "7000"),
resource.TestCheckResourceAttr("boundary_target.foo", targetSessionConnectionLimitKey, "7"),
resource.TestCheckResourceAttr("boundary_target.foo", targetWorkerFilterKey, `type == "bar"`),
testAccCheckTargetResourceHostSource(provider, "boundary_target.foo", nil),
testAccCheckTargetResourceAppCredSources(provider, "boundary_target.foo", nil),
testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", nil),
testAccCheckTargetResourceAppCredLibs(provider, "boundary_target.foo", nil),
),
@@ -204,6 +248,180 @@ func TestAccTarget(t *testing.T) {
})
}
func TestAccTargetDeprecatedFields(t *testing.T) {
tc := controller.NewTestController(t, tcConfig...)
defer tc.Shutdown()
url := tc.ApiAddrs()[0]
vc := vault.NewTestVaultServer(t)
_, token := vc.CreateToken(t)
credStoreRes := vaultCredStoreResource(vc,
vaultCredStoreName,
vaultCredStoreDesc,
vaultCredStoreNamespace,
"www.original.com",
token,
true)
var provider *schema.Provider
resource.Test(t, resource.TestCase{
IsUnitTest: true,
ProviderFactories: providerFactories(&provider),
CheckDestroy: testAccCheckTargetResourceDestroy(t, provider),
Steps: []resource.TestStep{
{
// test create
Config: testConfig(url, fooOrg, firstProjectFoo, credStoreRes, fooBarCredLibs, fooBarHostSet, fooTargetDeprecatedFields),
Check: resource.ComposeTestCheckFunc(
testAccCheckTargetResourceExists(provider, "boundary_target.foo"),
testAccCheckTargetResourceHostSource(provider, "boundary_target.foo", []string{"boundary_host_set.foo"}),
testAccCheckTargetResourceAppCredSources(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.foo"}),
testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", []string{"boundary_host_set.foo"}),
testAccCheckTargetResourceAppCredLibs(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.foo"}),
),
},
{
// test update
Config: testConfig(url, fooOrg, firstProjectFoo, credStoreRes, fooBarCredLibs, fooBarHostSet, fooTargetDeprecatedFieldsUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckTargetResourceExists(provider, "boundary_target.foo"),
testAccCheckTargetResourceHostSource(provider, "boundary_target.foo", []string{"boundary_host_set.bar"}),
testAccCheckTargetResourceAppCredSources(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.bar"}),
testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", []string{"boundary_host_set.bar"}),
testAccCheckTargetResourceAppCredLibs(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.bar"}),
),
},
{
// test unset hosts and cred sources
Config: testConfig(url, fooOrg, firstProjectFoo, credStoreRes, fooBarCredLibs, fooBarHostSet, fooTargetDeprecatedFieldsUnset),
Check: resource.ComposeTestCheckFunc(
testAccCheckTargetResourceExists(provider, "boundary_target.foo"),
testAccCheckTargetResourceHostSource(provider, "boundary_target.foo", nil),
testAccCheckTargetResourceAppCredSources(provider, "boundary_target.foo", nil),
testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", nil),
testAccCheckTargetResourceAppCredLibs(provider, "boundary_target.foo", nil),
),
},
},
})
}
func testAccCheckTargetResourceHostSource(testProvider *schema.Provider, name string, hostSources []string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]
if !ok {
return fmt.Errorf("target resource not found: %s", name)
}
id := rs.Primary.ID
if id == "" {
return fmt.Errorf("target resource ID is not set")
}
// ensure host sources are declared in state
var hostSourceIDs []string
for _, hostSourceResourceID := range hostSources {
hs, ok := s.RootModule().Resources[hostSourceResourceID]
if !ok {
return fmt.Errorf("host source resource not found: %s", hostSourceResourceID)
}
hostSourceID := hs.Primary.ID
if id == "" {
return fmt.Errorf("host source resource ID not set")
}
hostSourceIDs = append(hostSourceIDs, hostSourceID)
}
// check boundary to ensure it matches
md := testProvider.Meta().(*metaData)
tgtsClient := targets.NewClient(md.client)
t, err := tgtsClient.Read(context.Background(), id)
if err != nil {
return fmt.Errorf("Got an error when reading target %q: %v", id, err)
}
if len(t.Item.HostSourceIds) != len(hostSourceIDs) {
return fmt.Errorf("tf state and boundary have different number of host sources")
}
for _, stateHostSourceId := range t.Item.HostSourceIds {
ok := false
for _, gotHostSourceID := range hostSourceIDs {
if gotHostSourceID == stateHostSourceId {
ok = true
}
}
if !ok {
return fmt.Errorf("host source id in state not set in boundary: %s", stateHostSourceId)
}
}
return nil
}
}
func testAccCheckTargetResourceAppCredSources(testProvider *schema.Provider, name string, credSources []string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]
if !ok {
return fmt.Errorf("target resource not found: %s", name)
}
id := rs.Primary.ID
if id == "" {
return fmt.Errorf("target resource ID is not set")
}
// ensure cred sources are declared in state
var credSourceIDs []string
for _, credSourceResourceID := range credSources {
cl, ok := s.RootModule().Resources[credSourceResourceID]
if !ok {
return fmt.Errorf("credential source resource not found: %s", credSourceResourceID)
}
credSourceID := cl.Primary.ID
if id == "" {
return fmt.Errorf("credential source resource ID not set")
}
credSourceIDs = append(credSourceIDs, credSourceID)
}
// check boundary to ensure it matches
md := testProvider.Meta().(*metaData)
tgtsClient := targets.NewClient(md.client)
t, err := tgtsClient.Read(context.Background(), id)
if err != nil {
return fmt.Errorf("got an error when reading target %q: %w", id, err)
}
if len(t.Item.ApplicationCredentialSourceIds) != len(credSourceIDs) {
return fmt.Errorf("tf state and boundary have different number of application credential sources")
}
for _, stateCredSourceId := range t.Item.ApplicationCredentialSourceIds {
ok := false
for _, gotCredSourceID := range credSourceIDs {
if gotCredSourceID == stateCredSourceId {
ok = true
}
}
if !ok {
return fmt.Errorf("application credential source id in state not set in boundary: %s", stateCredSourceId)
}
}
return nil
}
}
// TODO: remove when host_set_ids is fully deprecated
func testAccCheckTargetResourceHostSet(testProvider *schema.Provider, name string, hostSets []string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]
@@ -261,6 +479,7 @@ func testAccCheckTargetResourceHostSet(testProvider *schema.Provider, name strin
}
}
// TODO: remove when application_credential_library_ids is fully deprecated
func testAccCheckTargetResourceAppCredLibs(testProvider *schema.Provider, name string, credLibs []string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[name]