Skip to content

Commit

Permalink
Merge pull request #108 from dell/idrac_attributes
Browse files Browse the repository at this point in the history
idrac_attribute resource/datasource
  • Loading branch information
Krishnan-Priyanshu authored Oct 26, 2023
2 parents fae3d2a + f2a9004 commit 98ceacd
Show file tree
Hide file tree
Showing 23 changed files with 1,063 additions and 955 deletions.
13 changes: 8 additions & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ run:
# "/" will be replaced by current OS file path separator to properly work on Windows.
skip-dirs:
- vendor
- common
- gofish
- mutexkv

# Enables skipping of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
# Default: true
Expand All @@ -33,9 +37,8 @@ run:
# we confidently recognize autogenerated files.
# If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
# skip-files:
skip-files:
# - ".*\\.my\\.go$"
# - lib/bad.go
# If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand Down Expand Up @@ -99,7 +102,7 @@ linters-settings:
- name: argument-limit
severity: warning
disabled: false
arguments: [3]
arguments: [4]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#atomic
- name: atomic
severity: warning
Expand Down Expand Up @@ -234,7 +237,7 @@ linters-settings:
- name: function-length
severity: warning
disabled: false
arguments: [10, 0]
arguments: [45, 0]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return
- name: get-return
severity: warning
Expand Down Expand Up @@ -272,7 +275,7 @@ linters-settings:
- name: line-length-limit
severity: warning
disabled: false
arguments: [100] #TBD 80
arguments: [150] #TBD 80
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-parameter
- name: modifies-parameter
severity: warning
Expand Down
186 changes: 186 additions & 0 deletions docs/data-sources/dell_idrac_attributes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
---
# Copyright (c) 2023 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.

title: "redfish_dell_idrac_attributes data source"
linkTitle: "redfish_dell_idrac_attributes"
page_title: "redfish_dell_idrac_attributes Data Source - terraform-provider-redfish"
subcategory: ""
description: |-
Data source to provide redfish infiziya
---

# redfish_dell_idrac_attributes (Data Source)

Data source to provide redfish infiziya

This Terraform datasource is used to query existing iDRAC configuration. The information fetched from this block can be further used for resource block.
## Example Usage

variables.tf
```terraform
/*
Copyright (c) 2023 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.
*/
variable "rack1" {
type = map(object({
user = string
password = string
endpoint = string
validate_cert = bool
}))
}
```

terraform.tfvars
```terraform
/*
Copyright (c) 2023 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.
*/
rack1 = {
"my-server-1" = {
user = "admin"
password = "passw0rd"
endpoint = "https://my-server-1.myawesomecompany.org"
validate_cert = false
},
"my-server-2" = {
user = "admin"
password = "passw0rd"
endpoint = "https://my-server-2.myawesomecompany.org"
validate_cert = false
},
}
```

provider.tf
```terraform
/*
Copyright (c) 2023 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.
*/
terraform {
required_providers {
redfish = {
version = "1.1.0"
source = "registry.terraform.io/dell/redfish"
}
}
}
```

main.tf
```terraform
/*
Copyright (c) 2023 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.
*/
data "redfish_dell_idrac_attributes" "idrac" {
for_each = var.rack1
redfish_server = {
user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
validate_cert = each.value.validate_cert
}
}
output "idrac_attributes" {
value = data.redfish_dell_idrac_attributes.idrac
sensitive = true
}
```

After the successful execution of the above data block, we can see the output in the state file.

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `redfish_server` (Attributes) Redfish Server (see [below for nested schema](#nestedatt--redfish_server))

### Read-Only

- `attributes` (Map of String) iDRAC attributes. To check allowed attributes please either use the datasource for dell idrac attributes or query /redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellAttributes/iDRAC.Embedded.1. To get allowed values for those attributes, check /redfish/v1/Registries/ManagerAttributeRegistry/ManagerAttributeRegistry.v1_0_0.json from a Redfish Instance
- `id` (String) ID of the iDRAC attributes resource

<a id="nestedatt--redfish_server"></a>
### Nested Schema for `redfish_server`

Required:

- `endpoint` (String) Server BMC IP address or hostname

Optional:

- `password` (String, Sensitive) User password for login
- `user` (String) User name for login
- `validate_cert` (Boolean) This field indicates whether the SSL/TLS certificate must be verified or not
Loading

0 comments on commit 98ceacd

Please sign in to comment.