Compare commits

..
16 Commits
Author SHA1 Message Date
Jeanne Angeles Franco 9acb1b6f7f Add missing env: key (#207)
Release / go-version (push) Successful in 3s
Release / release-notes (push) Successful in 5s
Release / Terraform Provider Release (push) Failing after 0s
2022-05-16 15:36:54 -07:00
Louis Ruch e6c8309c17 chore(release): Update changelog 2022-05-16 14:46:50 -07:00
Louis Ruch 84bea9c333 chore(deps): Update deps 2022-05-16 14:45:48 -07:00
Louis Ruch 8422393315 chore(changelog): Update changelog 2022-05-16 14:08:27 -07:00
Louis Ruch b8c92ee913 chore(docs): Update docs 2022-05-16 14:08:27 -07:00
Louis Ruch 23c8315fcc fix(role): flaky test regex 2022-05-16 14:08:27 -07:00
Louis Ruch b17b46d3ab fix(kms): Update kms wrapper calls to v2 2022-05-16 14:08:27 -07:00
Louis Ruch 414cdff86e chore(deps): Update deps 2022-05-16 14:08:27 -07:00
Louis Ruch dfaea8e259 fix(account): Update account deprecations
resource_account has been depreacted in favor of
resource_account_password instead of deprecating the individual password
based fields.
2022-05-16 14:08:27 -07:00
dependabot[bot] 1d345d18ac build(deps): bump actions/upload-artifact from 2 to 3 (#195)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-13 15:20:36 -07:00
modrakeandJeanne Angeles Franco 577b9eb017 [DO NOT MERGE] changes for releases-api launch (#196)
* changes for releases-api launch

* Update to include terraform registry manifest

Co-authored-by: Jeanne Angeles Franco <jeanne.franco@hashicorp.com>
2022-05-10 13:57:48 -04:00
Brian Flad e92a34b624 Migrate Provider Releases from TeamCity to GitHub Actions (#193)
Internal RFC References:

* ENGSRV-035
* ENGSRV-064
* SEC-036
* SEC-061
* TF-279

_Please note: This process can be adjusted to suit your needs, but it will require changes to the workflow setup._

The initial release workflow submitted here is triggered by pushing a semantic version tag prepended with a `v` to the repository. For example:

```shell
git switch main # or your release branch
git pull
git tag v1.2.3
git push origin v1.2.3
```

The most important distinction from the TeamCity release process is that the repository must be fully prepared for the release, including the `CHANGELOG.md` file. Providers can decide the most appropriate process to manage the CHANGELOG or any release notes as part of this new process. This initial workflow will automatically grab contents from the top of the CHANGELOG through the previous release tag header line. [Example provider CHANGELOG](https://github.com/hashicorp/terraform-provider-tls/blob/156ae39c7e55ee8597f859a77ae2db739527376b/CHANGELOG.md) and its [GitHub Release description](https://github.com/hashicorp/terraform-provider-tls/releases/tag/v3.3.0).

Please reach out if you have questions.
2022-04-20 13:55:23 -07:00
KeisukeYamashita 93d925fcfd Add validate func for auth method type key (#178)
* Add validate func for auth key

Signed-off-by: KeisukeYamashita <19yamashita15@gmail.com>

* Add oidc

Signed-off-by: KeisukeYamashita <19yamashita15@gmail.com>
2022-04-02 12:19:43 -07:00
Louis Ruch 214bc5224f chore(deps): Update dependencies (#189) 2022-04-01 16:04:45 -07:00
lrolaz 98a2d617f2 Map Issuer and Subject from attributes elements (#177) 2022-04-01 12:33:10 -07:00
Louis Ruch cbcbdc9955 feat(role): Support partial success in role create/update (#171)
* feat(role): Support partial success in role create/update
2022-01-31 16:03:41 -08:00
48 changed files with 766 additions and 746 deletions

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
permissions:
contents: write
jobs:
go-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.go-version.outputs.version }}
steps:
- uses: actions/checkout@v3
- id: go-version
run: echo "::set-output name=version::$(cat ./.go-version)"
release-notes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate Release Notes
run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > release-notes.txt
- uses: actions/upload-artifact@v3
with:
name: release-notes
path: release-notes.txt
retention-days: 1
terraform-provider-release:
name: 'Terraform Provider Release'
needs: [go-version, release-notes]
uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/hashicorp.yml@v2
secrets:
hc-releases-github-token: '${{ secrets.HASHI_RELEASES_GITHUB_TOKEN }}'
hc-releases-host-staging: '${{ secrets.HC_RELEASES_HOST_STAGING }}'
hc-releases-host-prod: '${{ secrets.HC_RELEASES_HOST_PROD }}'
hc-releases-key-prod: '${{ secrets.HC_RELEASES_KEY_PROD }}'
hc-releases-key-staging: '${{ secrets.HC_RELEASES_KEY_STAGING }}'
hc-releases-terraform-registry-sync-token: '${{ secrets.TF_PROVIDER_RELEASE_TERRAFORM_REGISTRY_SYNC_TOKEN }}'
setup-signore-github-token: '${{ secrets.HASHI_SIGNORE_GITHUB_TOKEN }}'
signore-client-id: '${{ secrets.SIGNORE_CLIENT_ID }}'
signore-client-secret: '${{ secrets.SIGNORE_CLIENT_SECRET }}'
with:
release-notes: true
setup-go-version: '${{ needs.go-version.outputs.version }}'
# Product Version (e.g. v1.2.3 or github.ref_name)
product-version: '${{ github.ref_name }}'
+74
View File
@@ -0,0 +1,74 @@
archives:
- files:
# Ensure only built binary is archived
- 'none*'
format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
before:
hooks:
- 'go mod download'
builds:
- # Binary naming only required for Terraform CLI 0.12
binary: '{{ .ProjectName }}_v{{ .Version }}_x5'
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos:
- darwin
- freebsd
- linux
- windows
goarch:
- '386'
- amd64
- arm
- arm64
ignore:
- goarch: arm
goos: windows
- goarch: arm64
goos: freebsd
- goarch: arm64
goos: windows
ldflags:
- -s -w -X main.Version={{.Version}}
mod_timestamp: '{{ .CommitTimestamp }}'
checksum:
algorithm: sha256
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
publishers:
- checksum: true
# Terraform CLI 0.10 - 0.11 perform discovery via HTTP headers on releases.hashicorp.com
# For providers which have existed since those CLI versions, exclude
# discovery by setting the protocol version headers to 5.
cmd: hc-releases upload -product {{ .ProjectName }} -version {{ .Version }} -file={{ .ArtifactPath }}={{ .ArtifactName }} -header=x-terraform-protocol-version=5 -header=x-terraform-protocol-versions=5.0
env:
- HC_RELEASES_HOST={{ .Env.HC_RELEASES_HOST }}
- HC_RELEASES_KEY={{ .Env.HC_RELEASES_KEY }}
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name: upload
signature: true
release:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
ids:
- none
signs:
- args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"]
artifacts: checksum
cmd: signore
signature: ${artifact}.sig
- args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"]
artifacts: checksum
cmd: signore
id: key-id
signature: ${artifact}.72D7468F.sig
snapshot:
name_template: "{{ .Tag }}-next"
+2
View File
@@ -0,0 +1,2 @@
url_source_repository = "https://github.com/hashicorp/terraform-provider-boundary"
url_license = "https://github.com/hashicorp/terraform-provider-boundary/blob/main/LICENSE"
-1
View File
@@ -1 +0,0 @@
Protocol 5.0 only
+8
View File
@@ -1,3 +1,11 @@
## 1.0.7 (May 16, 2022)
### Deprecations/Changes
* Undoes an erroneous deprecation of the `login_name` and `password` fields in `resource_account_password` and `resource_account`.
Deprecates `resource_account` that was replaced with `resource_account_password`
([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/201)).
## 1.0.6 (January 21, 2022)
### New and Improved
+7 -7
View File
@@ -27,13 +27,13 @@ provider "boundary" {
### Required
- **addr** (String) The base url of the Boundary API, e.g. "http://127.0.0.1:9200". If not set, it will be read from the "BOUNDARY_ADDR" env var.
- `addr` (String) The base url of the Boundary API, e.g. "http://127.0.0.1:9200". If not set, it will be read from the "BOUNDARY_ADDR" env var.
### Optional
- **auth_method_id** (String) The auth method ID e.g. ampw_1234567890
- **password_auth_method_login_name** (String) The auth method login name for password-style auth methods
- **password_auth_method_password** (String) The auth method password for password-style auth methods
- **recovery_kms_hcl** (String) Can be a heredoc string or a path on disk. If set, the string/file will be parsed as HCL and used with the recovery KMS mechanism. While this is set, it will override any other authentication information; the KMS mechanism will always be used. See Boundary's KMS docs for examples: https://boundaryproject.io/docs/configuration/kms
- **tls_insecure** (Boolean) When set to true, does not validate the Boundary API endpoint certificate
- **token** (String) The Boundary token to use, as a string or path on disk containing just the string. If set, the token read here will be used in place of authenticating with the auth method specified in "auth_method_id", although the recovery KMS mechanism will still override this. Can also be set with the BOUNDARY_TOKEN environment variable.
- `auth_method_id` (String) The auth method ID e.g. ampw_1234567890
- `password_auth_method_login_name` (String) The auth method login name for password-style auth methods
- `password_auth_method_password` (String) The auth method password for password-style auth methods
- `recovery_kms_hcl` (String) Can be a heredoc string or a path on disk. If set, the string/file will be parsed as HCL and used with the recovery KMS mechanism. While this is set, it will override any other authentication information; the KMS mechanism will always be used. See Boundary's KMS docs for examples: https://boundaryproject.io/docs/configuration/kms
- `tls_insecure` (Boolean) When set to true, does not validate the Boundary API endpoint certificate
- `token` (String) The Boundary token to use, as a string or path on disk containing just the string. If set, the token read here will be used in place of authenticating with the auth method specified in "auth_method_id", although the recovery KMS mechanism will still override this. Can also be set with the BOUNDARY_TOKEN environment variable.
+9 -37
View File
@@ -3,60 +3,32 @@
page_title: "boundary_account Resource - terraform-provider-boundary"
subcategory: ""
description: |-
The account resource allows you to configure a Boundary account.
Deprecated: use resource_account_password instead.
---
# boundary_account (Resource)
The account resource allows you to configure a Boundary account.
Deprecated: use `resource_account_password` instead.
## Example Usage
```terraform
resource "boundary_scope" "org" {
name = "organization_one"
description = "My first scope!"
scope_id = "global"
auto_create_admin_role = true
auto_create_default_role = true
}
resource "boundary_auth_method" "password" {
scope_id = boundary_scope.org.id
type = "password"
}
resource "boundary_account" "jeff" {
auth_method_id = boundary_auth_method.password.id
type = "password"
login_name = "jeff"
password = "$uper$ecure"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- **auth_method_id** (String) The resource ID for the auth method.
- **type** (String) The resource type.
- `auth_method_id` (String) The resource ID for the auth method.
- `type` (String) The resource type.
### Optional
- **description** (String) The account description.
- **login_name** (String, Deprecated) The login name for this account.
- **name** (String) The account name. Defaults to the resource name.
- **password** (String, Deprecated) The account password. Only set on create, changes will not be reflected when updating account.
- `description` (String) The account description.
- `login_name` (String) The login name for this account.
- `name` (String) The account name. Defaults to the resource name.
- `password` (String) The account password. Only set on create, changes will not be reflected when updating account.
### Read-Only
- **id** (String) The ID of the account.
- `id` (String) The ID of the account.
## Import
Import is supported using the following syntax:
```shell
terraform import boundary_account.foo <my-id>
```
+6 -6
View File
@@ -17,17 +17,17 @@ The account resource allows you to configure a Boundary account.
### Required
- **auth_method_id** (String) The resource ID for the auth method.
- `auth_method_id` (String) The resource ID for the auth method.
### Optional
- **description** (String) The account description.
- **issuer** (String) The OIDC issuer.
- **name** (String) The account name. Defaults to the resource name.
- **subject** (String) The OIDC subject.
- `description` (String) The account description.
- `issuer` (String) The OIDC issuer.
- `name` (String) The account name. Defaults to the resource name.
- `subject` (String) The OIDC subject.
### Read-Only
- **id** (String) The ID of the account.
- `id` (String) The ID of the account.
+35 -7
View File
@@ -10,25 +10,53 @@ description: |-
The account resource allows you to configure a Boundary account.
## Example Usage
```terraform
resource "boundary_scope" "org" {
name = "organization_one"
description = "My first scope!"
scope_id = "global"
auto_create_admin_role = true
auto_create_default_role = true
}
resource "boundary_auth_method" "password" {
scope_id = boundary_scope.org.id
type = "password"
}
resource "boundary_account_password" "jeff" {
auth_method_id = boundary_auth_method.password.id
type = "password"
login_name = "jeff"
password = "$uper$ecure"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- **auth_method_id** (String) The resource ID for the auth method.
- **type** (String) The resource type.
- `auth_method_id` (String) The resource ID for the auth method.
- `type` (String) The resource type.
### Optional
- **description** (String) The account description.
- **login_name** (String, Deprecated) The login name for this account.
- **name** (String) The account name. Defaults to the resource name.
- **password** (String, Deprecated) The account password. Only set on create, changes will not be reflected when updating account.
- `description` (String) The account description.
- `login_name` (String) The login name for this account.
- `name` (String) The account name. Defaults to the resource name.
- `password` (String) The account password. Only set on create, changes will not be reflected when updating account.
### Read-Only
- **id** (String) The ID of the account.
- `id` (String) The ID of the account.
## Import
Import is supported using the following syntax:
```shell
terraform import boundary_account_password.foo <my-id>
```
+7 -7
View File
@@ -32,19 +32,19 @@ resource "boundary_auth_method" "password" {
### Required
- **scope_id** (String) The scope ID.
- **type** (String) The resource type.
- `scope_id` (String) The scope ID.
- `type` (String) The resource type.
### Optional
- **description** (String) The auth method description.
- **min_login_name_length** (Number, Deprecated) The minimum login name length.
- **min_password_length** (Number, Deprecated) The minimum password length.
- **name** (String) The auth method name. Defaults to the resource name.
- `description` (String) The auth method description.
- `min_login_name_length` (Number, Deprecated) The minimum login name length.
- `min_password_length` (Number, Deprecated) The minimum password length.
- `name` (String) The auth method name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the account.
- `id` (String) The ID of the account.
## Import
+20 -20
View File
@@ -17,31 +17,31 @@ The OIDC auth method resource allows you to configure a Boundary auth_method_oid
### Required
- **scope_id** (String) The scope ID.
- `scope_id` (String) The scope ID.
### Optional
- **account_claim_maps** (List of String) Account claim maps for the to_claim of sub.
- **allowed_audiences** (List of String) Audiences for which the provider responses will be allowed
- **api_url_prefix** (String) The API prefix to use when generating callback URLs for the provider. Should be set to an address at which the provider can reach back to the controller.
- **callback_url** (String) The URL that should be provided to the IdP for callbacks.
- **claims_scopes** (List of String) Claims scopes.
- **client_id** (String) The client ID assigned to this auth method from the provider.
- **client_secret** (String) The secret key assigned to this auth method from the provider. Once set, only the hash will be kept and the original value can be removed from configuration.
- **client_secret_hmac** (String) The HMAC of the client secret returned by the Boundary controller, which is used for comparison after initial setting of the value.
- **description** (String) The auth method description.
- **disable_discovered_config_validation** (Boolean) Disables validation logic ensuring that the OIDC provider's information from its discovery endpoint matches the information here. The validation is only performed at create or update time.
- **idp_ca_certs** (List of String) A list of CA certificates to trust when validating the IdP's token signatures.
- **is_primary_for_scope** (Boolean) When true, makes this auth method the primary auth method for the scope in which it resides. The primary auth method for a scope means the the user will be automatically created when they login using an OIDC account.
- **issuer** (String) The issuer corresponding to the provider, which must match the issuer field in generated tokens.
- **max_age** (Number) The max age to provide to the provider, indicating how much time is allowed to have passed since the last authentication before the user is challenged again.
- **name** (String) The auth method name. Defaults to the resource name.
- **signing_algorithms** (List of String) Allowed signing algorithms for the provider's issued tokens.
- **state** (String) Can be one of 'inactive', 'active-private', or 'active-public'. Currently automatically set to active-public.
- **type** (String) The type of auth method; hardcoded.
- `account_claim_maps` (List of String) Account claim maps for the to_claim of sub.
- `allowed_audiences` (List of String) Audiences for which the provider responses will be allowed
- `api_url_prefix` (String) The API prefix to use when generating callback URLs for the provider. Should be set to an address at which the provider can reach back to the controller.
- `callback_url` (String) The URL that should be provided to the IdP for callbacks.
- `claims_scopes` (List of String) Claims scopes.
- `client_id` (String) The client ID assigned to this auth method from the provider.
- `client_secret` (String) The secret key assigned to this auth method from the provider. Once set, only the hash will be kept and the original value can be removed from configuration.
- `client_secret_hmac` (String) The HMAC of the client secret returned by the Boundary controller, which is used for comparison after initial setting of the value.
- `description` (String) The auth method description.
- `disable_discovered_config_validation` (Boolean) Disables validation logic ensuring that the OIDC provider's information from its discovery endpoint matches the information here. The validation is only performed at create or update time.
- `idp_ca_certs` (List of String) A list of CA certificates to trust when validating the IdP's token signatures.
- `is_primary_for_scope` (Boolean) When true, makes this auth method the primary auth method for the scope in which it resides. The primary auth method for a scope means the the user will be automatically created when they login using an OIDC account.
- `issuer` (String) The issuer corresponding to the provider, which must match the issuer field in generated tokens.
- `max_age` (Number) The max age to provide to the provider, indicating how much time is allowed to have passed since the last authentication before the user is challenged again.
- `name` (String) The auth method name. Defaults to the resource name.
- `signing_algorithms` (List of String) Allowed signing algorithms for the provider's issued tokens.
- `state` (String) Can be one of 'inactive', 'active-private', or 'active-public'. Currently automatically set to active-public.
- `type` (String) The type of auth method; hardcoded.
### Read-Only
- **id** (String) The ID of the auth method.
- `id` (String) The ID of the auth method.
+7 -7
View File
@@ -17,18 +17,18 @@ The auth method resource allows you to configure a Boundary auth_method_password
### Required
- **scope_id** (String) The scope ID.
- `scope_id` (String) The scope ID.
### Optional
- **description** (String) The auth method description.
- **min_login_name_length** (Number) The minimum login name length.
- **min_password_length** (Number) The minimum password length.
- **name** (String) The auth method name. Defaults to the resource name.
- **type** (String) The resource type, hardcoded per resource
- `description` (String) The auth method description.
- `min_login_name_length` (Number) The minimum login name length.
- `min_password_length` (Number) The minimum password length.
- `name` (String) The auth method name. Defaults to the resource name.
- `type` (String) The resource type, hardcoded per resource
### Read-Only
- **id** (String) The ID of the account.
- `id` (String) The ID of the account.
+7 -7
View File
@@ -63,19 +63,19 @@ EOT
### Required
- **credential_store_id** (String) The ID of the credential store that this library belongs to.
- **path** (String) The path in Vault to request credentials from.
- `credential_store_id` (String) The ID of the credential store that this library belongs to.
- `path` (String) The path in Vault to request credentials from.
### Optional
- **description** (String) The Vault credential library description.
- **http_method** (String) The HTTP method the library uses when requesting credentials from Vault. Defaults to 'GET'
- **http_request_body** (String) The body of the HTTP request the library sends to Vault when requesting credentials. Only valid if `http_method` is set to `POST`.
- **name** (String) The Vault credential library name. Defaults to the resource name.
- `description` (String) The Vault credential library description.
- `http_method` (String) The HTTP method the library uses when requesting credentials from Vault. Defaults to 'GET'
- `http_request_body` (String) The body of the HTTP request the library sends to Vault when requesting credentials. Only valid if `http_method` is set to `POST`.
- `name` (String) The Vault credential library name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the Vault credential library.
- `id` (String) The ID of the Vault credential library.
## Import
+14 -14
View File
@@ -42,26 +42,26 @@ resource "boundary_credential_store_vault" "example" {
### Required
- **address** (String) The address to Vault server. This should be a complete URL such as 'https://127.0.0.1:8200'
- **scope_id** (String) The scope for this credential store.
- **token** (String, Sensitive) A token used for accessing Vault.
- `address` (String) The address to Vault server. This should be a complete URL such as 'https://127.0.0.1:8200'
- `scope_id` (String) The scope for this credential store.
- `token` (String, Sensitive) A token used for accessing Vault.
### Optional
- **ca_cert** (String) A PEM-encoded CA certificate to verify the Vault server's TLS certificate.
- **client_certificate** (String) A PEM-encoded client certificate to use for TLS authentication to the Vault server.
- **client_certificate_key** (String, Sensitive) A PEM-encoded private key matching the client certificate from 'client_certificate'.
- **description** (String) The Vault credential store description.
- **name** (String) The Vault credential store name. Defaults to the resource name.
- **namespace** (String) The namespace within Vault to use.
- **tls_server_name** (String) Name to use as the SNI host when connecting to Vault via TLS.
- **tls_skip_verify** (Boolean) Whether or not to skip TLS verification.
- `ca_cert` (String) A PEM-encoded CA certificate to verify the Vault server's TLS certificate.
- `client_certificate` (String) A PEM-encoded client certificate to use for TLS authentication to the Vault server.
- `client_certificate_key` (String, Sensitive) A PEM-encoded private key matching the client certificate from 'client_certificate'.
- `description` (String) The Vault credential store description.
- `name` (String) The Vault credential store name. Defaults to the resource name.
- `namespace` (String) The namespace within Vault to use.
- `tls_server_name` (String) Name to use as the SNI host when connecting to Vault via TLS.
- `tls_skip_verify` (Boolean) Whether or not to skip TLS verification.
### Read-Only
- **client_certificate_key_hmac** (String) The Vault client certificate key hmac.
- **id** (String) The ID of the Vault credential store.
- **token_hmac** (String) The Vault token hmac.
- `client_certificate_key_hmac` (String) The Vault client certificate key hmac.
- `id` (String) The ID of the Vault credential store.
- `token_hmac` (String) The Vault token hmac.
## Import
+5 -5
View File
@@ -69,17 +69,17 @@ resource "boundary_group" "example" {
### Required
- **scope_id** (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
- `scope_id` (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
### Optional
- **description** (String) The group description.
- **member_ids** (Set of String) Resource IDs for group members, these are most likely boundary users.
- **name** (String) The group name. Defaults to the resource name.
- `description` (String) The group description.
- `member_ids` (Set of String) Resource IDs for group members, these are most likely boundary users.
- `name` (String) The group name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the group.
- `id` (String) The ID of the group.
## Import
+7 -6
View File
@@ -36,6 +36,7 @@ resource "boundary_host_catalog" "static" {
}
resource "boundary_host" "example" {
type = "static"
name = "example_host"
description = "My first host!"
address = "10.0.0.1"
@@ -48,18 +49,18 @@ resource "boundary_host" "example" {
### Required
- **host_catalog_id** (String)
- **type** (String) The type of host
- `host_catalog_id` (String)
- `type` (String) The type of host
### Optional
- **address** (String) The static address of the host resource as `<IP>` (note: port assignment occurs in the target resource definition, do not add :port here) or a domain name.
- **description** (String) The host description.
- **name** (String) The host name. Defaults to the resource name.
- `address` (String) The static address of the host resource as `<IP>` (note: port assignment occurs in the target resource definition, do not add :port here) or a domain name.
- `description` (String) The host description.
- `name` (String) The host name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the host.
- `id` (String) The ID of the host.
## Import
+5 -5
View File
@@ -41,17 +41,17 @@ resource "boundary_host_catalog" "example" {
### Required
- **scope_id** (String) The scope ID in which the resource is created.
- **type** (String) The host catalog type. Only `static` is supported.
- `scope_id` (String) The scope ID in which the resource is created.
- `type` (String) The host catalog type. Only `static` is supported.
### Optional
- **description** (String) The host catalog description.
- **name** (String) The host catalog name. Defaults to the resource name.
- `description` (String) The host catalog description.
- `name` (String) The host catalog name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the host catalog.
- `id` (String) The ID of the host catalog.
## Import
+12 -12
View File
@@ -17,23 +17,23 @@ The host catalog resource allows you to configure a Boundary plugin-type host ca
### Required
- **scope_id** (String) The scope ID in which the resource is created.
- `scope_id` (String) The scope ID in which the resource is created.
### Optional
- **attributes_json** (String) The attributes for the host catalog. Either values encoded with the "jsonencode" function, pre-escaped JSON string, or a file:// or env:// path. Set to a string "null" or remove the block to clear all attributes in the host catalog.
- **description** (String) The host catalog description.
- **internal_force_update** (String) Internal only. Used to force update so that we can always check the value of secrets.
- **internal_hmac_used_for_secrets_config_hmac** (String) Internal only. The Boundary-provided HMAC used to calculate the current value of the HMAC'd config. Used for drift detection.
- **internal_secrets_config_hmac** (String) Internal only. HMAC of (serverSecretsHmac + config secrets). Used for proper secrets handling.
- **name** (String) The host catalog name. Defaults to the resource name.
- **plugin_id** (String) The ID of the plugin that should back the resource. This or plugin_name must be defined.
- **plugin_name** (String) The name of the plugin that should back the resource. This or plugin_id must be defined.
- **secrets_hmac** (String) The HMAC'd secrets value returned from the server.
- **secrets_json** (String, Sensitive) The secrets for the host catalog. Either values encoded with the "jsonencode" function, pre-escaped JSON string, or a file:// or env:// path. Set to a string "null" to clear any existing values. NOTE: Unlike "attributes_json", removing this block will NOT clear secrets from the host catalog; this allows injecting secrets for one call, then removing them for storage.
- `attributes_json` (String) The attributes for the host catalog. Either values encoded with the "jsonencode" function, pre-escaped JSON string, or a file:// or env:// path. Set to a string "null" or remove the block to clear all attributes in the host catalog.
- `description` (String) The host catalog description.
- `internal_force_update` (String) Internal only. Used to force update so that we can always check the value of secrets.
- `internal_hmac_used_for_secrets_config_hmac` (String) Internal only. The Boundary-provided HMAC used to calculate the current value of the HMAC'd config. Used for drift detection.
- `internal_secrets_config_hmac` (String) Internal only. HMAC of (serverSecretsHmac + config secrets). Used for proper secrets handling.
- `name` (String) The host catalog name. Defaults to the resource name.
- `plugin_id` (String) The ID of the plugin that should back the resource. This or plugin_name must be defined.
- `plugin_name` (String) The name of the plugin that should back the resource. This or plugin_id must be defined.
- `secrets_hmac` (String) The HMAC'd secrets value returned from the server.
- `secrets_json` (String, Sensitive) The secrets for the host catalog. Either values encoded with the "jsonencode" function, pre-escaped JSON string, or a file:// or env:// path. Set to a string "null" to clear any existing values. NOTE: Unlike "attributes_json", removing this block will NOT clear secrets from the host catalog; this allows injecting secrets for one call, then removing them for storage.
### Read-Only
- **id** (String) The ID of the host catalog.
- `id` (String) The ID of the host catalog.
+4 -4
View File
@@ -17,15 +17,15 @@ The static host catalog resource allows you to configure a Boundary static-type
### Required
- **scope_id** (String) The scope ID in which the resource is created.
- `scope_id` (String) The scope ID in which the resource is created.
### Optional
- **description** (String) The host catalog description.
- **name** (String) The host catalog name. Defaults to the resource name.
- `description` (String) The host catalog description.
- `name` (String) The host catalog name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the host catalog.
- `id` (String) The ID of the host catalog.
+13 -10
View File
@@ -29,10 +29,12 @@ resource "boundary_scope" "project" {
}
resource "boundary_host_catalog" "static" {
type = "static"
scope_id = boundary_scope.project.id
}
resource "boundary_host" "1" {
resource "boundary_host" "first" {
type = "static"
name = "host_1"
description = "My first host!"
address = "10.0.0.1"
@@ -40,7 +42,8 @@ resource "boundary_host" "1" {
scope_id = boundary_scope.project.id
}
resource "boundary_host" "2" {
resource "boundary_host" "second" {
type = "static"
name = "host_2"
description = "My second host!"
address = "10.0.0.2"
@@ -52,8 +55,8 @@ 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,
boundary_host.first.id,
boundary_host.second.id,
]
}
```
@@ -63,18 +66,18 @@ resource "boundary_host_set" "web" {
### Required
- **host_catalog_id** (String) The catalog for the host set.
- **type** (String) The type of host set
- `host_catalog_id` (String) The catalog for the host set.
- `type` (String) The type of host set
### Optional
- **description** (String) The host set description.
- **host_ids** (Set of String) The list of host IDs contained in this set.
- **name** (String) The host set name. Defaults to the resource name.
- `description` (String) The host set description.
- `host_ids` (Set of String) The list of host IDs contained in this set.
- `name` (String) The host set name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the host set.
- `id` (String) The ID of the host set.
## Import
+8 -8
View File
@@ -17,19 +17,19 @@ The host_set_plugin resource allows you to configure a Boundary host set. Host s
### Required
- **host_catalog_id** (String) The catalog for the host set.
- `host_catalog_id` (String) The catalog for the host set.
### Optional
- **attributes_json** (String) The attributes for the host set. Either values encoded with the "jsonencode" function, pre-escaped JSON string, or a file:// or env:// path. Set to a string "null" or remove the block to clear all attributes in the host set.
- **description** (String) The host set description.
- **name** (String) The host set name. Defaults to the resource name.
- **preferred_endpoints** (List of String) The ordered list of preferred endpoints.
- **sync_interval_seconds** (Number) The value to set for the sync interval seconds.
- **type** (String) The type of host set
- `attributes_json` (String) The attributes for the host set. Either values encoded with the "jsonencode" function, pre-escaped JSON string, or a file:// or env:// path. Set to a string "null" or remove the block to clear all attributes in the host set.
- `description` (String) The host set description.
- `name` (String) The host set name. Defaults to the resource name.
- `preferred_endpoints` (List of String) The ordered list of preferred endpoints.
- `sync_interval_seconds` (Number) The value to set for the sync interval seconds.
- `type` (String) The type of host set
### Read-Only
- **id** (String) The ID of the host set.
- `id` (String) The ID of the host set.
+6 -6
View File
@@ -17,17 +17,17 @@ The host_set_static resource allows you to configure a Boundary host set. Host s
### Required
- **host_catalog_id** (String) The catalog for the host set.
- `host_catalog_id` (String) The catalog for the host set.
### Optional
- **description** (String) The host set description.
- **host_ids** (Set of String) The list of host IDs contained in this set.
- **name** (String) The host set name. Defaults to the resource name.
- **type** (String) The type of host set
- `description` (String) The host set description.
- `host_ids` (Set of String) The list of host IDs contained in this set.
- `name` (String) The host set name. Defaults to the resource name.
- `type` (String) The type of host set
### Read-Only
- **id** (String) The ID of the host set.
- `id` (String) The ID of the host set.
+6 -6
View File
@@ -17,17 +17,17 @@ The static host resource allows you to configure a Boundary static host. Hosts a
### Required
- **host_catalog_id** (String)
- `host_catalog_id` (String)
### Optional
- **address** (String) The static address of the host resource as `<IP>` (note: port assignment occurs in the target resource definition, do not add :port here) or a domain name.
- **description** (String) The host description.
- **name** (String) The host name. Defaults to the resource name.
- **type** (String) The type of host
- `address` (String) The static address of the host resource as `<IP>` (note: port assignment occurs in the target resource definition, do not add :port here) or a domain name.
- `description` (String) The host description.
- `name` (String) The host name. Defaults to the resource name.
- `type` (String) The type of host
### Read-Only
- **id** (String) The ID of the host.
- `id` (String) The ID of the host.
+5 -5
View File
@@ -17,16 +17,16 @@ The managed group resource allows you to configure a Boundary group.
### Required
- **auth_method_id** (String) The resource ID for the auth method.
- **filter** (String) Boolean expression to filter the workers for this managed group.
- `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.
- `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.
- `id` (String) The ID of the group.
+8 -8
View File
@@ -122,20 +122,20 @@ resource "boundary_role" "readonly" {
### Required
- **scope_id** (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
- `scope_id` (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
### Optional
- **default_role** (Boolean) Indicates that the role containing this value is the default role (that is, has the id 'r_default'), which triggers some specialized behavior to allow it to be imported and managed.
- **description** (String) The role description.
- **grant_scope_id** (String)
- **grant_strings** (Set of String) A list of stringified grants for the role.
- **name** (String) The role name. Defaults to the resource name.
- **principal_ids** (Set of String) A list of principal (user or group) IDs to add as principals on the role.
- `default_role` (Boolean) Indicates that the role containing this value is the default role (that is, has the id 'r_default'), which triggers some specialized behavior to allow it to be imported and managed.
- `description` (String) The role description.
- `grant_scope_id` (String)
- `grant_strings` (Set of String) A list of stringified grants for the role.
- `name` (String) The role name. Defaults to the resource name.
- `principal_ids` (Set of String) A list of principal (user or group) IDs to add as principals on the role.
### Read-Only
- **id** (String) The ID of the role.
- `id` (String) The ID of the role.
## Import
+7 -7
View File
@@ -65,19 +65,19 @@ resource "boundary_role" "org_admin" {
### Required
- **scope_id** (String) The scope ID containing the sub scope resource.
- `scope_id` (String) The scope ID containing the sub scope resource.
### Optional
- **auto_create_admin_role** (Boolean) If set, when a new scope is created, the provider will not disable the functionality that automatically creates a role in the new scope and gives permissions to manage the scope to the provider's user. Marking this true makes for simpler HCL but results in role resources that are unmanaged by Terraform.
- **auto_create_default_role** (Boolean) Only relevant when creating an org scope. If set, when a new scope is created, the provider will not disable the functionality that automatically creates a role in the new scope and gives listing of scopes and auth methods and the ability to authenticate to the anonymous user. Marking this true makes for simpler HCL but results in role resources that are unmanaged by Terraform.
- **description** (String) The scope description.
- **global_scope** (Boolean) Indicates that the scope containing this value is the global scope, which triggers some specialized behavior to allow it to be imported and managed.
- **name** (String) The scope name. Defaults to the resource name.
- `auto_create_admin_role` (Boolean) If set, when a new scope is created, the provider will not disable the functionality that automatically creates a role in the new scope and gives permissions to manage the scope to the provider's user. Marking this true makes for simpler HCL but results in role resources that are unmanaged by Terraform.
- `auto_create_default_role` (Boolean) Only relevant when creating an org scope. If set, when a new scope is created, the provider will not disable the functionality that automatically creates a role in the new scope and gives listing of scopes and auth methods and the ability to authenticate to the anonymous user. Marking this true makes for simpler HCL but results in role resources that are unmanaged by Terraform.
- `description` (String) The scope description.
- `global_scope` (Boolean) Indicates that the scope containing this value is the global scope, which triggers some specialized behavior to allow it to be imported and managed.
- `name` (String) The scope name. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the scope.
- `id` (String) The ID of the scope.
## Import
+14 -11
View File
@@ -57,6 +57,7 @@ resource "boundary_host_catalog" "foo" {
}
resource "boundary_host" "foo" {
type = "static"
name = "foo"
host_catalog_id = boundary_host_catalog.foo.id
scope_id = boundary_scope.project.id
@@ -64,6 +65,7 @@ resource "boundary_host" "foo" {
}
resource "boundary_host" "bar" {
type = "static"
name = "bar"
host_catalog_id = boundary_host_catalog.foo.id
scope_id = boundary_scope.project.id
@@ -71,6 +73,7 @@ resource "boundary_host" "bar" {
}
resource "boundary_host_set" "foo" {
type = "static"
name = "foo"
host_catalog_id = boundary_host_catalog.foo.id
@@ -100,23 +103,23 @@ resource "boundary_target" "foo" {
### Required
- **scope_id** (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
- **type** (String) The target resource type.
- `scope_id` (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
- `type` (String) The target resource type.
### Optional
- **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_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)
- **worker_filter** (String) Boolean expression to filter the workers for this target
- `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_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)
- `worker_filter` (String) Boolean expression to filter the workers for this target
### Read-Only
- **id** (String) The ID of the target.
- `id` (String) The ID of the target.
## Import
+7 -7
View File
@@ -26,7 +26,7 @@ resource "boundary_auth_method" "password" {
type = "password"
}
resource "boundary_account" "jeff" {
resource "boundary_account_password" "jeff" {
auth_method_id = boundary_auth_method.password.id
type = "password"
login_name = "jeff"
@@ -36,7 +36,7 @@ resource "boundary_account" "jeff" {
resource "boundary_user" "jeff" {
name = "jeff"
description = "Jeff's user resource"
account_ids = [boundary_account.jeff.id]
account_ids = [boundary_account_password.jeff.id]
scope_id = boundary_scope.org.id
}
```
@@ -46,17 +46,17 @@ resource "boundary_user" "jeff" {
### Required
- **scope_id** (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
- `scope_id` (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
### Optional
- **account_ids** (Set of String) Account ID's to associate with this user resource.
- **description** (String) The user description.
- **name** (String) The username. Defaults to the resource name.
- `account_ids` (Set of String) Account ID's to associate with this user resource.
- `description` (String) The user description.
- `name` (String) The username. Defaults to the resource name.
### Read-Only
- **id** (String) The ID of the user.
- `id` (String) The ID of the user.
## Import
@@ -1 +0,0 @@
terraform import boundary_account.foo <my-id>
@@ -0,0 +1 @@
terraform import boundary_account_password.foo <my-id>
@@ -11,7 +11,7 @@ resource "boundary_auth_method" "password" {
type = "password"
}
resource "boundary_account" "jeff" {
resource "boundary_account_password" "jeff" {
auth_method_id = boundary_auth_method.password.id
type = "password"
login_name = "jeff"
@@ -21,6 +21,7 @@ resource "boundary_host_catalog" "static" {
}
resource "boundary_host" "example" {
type = "static"
name = "example_host"
description = "My first host!"
address = "10.0.0.1"
@@ -14,10 +14,12 @@ resource "boundary_scope" "project" {
}
resource "boundary_host_catalog" "static" {
type = "static"
scope_id = boundary_scope.project.id
}
resource "boundary_host" "1" {
resource "boundary_host" "first" {
type = "static"
name = "host_1"
description = "My first host!"
address = "10.0.0.1"
@@ -25,7 +27,8 @@ resource "boundary_host" "1" {
scope_id = boundary_scope.project.id
}
resource "boundary_host" "2" {
resource "boundary_host" "second" {
type = "static"
name = "host_2"
description = "My second host!"
address = "10.0.0.2"
@@ -37,7 +40,7 @@ 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,
boundary_host.first.id,
boundary_host.second.id,
]
}
@@ -42,6 +42,7 @@ resource "boundary_host_catalog" "foo" {
}
resource "boundary_host" "foo" {
type = "static"
name = "foo"
host_catalog_id = boundary_host_catalog.foo.id
scope_id = boundary_scope.project.id
@@ -49,6 +50,7 @@ resource "boundary_host" "foo" {
}
resource "boundary_host" "bar" {
type = "static"
name = "bar"
host_catalog_id = boundary_host_catalog.foo.id
scope_id = boundary_scope.project.id
@@ -56,6 +58,7 @@ resource "boundary_host" "bar" {
}
resource "boundary_host_set" "foo" {
type = "static"
name = "foo"
host_catalog_id = boundary_host_catalog.foo.id
+2 -2
View File
@@ -11,7 +11,7 @@ resource "boundary_auth_method" "password" {
type = "password"
}
resource "boundary_account" "jeff" {
resource "boundary_account_password" "jeff" {
auth_method_id = boundary_auth_method.password.id
type = "password"
login_name = "jeff"
@@ -21,6 +21,6 @@ resource "boundary_account" "jeff" {
resource "boundary_user" "jeff" {
name = "jeff"
description = "Jeff's user resource"
account_ids = [boundary_account.jeff.id]
account_ids = [boundary_account_password.jeff.id]
scope_id = boundary_scope.org.id
}
+64 -89
View File
@@ -3,120 +3,102 @@ module github.com/hashicorp/terraform-provider-boundary
go 1.17
require (
github.com/hashicorp/boundary v0.7.4
github.com/hashicorp/boundary/api v0.0.21
github.com/hashicorp/boundary/sdk v0.0.13
github.com/hashicorp/cap v0.1.1
github.com/hashicorp/boundary v0.8.1
github.com/hashicorp/boundary/api v0.0.24
github.com/hashicorp/boundary/sdk v0.0.15
github.com/hashicorp/cap v0.2.0
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
github.com/hashicorp/go-kms-wrapping v0.6.8
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.2
github.com/hashicorp/terraform-plugin-docs v0.5.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.5
github.com/hashicorp/go-secure-stdlib/configutil/v2 v2.0.3
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.5
github.com/hashicorp/go-secure-stdlib/pluginutil/v2 v2.0.1
github.com/hashicorp/terraform-plugin-docs v0.8.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.16.0
github.com/kr/pretty v0.3.0
github.com/mitchellh/go-homedir v1.1.0
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3
github.com/stretchr/testify v1.7.1
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29
)
require (
cloud.google.com/go v0.81.0 // indirect
cloud.google.com/go/storage v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go v58.0.0+incompatible // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.21 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.14 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.8 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.2 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.0 // indirect
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190620160927-9418d7b0cd0f // indirect
github.com/apparentlymart/go-textseg v1.0.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/armon/go-metrics v0.3.9 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.40.55 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/containerd/containerd v1.4.3 // indirect
github.com/containerd/continuity v0.0.0-20200709052629-daa8e1ccc0bc // indirect
github.com/coreos/go-oidc/v3 v3.0.0 // indirect
github.com/danieljoos/wincred v1.1.0 // indirect
github.com/coreos/go-oidc/v3 v3.1.0 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/docker/cli v20.10.7+incompatible // indirect
github.com/docker/docker v20.10.7+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
github.com/godbus/dbus/v5 v5.0.4 // indirect
github.com/godbus/dbus/v5 v5.0.6 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-migrate/migrate/v4 v4.14.1 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0 // indirect
github.com/hashicorp/dbassert v0.0.0-20210708202608-ecf920cf1ed8 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/eventlogger v0.1.1-0.20211106154408-4ff8da3a890c // indirect
github.com/hashicorp/eventlogger/filters/encrypt v0.1.6-0.20211027211326-5db60a48f239 // indirect
github.com/hashicorp/eventlogger/filters/encrypt v0.1.7 // indirect
github.com/hashicorp/go-bexpr v0.1.10 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-dbw v0.0.0-20211215222256-2ff0d37184ff // indirect
github.com/hashicorp/go-getter v1.5.3 // indirect
github.com/hashicorp/go-hclog v1.0.0 // indirect
github.com/hashicorp/go-immutable-radix v1.1.0 // indirect
github.com/hashicorp/go-hclog v1.2.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-kms-wrapping/plugin/v2 v2.0.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.1 // indirect
github.com/hashicorp/go-plugin v1.4.3 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-secure-stdlib/awsutil v0.1.6 // indirect
github.com/hashicorp/go-secure-stdlib/base62 v0.1.2 // indirect
github.com/hashicorp/go-secure-stdlib/configutil v0.1.2 // indirect
github.com/hashicorp/go-secure-stdlib/gatedwriter v0.1.1 // indirect
github.com/hashicorp/go-secure-stdlib/kv-builder v0.1.1 // indirect
github.com/hashicorp/go-secure-stdlib/listenerutil v0.1.3-0.20211129134915-8f7e6fb52622 // indirect
github.com/hashicorp/go-secure-stdlib/listenerutil v0.1.4 // indirect
github.com/hashicorp/go-secure-stdlib/mlock v0.1.1 // indirect
github.com/hashicorp/go-secure-stdlib/reloadutil v0.1.1 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.1 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/hashicorp/hc-install v0.3.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.4.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hc-install v0.3.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.3.0 // indirect
github.com/hashicorp/hcl/v2 v2.12.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.15.0 // indirect
github.com/hashicorp/terraform-exec v0.16.1 // indirect
github.com/hashicorp/terraform-json v0.13.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.5.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.2.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.9.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.4.0 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/vault/api v1.1.1 // indirect
github.com/hashicorp/vault/sdk v0.2.1 // indirect
github.com/hashicorp/vault/api v1.3.1 // indirect
github.com/hashicorp/vault/sdk v0.3.0 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.12 // indirect
@@ -128,76 +110,69 @@ require (
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.9.0 // indirect
github.com/jackc/pgx/v4 v4.14.0 // indirect
github.com/jefferai/go-libsecret v0.0.0-20210105015933-d08a58b018bc // indirect
github.com/jefferai/go-libsecret v0.0.0-20210525195240-b53481abef97 // indirect
github.com/jefferai/isbadcipher v0.0.0-20190226160619-51d2077c035f // indirect
github.com/jefferai/keyring v1.1.7-0.20210105022822-8749b3d9ce79 // indirect
github.com/jefferai/keyring v1.1.7-0.20220316160357-58a74bb55891 // indirect
github.com/jinzhu/gorm v1.9.12 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.3 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
github.com/klauspost/compress v1.13.5 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.2 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v2.0.1+incompatible // indirect
github.com/mitchellh/cli v1.1.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/cli v1.1.3 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v1.0.0-rc9 // indirect
github.com/oracle/oci-go-sdk v13.1.0+incompatible // indirect
github.com/ory/dockertest/v3 v3.7.0 // indirect
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/pires/go-proxyproto v0.6.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/rogpeppe/go-internal v1.8.1-0.20211023094830-115ce09fd6b4 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/xo/dburl v0.9.0 // indirect
github.com/zalando/go-keyring v0.1.1 // indirect
github.com/zalando/go-keyring v0.2.1 // indirect
github.com/zclconf/go-cty v1.10.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/term v0.0.0-20210916214954-140adaaadfaf // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
golang.org/x/tools v0.1.8-0.20211102182255-bb4add04ddef // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/api v0.44.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 // indirect
google.golang.org/grpc v1.41.0-dev.0.20210907181116-2f3355d2244e // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e // indirect
google.golang.org/grpc v1.45.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gorm.io/driver/postgres v1.2.2 // indirect
+161 -365
View File
File diff suppressed because it is too large. Load diff
+9 -5
View File
@@ -8,8 +8,11 @@ import (
"github.com/hashicorp/boundary/api"
"github.com/hashicorp/boundary/api/authmethods"
kms_plugin_assets "github.com/hashicorp/boundary/plugins/kms"
"github.com/hashicorp/boundary/sdk/wrapper"
wrapping "github.com/hashicorp/go-kms-wrapping"
wrapping "github.com/hashicorp/go-kms-wrapping/v2"
"github.com/hashicorp/go-secure-stdlib/configutil/v2"
"github.com/hashicorp/go-secure-stdlib/pluginutil/v2"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
@@ -109,16 +112,17 @@ func providerAuthenticate(ctx context.Context, d *schema.ResourceData, md *metaD
if err != nil {
return fmt.Errorf(`error reading data from "recovery_kms_hcl": %v`, err)
}
wrapper, err := wrapper.GetWrapperFromHcl(recoveryHclStr, "recovery")
wrapper, _, err := wrapper.GetWrapperFromHcl(ctx, recoveryHclStr, "recovery",
configutil.WithPluginOptions(
pluginutil.WithPluginsMap(kms_plugin_assets.BuiltinKmsPlugins()),
pluginutil.WithPluginsFilesystem(kms_plugin_assets.KmsPluginPrefix, kms_plugin_assets.FileSystem()),
))
if err != nil {
return fmt.Errorf(`error reading wrappers from "recovery_kms_hcl": %v`, err)
}
if wrapper == nil {
return errors.New(`No "kms" block with purpose "recovery" found in "recovery_kms_hcl"`)
}
if err := wrapper.Init(ctx); err != nil {
return fmt.Errorf("error initializing recovery kms: %v", err)
}
md.recoveryKmsWrapper = wrapper
md.client.SetRecoveryKmsWrapper(wrapper)
+7 -8
View File
@@ -1,6 +1,7 @@
package provider
import (
"context"
"crypto/rand"
"encoding/base64"
"fmt"
@@ -8,8 +9,8 @@ import (
"testing"
"github.com/hashicorp/boundary/testing/controller"
wrapping "github.com/hashicorp/go-kms-wrapping"
"github.com/hashicorp/go-kms-wrapping/wrappers/aead"
wrapping "github.com/hashicorp/go-kms-wrapping/v2"
"github.com/hashicorp/go-kms-wrapping/v2/aead"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
@@ -36,7 +37,7 @@ func providerFactories(p **schema.Provider) map[string]func() (*schema.Provider,
}
}
func testWrapper(t *testing.T, key string) wrapping.Wrapper {
func testWrapper(ctx context.Context, t *testing.T, key string) wrapping.Wrapper {
var keyBytes []byte
switch key {
case "":
@@ -56,15 +57,13 @@ func testWrapper(t *testing.T, key string) wrapping.Wrapper {
t.Fatal(err)
}
}
wrapper := aead.NewWrapper(nil)
wrapper := aead.NewWrapper()
_, err := wrapper.SetConfig(map[string]string{
"key_id": key,
})
_, err := wrapper.SetConfig(ctx, wrapping.WithKeyId(key))
if err != nil {
t.Fatal(err)
}
if err := wrapper.SetAESGCMKeyBytes(keyBytes); err != nil {
if err := wrapper.SetAesGcmKeyBytes(keyBytes); err != nil {
t.Fatal(err)
}
return wrapper
+2 -7
View File
@@ -12,7 +12,8 @@ import (
func resourceAccount() *schema.Resource {
return &schema.Resource{
Description: "The account resource allows you to configure a Boundary account.",
DeprecationMessage: "Deprecated: use `resource_account_password` instead.",
Description: "Deprecated: use `resource_account_password` instead.",
CreateContext: resourceAccountCreate,
ReadContext: resourceAccountRead,
@@ -54,13 +55,11 @@ func resourceAccount() *schema.Resource {
Description: "The login name for this account.",
Type: schema.TypeString,
Optional: true,
Deprecated: "Will be removed in favor of using attributes parameter",
},
accountPasswordKey: {
Description: "The account password. Only set on create, changes will not be reflected when updating account.",
Type: schema.TypeString,
Optional: true,
Deprecated: "Will be removed in favor of using attributes parameter",
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
if d.Id() == "" {
@@ -88,7 +87,6 @@ func setFromAccountResponseMap(d *schema.ResourceData, raw map[string]interface{
return err
}
// TODO(malnick) - remove after deprecation cycle in favor of attributes
switch raw["type"].(string) {
case accountTypePassword:
if attrsVal, ok := raw["attributes"]; ok {
@@ -123,12 +121,10 @@ func resourceAccountCreate(ctx context.Context, d *schema.ResourceData, meta int
opts = append(opts, accounts.WithDescription(descVal.(string)))
}
// TODO(malnick) - remove after deprecation cycle
if name, ok := d.GetOk(accountLoginNameKey); ok {
opts = append(opts, accounts.WithPasswordAccountLoginName(name.(string)))
}
// TODO(malnick) - remove after deprecation cycle
if pass, ok := d.GetOk(accountPasswordKey); ok {
opts = append(opts, accounts.WithPasswordAccountPassword(pass.(string)))
}
@@ -195,7 +191,6 @@ func resourceAccountUpdate(ctx context.Context, d *schema.ResourceData, meta int
}
}
// TODO(malnick) - remove after deprecation cycle
if d.HasChange(accountLoginNameKey) {
opts = append(opts, accounts.DefaultPasswordAccountLoginName())
if keyVal, ok := d.GetOk(accountLoginNameKey); ok {
+5 -2
View File
@@ -70,8 +70,11 @@ func setFromAccountOidcResponseMap(d *schema.ResourceData, raw map[string]interf
d.Set(NameKey, raw["name"])
d.Set(DescriptionKey, raw["description"])
d.Set(AuthMethodIdKey, raw["auth_method_id"])
d.Set(accountOidcIssuerKey, raw["issuer"])
d.Set(accountOidcSubjectKey, raw["subject"])
if attrsVal, ok := raw["attributes"]; ok {
attrs := attrsVal.(map[string]interface{})
d.Set(accountOidcIssuerKey, attrs["issuer"])
d.Set(accountOidcSubjectKey, attrs["subject"])
}
d.SetId(raw["id"].(string))
}
@@ -60,13 +60,11 @@ func resourceAccountPassword() *schema.Resource {
Description: "The login name for this account.",
Type: schema.TypeString,
Optional: true,
Deprecated: "Will be removed in favor of using attributes parameter",
},
accountPasswordKey: {
Description: "The account password. Only set on create, changes will not be reflected when updating account.",
Type: schema.TypeString,
Optional: true,
Deprecated: "Will be removed in favor of using attributes parameter",
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
if d.Id() == "" {
@@ -9,6 +9,7 @@ import (
"github.com/hashicorp/boundary/api/authmethods"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
func resourceAuthMethod() *schema.Resource {
@@ -50,6 +51,10 @@ func resourceAuthMethod() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
authmethodTypeOidc,
authmethodTypePassword,
}, false),
},
authmethodMinLoginNameLengthKey: {
Description: "The minimum login name length.",
+2 -1
View File
@@ -114,7 +114,7 @@ resource "boundary_group" "proj1" {
// NOTE: this test also tests out the recovery KMS mechanism.
func TestAccGroup(t *testing.T) {
wrapper := testWrapper(t, tcRecoveryKey)
wrapper := testWrapper(context.Background(), t, tcRecoveryKey)
tc := controller.NewTestController(t, append(tcConfig, controller.WithRecoveryKms(wrapper))...)
defer tc.Shutdown()
@@ -122,6 +122,7 @@ func TestAccGroup(t *testing.T) {
var provider *schema.Provider
resource.Test(t, resource.TestCase{
IsUnitTest: true,
ProviderFactories: providerFactories(&provider),
CheckDestroy: testAccCheckGroupResourceDestroy(t, provider),
Steps: []resource.TestStep{
@@ -41,7 +41,7 @@ resource "boundary_managed_group" "foo" {
)
func TestAccManagedGroup(t *testing.T) {
wrapper := testWrapper(t, tcRecoveryKey)
wrapper := testWrapper(context.Background(), t, tcRecoveryKey)
tp := oidc.StartTestProvider(t)
tc := controller.NewTestController(t, append(tcConfig, controller.WithRecoveryKms(wrapper))...)
+28 -22
View File
@@ -164,33 +164,36 @@ func resourceRoleCreate(ctx context.Context, d *schema.ResourceData, meta interf
}
raw := tcr.GetResponse().Map
var diags diag.Diagnostics
if principalIds != nil {
tspr, err := rc.SetPrincipals(ctx, tcr.Item.Id, 0, principalIds, roles.WithAutomaticVersioning(true))
if err != nil {
return diag.Errorf("error setting principal IDs on role: %v", err)
switch {
case err != nil:
diags = append(diags, diag.Diagnostic{Severity: diag.Error, Summary: "error setting principals", Detail: err.Error()})
case tspr == nil:
diags = append(diags, diag.Diagnostic{Severity: diag.Error, Summary: "nil role after setting principal IDs"})
default:
raw = tspr.GetResponse().Map
}
if tspr == nil {
return diag.Errorf("nil role after setting principal IDs")
}
raw = tspr.GetResponse().Map
}
if grantStrings != nil {
tsgr, err := rc.SetGrants(ctx, tcr.Item.Id, 0, grantStrings, roles.WithAutomaticVersioning(true))
if err != nil {
return diag.Errorf("error setting grant strings on role: %v", err)
switch {
case err != nil:
diags = append(diags, diag.Diagnostic{Severity: diag.Error, Summary: "error setting grants", Detail: err.Error()})
case tsgr == nil:
diags = append(diags, diag.Diagnostic{Severity: diag.Error, Summary: "nil role after setting grant strings"})
default:
raw = tsgr.GetResponse().Map
}
if tsgr == nil {
return diag.Errorf("nil role after setting grant strings")
}
raw = tsgr.GetResponse().Map
}
if err := setFromRoleResponseMap(d, raw); err != nil {
return diag.FromErr(err)
}
return nil
return diags
}
func resourceRoleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
@@ -279,6 +282,7 @@ func resourceRoleUpdate(ctx context.Context, d *schema.ResourceData, meta interf
}
}
var diags diag.Diagnostics
if d.HasChange(roleGrantStringsKey) {
var grantStrings []string
if grantStringsVal, ok := d.GetOk(roleGrantStringsKey); ok {
@@ -289,10 +293,11 @@ func resourceRoleUpdate(ctx context.Context, d *schema.ResourceData, meta interf
}
_, err := rc.SetGrants(ctx, d.Id(), 0, grantStrings, roles.WithAutomaticVersioning(true))
if err != nil {
return diag.Errorf("error updating grant strings on role: %v", err)
}
if err := d.Set(roleGrantStringsKey, grantStrings); err != nil {
return diag.FromErr(err)
diags = append(diags, diag.Diagnostic{Severity: diag.Error, Summary: "error setting grants", Detail: err.Error()})
} else {
if err := d.Set(roleGrantStringsKey, grantStrings); err != nil {
return diag.FromErr(err)
}
}
}
@@ -306,14 +311,15 @@ func resourceRoleUpdate(ctx context.Context, d *schema.ResourceData, meta interf
}
_, err := rc.SetPrincipals(ctx, d.Id(), 0, principalIds, roles.WithAutomaticVersioning(true))
if err != nil {
return diag.Errorf("error updating grant strings on role: %v", err)
}
if err := d.Set(rolePrincipalIdsKey, principalIds); err != nil {
return diag.FromErr(err)
diags = append(diags, diag.Diagnostic{Severity: diag.Error, Summary: "error setting principals", Detail: err.Error()})
} else {
if err := d.Set(rolePrincipalIdsKey, principalIds); err != nil {
return diag.FromErr(err)
}
}
}
return nil
return diags
}
func resourceRoleDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+107 -23
View File
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/http"
"regexp"
"strings"
"testing"
@@ -54,13 +55,23 @@ resource "boundary_role" "foo" {
depends_on = [boundary_role.proj1_admin]
}`, fooRoleDescriptionUpdate)
projRoleWithPrincipal = `
fooUser = `
resource "boundary_user" "foo" {
name = "foo"
scope_id = boundary_scope.org1.id
depends_on = [boundary_role.org1_admin]
}
`
barUser = `
resource "boundary_user" "bar" {
name = "bar"
scope_id = boundary_scope.org1.id
depends_on = [boundary_role.org1_admin]
}
`
projRoleWithPrincipal = `
resource "boundary_role" "with_principal" {
name = "with_principal"
description = "with principal"
@@ -69,27 +80,33 @@ resource "boundary_role" "with_principal" {
depends_on = [boundary_role.proj1_admin]
}`
projRoleWithPrincipalUpdate = `
resource "boundary_user" "foo" {
name = "foo"
scope_id = boundary_scope.org1.id
depends_on = [boundary_role.org1_admin]
}
resource "boundary_user" "bar" {
name = "bar"
scope_id = boundary_scope.org1.id
depends_on = [boundary_role.org1_admin]
}
projRoleWithInvalidPrincipal = `
resource "boundary_role" "with_principal" {
name = "with_principal"
description = "with principal"
principal_ids = ["u_fakeuser"]
scope_id = boundary_scope.proj1.id
depends_on = [boundary_role.proj1_admin]
}`
projRoleWithPrincipalUpdate = `
resource "boundary_role" "with_principal" {
name = "with_principal_update"
description = "with principal update"
principal_ids = [boundary_user.foo.id, boundary_user.bar.id]
scope_id = boundary_scope.proj1.id
depends_on = [boundary_role.proj1_admin]
}`
projRoleWithInvalidPrincipalUpdate = `
resource "boundary_role" "with_principal" {
name = "with_principal_update"
description = "with principal update"
principal_ids = [boundary_user.foo.id, "u_fakeuser"]
scope_id = boundary_scope.proj1.id
depends_on = [boundary_role.proj1_admin]
}`
projRoleWithGroups = `
resource "boundary_group" "foo" {
name = "foo"
@@ -128,6 +145,7 @@ resource "boundary_role" "with_groups" {
readonlyGrant = "id=*;type=*;actions=read"
readonlyGrantUpdate = "id=*;type=*;actions=read,create"
invalidGrant = "id=*;type=*;actions=badaction"
projRoleWithGrants = fmt.Sprintf(`
resource "boundary_role" "with_grants" {
@@ -138,10 +156,28 @@ resource "boundary_role" "with_grants" {
depends_on = [boundary_role.proj1_admin]
}`, readonlyGrant)
projRoleWithGrantsUpdate = fmt.Sprintf(`
projRoleWithInvalidGrants = fmt.Sprintf(`
resource "boundary_role" "with_grants" {
name = "with_grants"
description = "with grants"
grant_strings = ["%s"]
scope_id = boundary_scope.proj1.id
depends_on = [boundary_role.proj1_admin]
}`, invalidGrant)
projRoleWithInvalidGrantsUpdate = fmt.Sprintf(`
resource "boundary_role" "with_grants" {
name = "with_grants_update"
description = "with grants update"
grant_strings = ["%s", "%s"]
scope_id = boundary_scope.proj1.id
depends_on = [boundary_role.proj1_admin]
}`, readonlyGrant, invalidGrant)
projRoleWithGrantsUpdate = fmt.Sprintf(`
resource "boundary_role" "with_grants" {
name = "with_grants_update"
description = "with grants update"
grant_strings = ["%s", "%s"]
scope_id = boundary_scope.proj1.id
depends_on = [boundary_role.proj1_admin]
@@ -209,11 +245,23 @@ func TestAccRoleWithGrants(t *testing.T) {
var provider *schema.Provider
resource.Test(t, resource.TestCase{
IsUnitTest: true,
ProviderFactories: providerFactories(&provider),
CheckDestroy: testAccCheckRoleResourceDestroy(t, provider),
Steps: []resource.TestStep{
{
// test project role create with grants
// Create should return error due to invalid grant, however the role will still
// be created and should be set in state.
Config: testConfig(url, fooOrg, firstProjectFoo, projRoleWithInvalidGrants),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists(provider, "boundary_role.with_grants"),
resource.TestCheckResourceAttr("boundary_role.with_grants", "name", "with_grants"),
resource.TestCheckResourceAttr("boundary_role.with_grants", "description", "with grants"),
),
ExpectError: regexp.MustCompile(`Improperly`),
},
{
// Create again with valid grants should succeed
Config: testConfig(url, fooOrg, firstProjectFoo, projRoleWithGrants),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists(provider, "boundary_role.with_grants"),
@@ -224,13 +272,24 @@ func TestAccRoleWithGrants(t *testing.T) {
},
importStep("boundary_role.with_grants"),
{
// test project role update with grants
// Update should return error due to invalid grant, however the role will still
// be updated and should be set in state.
Config: testConfig(url, fooOrg, firstProjectFoo, projRoleWithInvalidGrantsUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists(provider, "boundary_role.with_grants"),
resource.TestCheckResourceAttr("boundary_role.with_grants", "name", "with_grants_update"),
resource.TestCheckResourceAttr("boundary_role.with_grants", "description", "with grants update"),
),
ExpectError: regexp.MustCompile(`Improperly`),
},
{
// Update should now succeed
Config: testConfig(url, fooOrg, firstProjectFoo, projRoleWithGrantsUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists(provider, "boundary_role.with_grants"),
testAccCheckRoleResourceGrantsSet(provider, "boundary_role.with_grants", []string{readonlyGrant, readonlyGrantUpdate}),
resource.TestCheckResourceAttr("boundary_role.with_grants", "name", "with_grants"),
resource.TestCheckResourceAttr("boundary_role.with_grants", "description", "with grants"),
resource.TestCheckResourceAttr("boundary_role.with_grants", "name", "with_grants_update"),
resource.TestCheckResourceAttr("boundary_role.with_grants", "description", "with grants update"),
),
},
importStep("boundary_role.with_grants"),
@@ -245,12 +304,24 @@ func TestAccRoleWithPrincipals(t *testing.T) {
var provider *schema.Provider
resource.Test(t, resource.TestCase{
IsUnitTest: true,
ProviderFactories: providerFactories(&provider),
CheckDestroy: testAccCheckRoleResourceDestroy(t, provider),
Steps: []resource.TestStep{
{
// test create
Config: testConfig(url, fooOrg, firstProjectFoo, projRoleWithPrincipal),
// Create with invalid principal should create role but return empty plan
// since principal was not set correctly.
Config: testConfig(url, fooOrg, firstProjectFoo, projRoleWithInvalidPrincipal),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists(provider, "boundary_role.with_principal"),
resource.TestCheckResourceAttr("boundary_role.with_principal", DescriptionKey, "with principal"),
resource.TestCheckResourceAttr("boundary_role.with_principal", NameKey, "with_principal"),
),
ExpectError: regexp.MustCompile(`Unable to set principals on role`),
},
{
// Create again without invalid principal should produce empty plan
Config: testConfig(url, fooOrg, firstProjectFoo, fooUser, projRoleWithPrincipal),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists(provider, "boundary_role.with_principal"),
testAccCheckRoleResourcePrincipalsSet(provider, "boundary_role.with_principal", []string{"boundary_user.foo"}),
@@ -262,13 +333,26 @@ func TestAccRoleWithPrincipals(t *testing.T) {
},
importStep("boundary_role.with_principal"),
{
// test update
Config: testConfig(url, fooOrg, firstProjectFoo, projRoleWithPrincipalUpdate),
// Update with invalid principal should update role but return empty plan
// since principal was not set correctly.
Config: testConfig(url, fooOrg, firstProjectFoo, fooUser, projRoleWithInvalidPrincipalUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists(provider, "boundary_role.with_principal"),
resource.TestCheckResourceAttr("boundary_role.with_principal", DescriptionKey, "with principal update"),
resource.TestCheckResourceAttr("boundary_role.with_principal", NameKey, "with_principal_update"),
),
ExpectError: regexp.MustCompile(`Unable to set principals on role`),
},
{
// Update again without invalid principal should produce empty plan
Config: testConfig(url, fooOrg, firstProjectFoo, fooUser, barUser, projRoleWithPrincipalUpdate),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoleResourceExists(provider, "boundary_role.with_principal"),
testAccCheckUserResourceExists(provider, "boundary_user.foo"),
testAccCheckUserResourceExists(provider, "boundary_user.bar"),
testAccCheckRoleResourcePrincipalsSet(provider, "boundary_role.with_principal", []string{"boundary_user.foo", "boundary_user.bar"}),
resource.TestCheckResourceAttr("boundary_role.with_principal", DescriptionKey, "with principal update"),
resource.TestCheckResourceAttr("boundary_role.with_principal", NameKey, "with_principal_update"),
),
},
importStep("boundary_role.with_principal"),
+6
View File
@@ -0,0 +1,6 @@
{
"version": 1,
"metadata": {
"protocol_versions": ["5.0"]
}
}