diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c63efde..d71ecb2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,37 @@ +## 1.0.3 (Unreleased) + +### New and Improved + +* Adds credential library resource for Vault + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/114)). +* Adds credential store resource for Vault + ([PR 1](https://github.com/hashicorp/terraform-provider-boundary/pull/114)), + ([PR 2](https://github.com/hashicorp/terraform-provider-boundary/pull/125)). +* Adds claim scopes attribute to OIDC auth method + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/112)). +* Adds account claim maps attribute to OIDC auth method + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/111)). + +### Bug Fixes + +* Make OIDC account attribute for subject ForceNew + ([Issue](https://github.com/hashicorp/terraform-provider-boundary/issues/119)), + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/122)). +* Update static type attribute for host catalog resource + ([Issue](https://github.com/hashicorp/terraform-provider-boundary/issues/115)), + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/121)). + ## 1.0.2 (May 06, 2021) +### New and Improved + * Adds OIDC account resource -([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/105)) +([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/105)). * Adds OIDC auth method resource -([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/105)) +([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/105)). + +### Deprecations/Changes + * Deprecates fields on `resource_auth_method` that will be replaced in the future with generic `attributes` attribute. ## 1.0.1 (February 02, 2021) @@ -11,7 +39,7 @@ ### New and Improved * Adds worker filter to target resource - ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/76)) + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/76)). ## 1.0.0 (January 20, 2021) @@ -20,14 +48,14 @@ We are bumping the version of the Boundary Terraform provider to v1.0.0 and will ### Bug Fixes * During `terraform apply`, do not update existing user account passwords when the password field is updated in the tf file. - ([Issue](https://github.com/hashicorp/terraform-provider-boundary/issues/71)) - ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/70)) + ([Issue](https://github.com/hashicorp/terraform-provider-boundary/issues/71)), + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/70)). ## 0.1.4 (January 14, 2021) ### New and Improved -Update provider to handle new domain errors ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/63)) +Update provider to handle new domain errors ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/63)). ## 0.1.0 (October 14, 2020) diff --git a/docs/resources/credential_library_vault.md b/docs/resources/credential_library_vault.md index f0a3a1f8..bd269232 100644 --- a/docs/resources/credential_library_vault.md +++ b/docs/resources/credential_library_vault.md @@ -31,8 +31,8 @@ resource "boundary_scope" "project" { resource "boundary_credential_store_vault" "foo" { name = "foo" description = "My first Vault credential store!" - address = "127.0.0.1" - token = "s.0ufRo6XEGU2jOqnIr7OlFYP5" + address = "http://127.0.0.1:8200" # change to Vault address + token = "s.0ufRo6XEGU2jOqnIr7OlFYP5" # change to valid Vault token scope_id = boundary_scope.project.id } @@ -40,7 +40,7 @@ resource "boundary_credential_library_vault" "foo" { name = "foo" description = "My first Vault credential library!" credential_store_id = boundary_credential_store_vault.foo.id - path = "my/secret/foo" + path = "my/secret/foo" # change to Vault backend path http_method = "GET" } @@ -48,7 +48,7 @@ resource "boundary_credential_library_vault" "bar" { name = "bar" description = "My second Vault credential library!" credential_store_id = boundary_credential_store_vault.foo.id - path = "my/secret/bar" + path = "my/secret/bar" # change to Vault backend path http_method = "POST" request_body = < 0 { + opts = append(opts, targets.WithApplicationCredentialLibraryIds(credentialLibraryIds)) + } + + _, err := tc.SetCredentialLibraries(ctx, d.Id(), 0, opts...) if err != nil { return diag.Errorf("error updating credential libraries in target: %v", err) } - if err := d.Set(targetCredentialLibraryIdsKey, credentialLibraryIds); err != nil { + if err := d.Set(targetApplicationCredentialLibraryIdsKey, credentialLibraryIds); err != nil { return diag.FromErr(err) } } diff --git a/internal/provider/resource_target_test.go b/internal/provider/resource_target_test.go index d7e5e3b9..b0fbb396 100644 --- a/internal/provider/resource_target_test.go +++ b/internal/provider/resource_target_test.go @@ -90,7 +90,7 @@ resource "boundary_target" "foo" { host_set_ids = [ boundary_host_set.foo.id ] - credential_library_ids = [ + application_credential_library_ids = [ boundary_credential_library_vault.foo.id ] default_port = 22 @@ -109,7 +109,7 @@ resource "boundary_target" "foo" { host_set_ids = [ boundary_host_set.bar.id ] - credential_library_ids = [ + application_credential_library_ids = [ boundary_credential_library_vault.bar.id ] default_port = 80 @@ -118,6 +118,19 @@ resource "boundary_target" "foo" { session_connection_limit = 7 worker_filter = "type == \"bar\"" }`, fooTargetDescriptionUpdate) + + fooTargetUpdateUnsetHostAndCredLibs = fmt.Sprintf(` +resource "boundary_target" "foo" { + name = "test" + description = "%s" + type = "tcp" + scope_id = boundary_scope.proj1.id + default_port = 80 + depends_on = [boundary_role.proj1_admin] + session_max_seconds = 7000 + session_connection_limit = 7 + worker_filter = "type == \"bar\"" +}`, fooTargetDescriptionUpdate) ) func TestAccTarget(t *testing.T) { @@ -153,7 +166,7 @@ func TestAccTarget(t *testing.T) { resource.TestCheckResourceAttr("boundary_target.foo", targetSessionConnectionLimitKey, "6"), resource.TestCheckResourceAttr("boundary_target.foo", targetWorkerFilterKey, `type == "foo"`), testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", []string{"boundary_host_set.foo"}), - testAccCheckTargetResourceCredLibs(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.foo"}), + testAccCheckTargetResourceAppCredLibs(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.foo"}), ), }, importStep("boundary_target.foo"), @@ -168,7 +181,22 @@ func TestAccTarget(t *testing.T) { resource.TestCheckResourceAttr("boundary_target.foo", targetSessionConnectionLimitKey, "7"), resource.TestCheckResourceAttr("boundary_target.foo", targetWorkerFilterKey, `type == "bar"`), testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", []string{"boundary_host_set.bar"}), - testAccCheckTargetResourceCredLibs(provider, "boundary_target.foo", []string{"boundary_credential_library_vault.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), + Check: resource.ComposeTestCheckFunc( + testAccCheckTargetResourceExists(provider, "boundary_target.foo"), + resource.TestCheckResourceAttr("boundary_target.foo", DescriptionKey, fooTargetDescriptionUpdate), + resource.TestCheckResourceAttr("boundary_target.foo", targetDefaultPortKey, "80"), + resource.TestCheckResourceAttr("boundary_target.foo", targetSessionMaxSecondsKey, "7000"), + resource.TestCheckResourceAttr("boundary_target.foo", targetSessionConnectionLimitKey, "7"), + resource.TestCheckResourceAttr("boundary_target.foo", targetWorkerFilterKey, `type == "bar"`), + testAccCheckTargetResourceHostSet(provider, "boundary_target.foo", nil), + testAccCheckTargetResourceAppCredLibs(provider, "boundary_target.foo", nil), ), }, importStep("boundary_target.foo"), @@ -213,10 +241,6 @@ func testAccCheckTargetResourceHostSet(testProvider *schema.Provider, name strin return fmt.Errorf("Got an error when reading target %q: %v", id, err) } - if len(t.Item.HostSetIds) == 0 { - return fmt.Errorf("no hostSets found on target") - } - if len(t.Item.HostSetIds) != len(hostSetIDs) { return fmt.Errorf("tf state and boundary have different number of host sets") } @@ -237,7 +261,7 @@ func testAccCheckTargetResourceHostSet(testProvider *schema.Provider, name strin } } -func testAccCheckTargetResourceCredLibs(testProvider *schema.Provider, name string, credLibs []string) resource.TestCheckFunc { +func testAccCheckTargetResourceAppCredLibs(testProvider *schema.Provider, name string, credLibs []string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[name] if !ok { @@ -274,15 +298,11 @@ func testAccCheckTargetResourceCredLibs(testProvider *schema.Provider, name stri return fmt.Errorf("Got an error when reading target %q: %v", id, err) } - if len(t.Item.CredentialLibraries) == 0 { - return fmt.Errorf("no credential libraries found on target") + if len(t.Item.ApplicationCredentialLibraryIds) != len(credLibIDs) { + return fmt.Errorf("tf state and boundary have different number of application credential libraries") } - if len(t.Item.CredentialLibraries) != len(credLibIDs) { - return fmt.Errorf("tf state and boundary have different number of credential libraries") - } - - for _, stateCredLibId := range t.Item.CredentialLibraryIds { + for _, stateCredLibId := range t.Item.ApplicationCredentialLibraryIds { ok := false for _, gotCredLibID := range credLibIDs { if gotCredLibID == stateCredLibId { @@ -290,7 +310,7 @@ func testAccCheckTargetResourceCredLibs(testProvider *schema.Provider, name stri } } if !ok { - return fmt.Errorf("credential library id in state not set in boundary: %s", stateCredLibId) + return fmt.Errorf("application credential library id in state not set in boundary: %s", stateCredLibId) } }