Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update examples and add guide for password enhancement #255

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/data-sources/bios.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -144,6 +151,11 @@ data "redfish_bios" "bios" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
12 changes: 12 additions & 0 deletions docs/data-sources/dell_idrac_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -144,6 +151,11 @@ data "redfish_dell_idrac_attributes" "idrac" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/directory_service_auth_provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ data "redfish_directory_service_auth_provider" "ds_auth" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
12 changes: 12 additions & 0 deletions docs/data-sources/firmware_inventory.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -144,6 +151,11 @@ data "redfish_firmware_inventory" "inventory" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
12 changes: 12 additions & 0 deletions docs/data-sources/network.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -144,6 +151,11 @@ data "redfish_network" "nic_example" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
12 changes: 12 additions & 0 deletions docs/data-sources/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -144,6 +151,11 @@ data "redfish_storage" "storage" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/storage_controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ data "redfish_storage_controller" "storage_controller_example" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
12 changes: 12 additions & 0 deletions docs/data-sources/system_boot.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -144,6 +151,11 @@ data "redfish_system_boot" "system_boot" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
12 changes: 12 additions & 0 deletions docs/data-sources/virtual_media.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -144,6 +151,11 @@ data "redfish_virtual_media" "vm" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
54 changes: 54 additions & 0 deletions docs/guides/enhancement_for_password_managemant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved.

# Licensed under the Mozilla Public License Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://mozilla.org/MPL/2.0/


# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
page_title: "Enhancement for password managemant"
title: "Enhancement for password managemant"
linkTitle: "Enhancement for password managemant"
---
Enhancements to password management
The guide provides a terraform configuration of using `redfish_alias` to enhance password managemant.
The purpose of this enhancement is that when the user password changes, we only need to update the password value in the locals variable, and we no longer need to manually edit the state files to change the old root password to new password.
All we need to do is introduce `redfish_servers` to the provider, while introducing `redfish_alias` to resource/datasource's `redfish_server`.

## Example

```terraform
provider "redfish" {
# Add `redfish_servers` to provider. This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}

resource "redfish_user_account" "rr" {
for_each = var.rack1

redfish_server {
# Add `redfish_alias` to resource/datasource
redfish_alias = each.key
}

user_id = "4"
username = "test"
password = "Test@123"
role_id = "Operator"
enabled = true
}
```

## Example for Import
```terraform
# terraform import with redfish_alias. When using redfish_alias, provider's `redfish_servers` is required.
# redfish_alias is used to align with enhancements to password management.
terraform import redfish_user_account.rr "{\"id\":\"<id>\",\"redfish_alias\":\"<redfish_alias>\"}"
```
16 changes: 16 additions & 0 deletions docs/resources/bios.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -144,6 +151,11 @@ resource "redfish_bios" "bios" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down Expand Up @@ -222,6 +234,10 @@ limitations under the License.
*/

terraform import redfish_bios.bios "{\"username\":\"<username>\",\"password\":\"<password>\",\"endpoint\":\"<endpoint>\",\"ssl_insecure\":<true/false>}"

# terraform import with redfish_alias. When using redfish_alias, provider's `redfish_servers` is required.
# redfish_alias is used to align with enhancements to password management.
terraform import redfish_bios.bios "{\"redfish_alias\":\"<redfish_alias>\"}"
```

1. This will import the storage volume instance with specified ID into your Terraform state.
Expand Down
16 changes: 16 additions & 0 deletions docs/resources/boot_order.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -146,6 +153,11 @@ resource "redfish_boot_order" "boot" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down Expand Up @@ -242,6 +254,10 @@ limitations under the License.
# terraform import redfish_boot_order.boot "{\"username\":\"<username>\",\"password\":\"<password>\",\"endpoint\":\"<endpoint>\",\"ssl_insecure\":<true/false>}"

terraform import redfish_boot_order.boot '{"username":"admin","password":"passw0rd","endpoint":"https://my-server-1.myawesomecompany.org","ssl_insecure":true}'

# terraform import with redfish_alias. When using redfish_alias, provider's `redfish_servers` is required.
# redfish_alias is used to align with enhancements to password management.
terraform import redfish_boot_order.boot '{"redfish_alias":"<redfish_alias>"}'
```

1. This will import the boot order instance into your Terraform state.
Expand Down
12 changes: 12 additions & 0 deletions docs/resources/boot_source_override.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ terraform {
}
}
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

main.tf
Expand All @@ -148,6 +155,11 @@ resource "redfish_boot_source_override" "boot" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
9 changes: 9 additions & 0 deletions docs/resources/certificate.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ terraform {
}

provider "redfish" {
# `redfish_servers` is used to align with enhancements to password management.
# Map of server BMCs with their alias keys and respective user credentials.
# This is required when resource/datasource's `redfish_alias` is not null
redfish_servers = var.rack1
}
```

Expand Down Expand Up @@ -160,6 +164,11 @@ resource "redfish_certificate" "cert" {
for_each = var.rack1

redfish_server {
# Alias name for server BMCs. The key in provider's `redfish_servers` map
# `redfish_alias` is used to align with enhancements to password management.
# When using redfish_alias, provider's `redfish_servers` is required.
redfish_alias = each.key

user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
Expand Down
Loading
Loading