-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLT-1523: Added password_policy support in terraform. (#555)
* PLT-1523: Added password_policy support in terraform. * added validation * added import support * update sdk * updated sdk * reviewable
- Loading branch information
1 parent
0acb38e
commit 88e7eb1
Showing
12 changed files
with
651 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
page_title: "spectrocloud_password_policy Resource - terraform-provider-spectrocloud" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# spectrocloud_password_policy (Resource) | ||
|
||
|
||
|
||
You can learn more about managing password policy in Palette by reviewing the [Password Policy](https://docs.spectrocloud.com/enterprise-version/system-management/account-management/credentials/#password-requirements-and-security) guide. | ||
|
||
~> The password_policy resource enforces a password compliance policy. By default, a password policy is configured in Palette with default values. Users can update the password compliance settings as per their requirements. When a spectrocloud_password_policy resource is destroyed, the password policy will revert to the Palette default settings. | ||
|
||
## Example Usage | ||
|
||
An example of managing an password policy in Palette. | ||
|
||
```hcl | ||
resource "spectrocloud_password_policy" "policy_regex" { | ||
# password_regex = "*" | ||
password_expiry_days = 123 | ||
first_reminder_days = 5 | ||
min_digits = 1 | ||
min_lowercase_letters = 12 | ||
min_password_length = 12 | ||
min_special_characters = 1 | ||
min_uppercase_letters = 1 | ||
} | ||
## import existing password policy | ||
#import { | ||
# to = spectrocloud_password_policy.password_policy | ||
# id = "{tenantUID}" // tenant-uid. | ||
#} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `first_reminder_days` (Number) The number of days before the password expiry to send the first reminder to the user. Default is `5` days before expiry. | ||
- `min_digits` (Number) The minimum number of numeric digits (0-9) required in the password. Ensures that passwords contain numerical characters. Minimum length of digit should be `1`. | ||
- `min_lowercase_letters` (Number) The minimum number of lowercase letters (a-z) required in the password. Ensures that lowercase characters are included for password complexity. Minimum length of lower case should be `1`. | ||
- `min_password_length` (Number) The minimum length required for the password. Enforces a stronger password policy by ensuring a minimum number of characters. Default minimum length is `6`. | ||
- `min_special_characters` (Number) The minimum number of special characters (e.g., !, @, #, $, %) required in the password. This increases the password's security level by including symbols. Minimum special characters should be `1`. | ||
- `min_uppercase_letters` (Number) The minimum number of uppercase letters (A-Z) required in the password. Helps ensure password complexity with a mix of case-sensitive characters. Minimum length of upper case should be `1`. | ||
- `password_expiry_days` (Number) The number of days before the password expires. Must be between 1 and 1000 days. Defines how often passwords must be changed. Default is `999` days for expiry. | ||
- `password_regex` (String) A regular expression (regex) to define custom password patterns, such as enforcing specific characters or sequences in the password. | ||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `create` (String) | ||
- `delete` (String) | ||
- `update` (String) |
14 changes: 14 additions & 0 deletions
14
examples/resources/spectrocloud_password_policy/providers.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
terraform { | ||
required_providers { | ||
spectrocloud = { | ||
version = ">= 0.1" | ||
source = "spectrocloud/spectrocloud" | ||
} | ||
} | ||
} | ||
|
||
provider "spectrocloud" { | ||
host = var.sc_host | ||
api_key = var.sc_api_key | ||
project_name = var.sc_project_name | ||
} |
16 changes: 16 additions & 0 deletions
16
examples/resources/spectrocloud_password_policy/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
resource "spectrocloud_password_policy" "policy_regex" { | ||
# password_regex = "*" | ||
password_expiry_days = 999 | ||
first_reminder_days = 5 | ||
min_password_length = 6 | ||
min_digits = 1 | ||
min_lowercase_letters = 1 | ||
min_special_characters = 1 | ||
min_uppercase_letters = 1 | ||
} | ||
|
||
## import existing password policy | ||
#import { | ||
# to = spectrocloud_password_policy.password_policy | ||
# id = "password-policy" // tenant-uid | ||
#} |
4 changes: 4 additions & 0 deletions
4
examples/resources/spectrocloud_password_policy/terraform.template.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Spectro Cloud credentials | ||
sc_host = "{Enter Spectro Cloud API Host}" #e.g: api.spectrocloud.com (for SaaS) | ||
sc_api_key = "{Enter Spectro Cloud API Key}" | ||
sc_project_name = "{Enter Spectro Cloud Project Name}" #e.g: Default |
18 changes: 18 additions & 0 deletions
18
examples/resources/spectrocloud_password_policy/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
variable "sc_host" { | ||
description = "Spectro Cloud Endpoint" | ||
default = "api.spectrocloud.com" | ||
} | ||
|
||
variable "sc_api_key" { | ||
description = "Spectro Cloud API key" | ||
} | ||
|
||
variable "sc_project_name" { | ||
description = "Spectro Cloud Project (e.g: Default)" | ||
default = "Default" | ||
} | ||
|
||
variable "ssh_key_value" { | ||
description = "ssh key value" | ||
default = "ssh-rsa ...... == [email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.