For Virtual Machine Provisioning using the vSphere Provider.
There are 3 different examples, one in each folder.
- Set the vSphere Environment Variables:
export VSPHERE_USER="<Username>@vsphere.local"
export VSPHERE_PASSWORD="<Password>"
export VSPHERE_SERVER="<IP Address>"
export VSPHERE_ALLOW_UNVERIFIED_SSL=true
-
All examples tested using Terraform v11.11. If using a different version, you may experience issues.
-
All examples tested using the vSphere Provider v1.9.1_x4. If using a different version, you may experience issues.
-
Clone this repo to your local directory.
git clone [email protected]:Arslan-SE/PNC.git
- Destroy the changes and provision resources (if any).
terraform destroy
- This example is very simple. It pulls some data from the vCenter environment.
- Navigate to the example:
cd 3_getVsphereData/
- Save the terraform.tfvars.example file as terraform.tfvars and update the values.
cp terraform.tfvars.example terraform.tfvars
vi terraform.tfvars
- Initialize Terraform to pull the providers.
terraform init
- Make a dry run to see what will actually happen.
terraform plan
- Apply the changes and provision resources (if any).
terraform apply
- This example will provision a folder and then apply tags and attributes to that folder.
- Navigate to the example:
cd 3_create_SomeResources/
- Save the terraform.tfvars.example file as terraform.tfvars and update the values.
cp terraform.tfvars.example terraform.tfvars
vi terraform.tfvars
- Initialize Terraform to pull the providers.
terraform init
- Make a dry run to see what will actually happen.
terraform plan
- Apply the changes and provision resources (if any).
terraform apply
- Destroy the changes and provision resources (if any).
terraform destroy
- This example brings the other two examples together along with provisioning a VM using a cloned template.
- Navigate to the example:
cd 3_create_VmResource/
- Save the terraform.tfvars.example file as terraform.tfvars and update the values.
cp terraform.tfvars.example terraform.tfvars
vi terraform.tfvars
- Initialize Terraform to pull the providers.
terraform init
- Make a dry run to see what will actually happen.
terraform plan
- Apply the changes and provision resources (if any).
terraform apply
- Destroy the changes and provision resources (if any).
terraform destroy
Edited by Arslan Saeed