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

System boot datasource migration to TPF #121

Merged
merged 6 commits into from
Nov 15, 2023
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
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ run:
# If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
skip-files:
- "redfish/provider/data_source_redfish_system_boot.go"
- "redfish/provider/resource_redfish_storage_volume.go"
- "redfish/provider/resource_redfish_storage_volume.go"
- "redfish/provider/resource_redfish_bios.go"
Expand Down
81 changes: 81 additions & 0 deletions docs/data-sources/system_boot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "redfish_system_boot Data Source - terraform-provider-redfish"
subcategory: ""
description: |-
Data source to fetch Firmware Inventory details via RedFish.
---

# redfish_system_boot (Data Source)

Data source to fetch Firmware Inventory details via RedFish.

## Example Usage

```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_system_boot" "system_boot" {
for_each = var.rack1

redfish_server {
user = each.value.user
password = each.value.password
endpoint = each.value.endpoint
ssl_insecure = each.value.ssl_insecure
}

// resource_id is an optional argument. By default, the data source uses
// the first ComputerSystem resource present in the ComputerSystem collection
resource_id = "System.Embedded.1"
}

output "system_boot" {
value = data.redfish_system_boot.system_boot
sensitive = true
}
```

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

### Optional

- `id` (String) Resource ID of the computer system. If not provided, the first system resource is used
- `redfish_server` (Block List) List of server BMCs and their respective user credentials (see [below for nested schema](#nestedblock--redfish_server))

### Read-Only

- `boot_order` (List of String) An array of BootOptionReference strings that represent the persistent boot order for this computer system
- `boot_source_override_enabled` (String) The state of the boot source override feature
- `boot_source_override_mode` (String) The BIOS boot mode to use when the system boots from the BootSourceOverrideTarget boot source
- `boot_source_override_target` (String) Current boot source to use at next boot instead of the normal boot device, if BootSourceOverrideEnabled is true
- `uefi_target_boot_source_override` (String) The UEFI device path of the device from which to boot when BootSourceOverrideTarget is UefiTarget

<a id="nestedblock--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
- `ssl_insecure` (Boolean) This field indicates whether the SSL/TLS certificate must be verified or not
- `user` (String) User name for login
16 changes: 16 additions & 0 deletions redfish/models/system_boot.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package models

import (
"github.com/hashicorp/terraform-plugin-framework/types"
)

// SystemBootDataSource struct for datasource
type SystemBootDataSource struct {
RedfishServer []RedfishServer `tfsdk:"redfish_server"`
ResourceID types.String `tfsdk:"id"`
BootOrder types.List `tfsdk:"boot_order"`
BootSourceOverrideEnabled types.String `tfsdk:"boot_source_override_enabled"`
BootSourceOverrideMode types.String `tfsdk:"boot_source_override_mode"`
BootSourceOverrideTarget types.String `tfsdk:"boot_source_override_target"`
UefiTargetBootSourceOverride types.String `tfsdk:"uefi_target_boot_source_override"`
}
Loading
Loading