Skip to content

Commit

Permalink
Remove deprecated fields: vault_ad_secret_backend
Browse files Browse the repository at this point in the history
  • Loading branch information
benashz committed Oct 28, 2021
1 parent 5e67a3c commit 61935a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 39 deletions.
39 changes: 2 additions & 37 deletions vault/resource_ad_secret_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package vault

import (
"fmt"
"github.com/hashicorp/terraform-provider-vault/util"
"log"
"strings"

"github.com/hashicorp/terraform-provider-vault/util"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/vault/api"
)
Expand Down Expand Up @@ -81,13 +82,6 @@ func adSecretBackendResource() *schema.Resource {
Optional: true,
Description: `Use anonymous bind to discover the bind DN of a user.`,
},
"formatter": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Deprecated: `Formatter is deprecated and password_policy should be used with Vault >= 1.5.`,
Description: `Text to insert the password into, ex. "customPrefix{{PASSWORD}}customSuffix".`,
},
"groupattr": {
Type: schema.TypeString,
Optional: true,
Expand All @@ -114,13 +108,6 @@ func adSecretBackendResource() *schema.Resource {
Computed: true,
Description: `The number of seconds after a Vault rotation where, if Active Directory shows a later rotation, it should be considered out-of-band.`,
},
"length": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Deprecated: `Length is deprecated and password_policy should be used with Vault >= 1.5.`,
Description: `The desired length of passwords that Vault generates.`,
},
"local": {
Type: schema.TypeBool,
Required: false,
Expand Down Expand Up @@ -271,9 +258,6 @@ func createConfigResource(d *schema.ResourceData, meta interface{}) error {
if v, ok := d.GetOkExists("discoverdn"); ok {
data["discoverdn"] = v
}
if v, ok := d.GetOkExists("formatter"); ok {
data["formatter"] = v
}
if v, ok := d.GetOkExists("groupattr"); ok {
data["groupattr"] = v
}
Expand All @@ -289,9 +273,6 @@ func createConfigResource(d *schema.ResourceData, meta interface{}) error {
if v, ok := d.GetOkExists("last_rotation_tolerance"); ok {
data["last_rotation_tolerance"] = v
}
if v, ok := d.GetOkExists("length"); ok {
data["length"] = v
}
if v, ok := d.GetOkExists("max_ttl"); ok {
data["max_ttl"] = v
}
Expand Down Expand Up @@ -410,11 +391,6 @@ func readConfigResource(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("error setting state key 'discoverdn': %s", err)
}
}
if val, ok := resp.Data["formatter"]; ok {
if err := d.Set("formatter", val); err != nil {
return fmt.Errorf("error setting state key 'formatter': %s", err)
}
}
if val, ok := resp.Data["groupattr"]; ok {
if err := d.Set("groupattr", val); err != nil {
return fmt.Errorf("error setting state key 'groupattr': %s", err)
Expand All @@ -440,11 +416,6 @@ func readConfigResource(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("error setting state key 'last_rotation_tolerance': %s", err)
}
}
if val, ok := resp.Data["length"]; ok {
if err := d.Set("length", val); err != nil {
return fmt.Errorf("error setting state key 'length': %s", err)
}
}
if val, ok := resp.Data["max_ttl"]; ok {
if err := d.Set("max_ttl", val); err != nil {
return fmt.Errorf("error setting state key 'max_ttl': %s", err)
Expand Down Expand Up @@ -569,9 +540,6 @@ func updateConfigResource(d *schema.ResourceData, meta interface{}) error {
if raw, ok := d.GetOk("discoverdn"); ok {
data["discoverdn"] = raw
}
if raw, ok := d.GetOk("formatter"); ok {
data["formatter"] = raw
}
if raw, ok := d.GetOk("groupattr"); ok {
data["groupattr"] = raw
}
Expand All @@ -587,9 +555,6 @@ func updateConfigResource(d *schema.ResourceData, meta interface{}) error {
if raw, ok := d.GetOk("last_rotation_tolerance"); ok {
data["last_rotation_tolerance"] = raw
}
if raw, ok := d.GetOk("length"); ok {
data["length"] = raw
}
if raw, ok := d.GetOk("max_ttl"); ok {
data["max_ttl"] = raw
}
Expand Down
16 changes: 14 additions & 2 deletions website/docs/guides/version_3_upgrade.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ can always be found in the [CHANGELOG](https://github.com/hashicorp/terraform-pr
We introduced version `3.0.0` of the Vault provider in order to upgrade to the
[Terraform Plugin SDKv2](https://www.terraform.io/docs/extend/sdkv2-intro.html).
The change was deemed significant enough to warrant the major version bump.
In addition to the aforementioned SDK upgrade all previously deprecated fields
have been removed.
In addition to the aforementioned SDK upgrade all previously deprecated fields,
and resources have been removed.

While you may see some small changes in your configurations as a result of
these changes, we don't expect you'll need to make any major refactorings.
Expand Down Expand Up @@ -72,6 +72,7 @@ state changes in the meantime.

- [Data Source: `vault_kubernetes_auth_backend_role`](#data-source-vault_kubernetes_auth_backend_role)

- [Resource: `vault_ad_secret_backend`](#resource-vault_ad_secret_backend)
- [Resource: `vault_approle_auth_backend_role`](#resource-vault_approle_auth_backend_role)
- [Resource: `vault_auth_backend`](#resource-vault_auth_backend)
- [Resource: `vault_aws_auth_backend_role`](#resource-vault_aws_auth_backend_role)
Expand Down Expand Up @@ -144,6 +145,17 @@ The following deprecated fields have been removed:

_Specifying any of the fields above in your config or trying to interpolate them in your config will raise an error._

## Resource: `vault_ad_secret_backend`

### Deprecated fields have been removed
The following deprecated fields have been removed:

* `formatter` - use `password_policy` instead.

* `length` - use `password_policy` instead.

_Specifying any of the fields above in your config or trying to interpolate them in your config will raise an error._

## Resource: `vault_approle_auth_backend_role`

### Deprecated fields have been removed
Expand Down

0 comments on commit 61935a9

Please sign in to comment.