Skip to content

Commit

Permalink
Adding the metal service to hpegl (#25)
Browse files Browse the repository at this point in the history
* Adding the metal service to hpegl

- Implemented the metal service into provider
- Generated documentation for metal service
  • Loading branch information
J0HNB0Y authored Jun 7, 2022
1 parent b37813a commit 3653b83
Show file tree
Hide file tree
Showing 37 changed files with 1,829 additions and 9 deletions.
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#(C) Copyright 2021 Hewlett Packard Enterprise Development LP
#(C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
DEPEND_REPO=HewlettPackard/hpegl-vmaas-terraform-resources
DEPEND_REPO=HewlettPackard/hpegl-vmaas-terraform-resources hewlettpackard/hpegl-metal-terraform-resources

prefix=hpegl-
suffix=-terraform-resources
Expand Down
58 changes: 58 additions & 0 deletions docs/data-sources/metal_available_images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
page_title: "hpegl_metal_available_images Data Source - terraform-provider-hpegl"
subcategory: "metal"
description: |-
Provides a list of available Image Services for a project.
---
# hpegl_metal_available_images (Data Source)
Provides a list of available Image Services for a project.
## Example Usage
```terraform
// (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
data "hpegl_metal_available_images" "centos" {
filter {
name = "flavor"
values = ["(?i)centos"] // case insensitive for Centos or centos etc.
}
filter {
name = "version"
values = ["7.6.*"] // al 7.6.XXXX image variants
}
}
output "images" {
value = data.hpegl_metal_available_images.ubuntu.images
}
```
<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `filter` (Block Set) (see [below for nested schema](#nestedblock--filter))

### Read-Only

- `id` (String) The ID of this resource.
- `images` (List of Object) (see [below for nested schema](#nestedatt--images))

<a id="nestedblock--filter"></a>
### Nested Schema for `filter`

Required:

- `name` (String)
- `values` (List of String)


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

Read-Only:

- `category` (String)
- `flavor` (String)
- `id` (String)
- `version` (String)

187 changes: 187 additions & 0 deletions docs/data-sources/metal_available_resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
page_title: "hpegl_metal_available_resources Data Source - terraform-provider-hpegl"
subcategory: "metal"
description: |-
Provides a list of available resources in a project for creating Hosts and Volumes.
---
# hpegl_metal_available_resources (Data Source)
Provides a list of available resources in a project for creating Hosts and Volumes.
## Example Usage
```terraform
# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
data "hpegl_metal_available_resources" "physical" {
}
output "locations" {
value = data.hpegl_metal_available_resources.physical.locations
}
output "images" {
value = data.hpegl_metal_available_resources.physical.images
}
output "ssh-keys" {
value = data.hpegl_metal_available_resources.physical.ssh_keys
}
output "networks" {
value = [for net in data.hpegl_metal_available_resources.physical.networks : net if net.location == var.location]
}
output "volumes" {
value = [for vol in data.hpegl_metal_available_resources.physical.volumes : vol if vol.location == var.location]
}
output "volume-flavors" {
value = data.hpegl_metal_available_resources.physical.volume_flavors
}
output "machine-sizes" {
value = data.hpegl_metal_available_resources.physical.machine_sizes
}
```
<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `filter` (Block Set) (see [below for nested schema](#nestedblock--filter))

### Read-Only

- `id` (String) The ID of this resource.
- `images` (List of Object) (see [below for nested schema](#nestedatt--images))
- `locations` (List of Object) (see [below for nested schema](#nestedatt--locations))
- `machine_sizes` (List of Object) (see [below for nested schema](#nestedatt--machine_sizes))
- `networks` (List of Object) (see [below for nested schema](#nestedatt--networks))
- `ssh_keys` (List of Object) (see [below for nested schema](#nestedatt--ssh_keys))
- `volume_flavors` (List of Object) (see [below for nested schema](#nestedatt--volume_flavors))
- `volumes` (List of Object) (see [below for nested schema](#nestedatt--volumes))

<a id="nestedblock--filter"></a>
### Nested Schema for `filter`

Required:

- `name` (String)
- `values` (List of String)


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

Read-Only:

- `category` (String)
- `flavor` (String)
- `id` (String)
- `version` (String)


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

Read-Only:

- `country` (String)
- `data_center` (String)
- `id` (String)
- `location` (String)
- `region` (String)


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

Read-Only:

- `description` (String)
- `id` (String)
- `location` (String)
- `location_id` (String)
- `name` (String)
- `quantity` (Number)


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

Read-Only:

- `description` (String)
- `host_use` (String)
- `id` (String)
- `ip_pool` (Set of Object) (see [below for nested schema](#nestedobjatt--networks--ip_pool))
- `ip_pool_id` (String)
- `location` (String)
- `location_id` (String)
- `name` (String)
- `vlan` (Number)
- `vni` (Number)

<a id="nestedobjatt--networks--ip_pool"></a>
### Nested Schema for `networks.ip_pool`

Read-Only:

- `base_ip` (String)
- `default_route` (String)
- `description` (String)
- `dns` (List of String)
- `ip_ver` (String)
- `name` (String)
- `netmask` (String)
- `no_proxy` (String)
- `ntp` (List of String)
- `proxy` (String)
- `sources` (List of Object) (see [below for nested schema](#nestedobjatt--networks--ip_pool--sources))

<a id="nestedobjatt--networks--ip_pool--sources"></a>
### Nested Schema for `networks.ip_pool.sources`

Read-Only:

- `base_ip` (String)
- `count` (Number)




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

Read-Only:

- `id` (String)
- `name` (String)


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

Read-Only:

- `description` (String)
- `id` (String)
- `name` (String)


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

Read-Only:

- `description` (String)
- `flavor` (String)
- `flavor_id` (String)
- `id` (String)
- `location` (String)
- `location_id` (String)
- `name` (String)
- `shareable` (Boolean)
- `size` (Number)
- `state` (String)
- `status` (String)

85 changes: 85 additions & 0 deletions docs/data-sources/metal_usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
page_title: "hpegl_metal_usage Data Source - terraform-provider-hpegl"
subcategory: "metal"
description: |-
Get a usage report
---
# hpegl_metal_usage (Data Source)
Get a usage report
## Example Usage
```terraform
// (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
variable "start" {
default = "2020-01-13T07:44:00Z"
}
data "hpegl_metal_usage" "used" {
start = var.start
}
output "compute_consumption" {
value = data.hpegl_metal_usage.used.host_usage
}
output "volume_consumption" {
value = data.hpegl_metal_usage.used.volume_usage
}
```
<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `start` (String) Start time for usage calculation, format is RFC 3339 e.g. 2018-05-13T07:44:12Z

### Optional

- `end` (String) End time for usage calculation, format is RFC 3339 e.g. 2018-05-13T07:44:12Z

### Read-Only

- `host_usage` (List of Object) (see [below for nested schema](#nestedatt--host_usage))
- `id` (String) The ID of this resource.
- `volume_usage` (List of Object) (see [below for nested schema](#nestedatt--volume_usage))

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

Read-Only:

- `allocated` (String)
- `end` (String)
- `error` (String)
- `freed` (String)
- `id` (String)
- `location_id` (String)
- `machine_size` (String)
- `machine_size_id` (String)
- `name` (String)
- `project_id` (String)
- `ready` (String)
- `start` (String)
- `usage_hours` (Number)


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

Read-Only:

- `allocated` (String)
- `capacity` (Number)
- `end` (String)
- `error` (String)
- `falvor_id` (String)
- `flavor` (String)
- `freed` (String)
- `id` (String)
- `location_id` (String)
- `name` (String)
- `project_id` (String)
- `ready` (String)
- `start` (String)
- `usage_hours` (Number)

14 changes: 14 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,25 @@ provider "hpegl" {
API clients use the appropriate GL "client" URL. Can be set by HPEGL_IAM_SERVICE_URL env-var
- `iam_token` (String) The IAM token to be used with the client(s). Note that in normal operation
an API client is used. Passing-in a token means that tokens will not be generated or refreshed.
- `metal` (Block Set, Max: 1) (see [below for nested schema](#nestedblock--metal))
- `tenant_id` (String) The tenant-id to be used, can be set by HPEGL_TENANT_ID env-var
- `user_id` (String) The user id to be used, can be set by HPEGL_USER_ID env-var
- `user_secret` (String) The user secret to be used, can be set by HPEGL_USER_SECRET env-var
- `vmaas` (Block Set, Max: 1) (see [below for nested schema](#nestedblock--vmaas))

<a id="nestedblock--metal"></a>
### Nested Schema for `metal`

Optional:

- `gl_token` (Boolean) Field indicating whether the token is GreenLake IAM issued token or Metal Service issued one,
can also be set with the HPEGL_METAL_GL_TOKEN env-var
- `project_id` (String) The Metal project-id to use, can also be set with the HPEGL_METAL_PROJECT_ID env-var
- `rest_url` (String) The Metal portal rest-url to use, can also be set with the HPEGL_METAL_REST_URL env-var
- `space_name` (String) The space-name to use with Metal, only required for project creation operations,
can also be set with the HPEGL_METAL_SPACE_NAME env-var


<a id="nestedblock--vmaas"></a>
### Nested Schema for `vmaas`

Expand Down
Loading

0 comments on commit 3653b83

Please sign in to comment.