Skip to content

Commit

Permalink
chore: deprecate type field for boundary_account_ldap (#400)
Browse files Browse the repository at this point in the history
* deprecate type field for resource_account_ldap
  • Loading branch information
elimt authored May 10, 2023
1 parent 32c081a commit 8e413b2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion internal/provider/resource_account_ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
29 changes: 29 additions & 0 deletions internal/provider/resource_account_ldap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"),
},
})
}

0 comments on commit 8e413b2

Please sign in to comment.