diff --git a/CHANGELOG.md b/CHANGELOG.md index bfe36c19..6a7036bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,10 @@ Canonical reference for changes, improvements, and bugfixes for the Boundary Ter `password_auth_method_login_name` & `password_auth_method_password` fields have been set to deprecated with a recommendation to use `auth_method_login_name` & `auth_method_password` fields instead. ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/392)) +* Deprecate type field for `boundary_account_password` + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/396)) +* Deprecate type field for `boundary_account_ldap` + ([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/400)) ## 1.1.4 (February 15, 2023) diff --git a/internal/provider/resource_account_ldap.go b/internal/provider/resource_account_ldap.go index 22653094..acb8ba39 100644 --- a/internal/provider/resource_account_ldap.go +++ b/internal/provider/resource_account_ldap.go @@ -54,7 +54,9 @@ func resourceAccountLdap() *schema.Resource { TypeKey: { Description: "The resource type.", Type: schema.TypeString, - Required: true, + Deprecated: "The value for this field will be infered since 'ldap' is the only possible value.", + Default: accountTypeLdap, + Optional: true, ForceNew: true, }, accountLoginNameKey: { diff --git a/internal/provider/resource_account_ldap_test.go b/internal/provider/resource_account_ldap_test.go index 306c0513..f7f0d34d 100644 --- a/internal/provider/resource_account_ldap_test.go +++ b/internal/provider/resource_account_ldap_test.go @@ -57,6 +57,23 @@ resource "boundary_account_ldap" "foo" { auth_method_id = boundary_auth_method_ldap.foo.id }`, testAccountLdapNameUpdate, testAccountLdapDescUpdate) + testAccountLdapWithoutTypeField = fmt.Sprintf(` +resource "boundary_auth_method_ldap" "foo" { + name = "test" + description = "test account" + type = "ldap" + scope_id = boundary_scope.org1.id + depends_on = [boundary_role.org1_admin] + urls = ["ldaps://ldap1", "ldaps://ldap2"] +} + +resource "boundary_account_ldap" "foo" { + name = "%s" + description = "%s" + login_name = "foo" + auth_method_id = boundary_auth_method_ldap.foo.id +}`, testAccountLdapNameUpdate, testAccountLdapDescUpdate) + testProviderLdapAccountConfig = ` resource "boundary_account_ldap" "test-ldap" { name = "alice" @@ -116,6 +133,18 @@ func TestAccLdapAccount(t *testing.T) { ), }, importStep("boundary_account_ldap.foo", "ldap"), + { + // update without passing type field + Config: testConfig(url, fooOrg, testAccountLdapWithoutTypeField), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("boundary_account_ldap.foo", "description", testAccountLdapDescUpdate), + resource.TestCheckResourceAttr("boundary_account_ldap.foo", "name", testAccountLdapNameUpdate), + resource.TestCheckResourceAttr("boundary_account_ldap.foo", "type", "ldap"), + resource.TestCheckResourceAttr("boundary_account_ldap.foo", "login_name", "foo"), + testAccCheckAccountResourceExists(provider, "boundary_account_ldap.foo"), + ), + }, + importStep("boundary_account_ldap.foo", "ldap"), }, }) }