devans10 / terraform-provider-flash

Terraform provider plugin for Pure Storage FlashArray
Apache License 2.0
5 stars 10 forks source link

How to create a volume for existing host and hostgroup? #8

Closed boopathid closed 5 years ago

boopathid commented 5 years ago

Can you give me an example .tf file to create volume and pass in the host and hostgroup information ?

devans10 commented 5 years ago

Take a look at this repository. Its a demo project that I put together as an example for using the provider. In that project, take a look at the storage/main.tf.

boopathid commented 5 years ago

Thank you Devan, that helps. One more information I am not clear is, when I already created host group and added hosts. Now I just want to create a volume, attach it to existing host and host group. How do I pass these information? If I just pass create volume, it creates the new volume and deletes the existing ones.

Below is what I have it on the .tf file.

resource "purestorage_volume" "Ricky-Volume-3" { name = "Ricky-Volume-3" size = "1024000000" }

devans10 commented 5 years ago

You should import the hosts and hostgroups as terraform resources

terraform import purestorage_host <hostname>

You will need to define the host in your .tf file before you import them. Here is the documentation on the import command