-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3213bbf
commit 5d451f4
Showing
16 changed files
with
1,600 additions
and
26 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,97 @@ | ||
# Examples for sdsaas | ||
|
||
These examples illustrate how to use the resources and data sources associated with sdsaas. | ||
|
||
The following resources are supported: | ||
* ibm_sds_volume | ||
* ibm_sds_host | ||
|
||
## Usage | ||
|
||
To run this example, execute the following commands: | ||
|
||
```bash | ||
$ terraform init | ||
$ terraform plan | ||
$ terraform apply | ||
``` | ||
|
||
Run `terraform destroy` when you don't need these resources. | ||
|
||
## sdsaas resources | ||
|
||
### Resource: ibm_sds_volume | ||
|
||
```hcl | ||
resource "ibm_sds_volume" "sds_volume_instance" { | ||
hostnqnstring = var.sds_volume_hostnqnstring | ||
capacity = var.sds_volume_capacity | ||
name = var.sds_volume_name | ||
} | ||
``` | ||
|
||
#### Inputs | ||
|
||
| Name | Description | Type | Required | | ||
|------|-------------|------|---------| | ||
| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | | ||
| hostnqnstring | The host nqn. | `string` | false | | ||
| capacity | The capacity of the volume (in gigabytes). | `number` | true | | ||
| name | The name of the volume. | `string` | false | | ||
|
||
#### Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| host_mappings | List of host details that volume is mapped to. | | ||
| created_at | The date and time that the volume was created. | | ||
| resource_type | The resource type of the volume. | | ||
| status | The current status of the volume. | | ||
| status_reasons | Reasons for the current status of the volume. | | ||
|
||
### Resource: ibm_sds_host | ||
|
||
```hcl | ||
resource "ibm_sds_host" "sds_host_instance" { | ||
name = var.sds_host_name | ||
nqn = var.sds_host_nqn | ||
volume_mappings = var.sds_host_volume_mappings | ||
} | ||
``` | ||
|
||
#### Inputs | ||
|
||
| Name | Description | Type | Required | | ||
|------|-------------|------|---------| | ||
| ibmcloud\_api\_key | IBM Cloud API key | `string` | true | | ||
| name | The name for this host. The name must not be used by another host. If unspecified, the name will be a hyphenated list of randomly-selected words. | `string` | false | | ||
| nqn | The NQN of the host configured in customer's environment. | `string` | true | | ||
| volume_mappings | The host-to-volume map. | `list()` | false | | ||
|
||
#### Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| created_at | The date and time that the host was created. | | ||
| service_instance_id | The service instance ID this host should be created in. | | ||
|
||
|
||
## Assumptions | ||
|
||
1. TODO | ||
|
||
## Notes | ||
|
||
1. TODO | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| terraform | ~> 0.12 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| ibm | 1.13.1 | |
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,32 @@ | ||
provider "ibm" { | ||
ibmcloud_api_key = var.ibmcloud_api_key | ||
} | ||
|
||
// Provision sds_volume resource instance | ||
resource "ibm_sds_volume" "sds_volume_instance_1" { | ||
hostnqnstring = var.sds_volume_hostnqnstring | ||
capacity = var.sds_volume_capacity | ||
name = var.sds_volume_name_1 | ||
} | ||
|
||
// Provision sds_volume resource instance | ||
resource "ibm_sds_volume" "sds_volume_instance_2" { | ||
hostnqnstring = var.sds_volume_hostnqnstring | ||
capacity = var.sds_volume_capacity | ||
name = var.sds_volume_name_2 | ||
} | ||
|
||
// Provision sds_host resource instance | ||
resource "ibm_sds_host" "sds_host_instance" { | ||
|
||
name = var.sds_host_name | ||
nqn = var.sds_host_nqn | ||
volume_mappings { | ||
volume_id = ibm_sds_volume.sds_volume_instance_1.id | ||
volume_name = ibm_sds_volume.sds_volume_instance_1.name | ||
} | ||
volume_mappings { | ||
volume_id = ibm_sds_volume.sds_volume_instance_2.id | ||
volume_name = ibm_sds_volume.sds_volume_instance_2.name | ||
} | ||
} |
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,12 @@ | ||
// This output allows sds_volume data to be referenced by other resources and the terraform CLI | ||
// Modify this output if only certain data should be exposed | ||
output "ibm_sds_volume" { | ||
value = [ibm_sds_volume.sds_volume_instance_1, ibm_sds_volume.sds_volume_instance_2] | ||
description = "sds_volume resource instance" | ||
} | ||
// This output allows sds_host data to be referenced by other resources and the terraform CLI | ||
// Modify this output if only certain data should be exposed | ||
output "ibm_sds_host" { | ||
value = ibm_sds_host.sds_host_instance | ||
description = "sds_host resource instance" | ||
} |
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,37 @@ | ||
variable "ibmcloud_api_key" { | ||
description = "IBM Cloud API key" | ||
type = string | ||
} | ||
|
||
variable "sds_volume_hostnqnstring" { | ||
description = "The host nqn." | ||
type = string | ||
default = "nqn.2014-06.org:9345" | ||
} | ||
variable "sds_volume_capacity" { | ||
description = "The capacity of the volume (in gigabytes)." | ||
type = number | ||
default = 10 | ||
} | ||
variable "sds_volume_name_1" { | ||
description = "The name of the volume." | ||
type = string | ||
default = "demo-volume-1" | ||
} | ||
|
||
variable "sds_volume_name_2" { | ||
description = "The name of the volume." | ||
type = string | ||
default = "demo-volume-2" | ||
} | ||
|
||
variable "sds_host_name" { | ||
description = "The name for this host. The name must not be used by another host. If unspecified, the name will be a hyphenated list of randomly-selected words." | ||
type = string | ||
default = "demo-host" | ||
} | ||
variable "sds_host_nqn" { | ||
description = "The NQN of the host configured in customer's environment." | ||
type = string | ||
default = "nqn.2014-06.org:9345" | ||
} |
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,9 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
required_providers { | ||
ibm = { | ||
source = "IBM-Cloud/ibm" | ||
version = "1.71.0-beta1" | ||
} | ||
} | ||
} |
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
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.