This is the repository for the Terraform Provider Flash. The plugin provides resources for the Pure Storage FlashArray to be managed within Terraform.
For general information about Terraform, visit the official website and the GitHub project page.
The documentation for the provider can be found on the Provider's website
This provider plugin is maintained by Dave Evans.
Please submit issues here.
Requirements
- Terraform 0.12.x (the provider was tested against 0.12.16)
- Go 1.13 (to build the provider plugin)
Usage
Add the following to $HOME/.terraformrc
providers {
purestorage = "$GOPATH/bin/terraform-provider-flash"
}
Configure in TF configuration
provider "purestorage" {
api_token = "${var.purestorage_apitoken}"
target = "${var.purestorage_target}"
}
or
provider "purestorage" {
username = "${var.purestorage_username}"
password = "${var.purestorage_password}"
target = "${var.purestorage_target}"
}
Configure in environment
Set username(PURE_USERNAME
) and password(PURE_PASSWORD
) or API Token(PURE_APITOKEN
) and endpoint(PURE_TARGET
) in environment.
provider "purestorage" {}
Building The Provider
Clone repository to: $GOPATH/src/github.com/devans10/terraform-provider-flash
mkdir -p $GOPATH/src/github.com/devans10; cd $GOPATH/src/github.com/devans10
git clone git@github.com:devans10/terraform-provider-flash
Enter the provider directory and build the provider
cd $GOPATH/src/github.com/devans10/terraform-provider-flash
make build
Using the provider
Basic volume provision
Create one volume
resource "purestorage_volume" "testvol_tf" {
name = "testvol_tf"
size = "1048000000"
}
Copy a volume
resource "purestorage_volume" "testvol_tf_copy" {
name = "testvol_tf_copy"
source = "testvol_tf"
}
Create a host
resource "purestorage_host" "testhosttf" {
name = "testhosttf"
volume {
vol = "testvol_tf"
lun = 1
}
}
Create a hostgroup
resource "purestorage_hostgroup" "testhgrouptf" {
name = "testhgrouptf"
hosts = ["testhosttf"]
volume {
vol = "testvol_tf_copy"
lun = 250
}
}
Create a Protection Group
Protection Group has a hosts, hgroups, and volumes parameters, but only 1 can be used.
resource "purestorage_protectiongroup" "testpgroup" {
name = "testpgroup"
volumes = ["testvol_tf", "testvol_tf_copy"]
}
Developing the Provider
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.11+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin
to your $PATH
.
To compile the provider, run make build
. This will build the provider and put the provider binary in the $GOPATH/bin
directory.
$ make build
...
$ $GOPATH/bin/terraform-provider-flash
...
In order to test the provider, you can simply run make test
.
make test
To run acceptance tests, run make testacc
.
Volumes and Protection Groups created during the acceptance tests are not eradicated.
make testacc
Disclaimer
terraform-provider-flash and its developer(s) are not affiliated with or sponsored by Pure Storage. The statements and opinions on this site are those of the developer(s) and do not necessarily represent those of Pure Storage. Pure Storage and the Pure Storage trademarks listed at https://www.purestorage.com/pure-folio/showcase.html?type=pdf&path=/content/dam/pdf/en/legal/external-trademark-list.pdf are trademarks of Pure Storage, Inc.