fusioncore-vm-deployment 0.1.100
A short description of the project
Requires Python: >=3.6,<4.0

[![pipeline status](https://git.datcon.co.uk/tools.core/fusion_vm_tf_deploy/badges/master/pipeline.svg)](https://git.datcon.co.uk/tools.core/fusion_vm_tf_deploy/commits/master)
[![coverage report](https://git.datcon.co.uk/tools.core/fusion_vm_tf_deploy/badges/master/coverage.svg)](https://git.datcon.co.uk/tools.core/fusion_vm_tf_deploy/commits/master)

# Fusion_vm_tf_deploy

This module automates the deployment of the Fusion Core Base VM using VMware. 

## Installation

To install from [artifactory](https://metacom2.metaswitch.com/confluence/x/3F32AQ) run:

~~~~
pip install --index https://artifactory.metaswitch.com/api/pypi/pypi-virtual/simple fusion_vm_tf_deploy
~~~~

## Usage

### Fusion Core VM Deployment 

The fusion core deployment module handles the VMware VM deployment using terraform. The module deploys a VM using specified terraform files.

### Pre-requisites:

Install terraform on your device: https://www.terraform.io/downloads.html

Clone the repository files locally: 
~~~~
git clone git@git.datcon.co.uk:tools.core/fusioncore_vm_tf_deployment.git
~~~~
## VMware Solution

All of the configuration documents to deploy a virtual machine to the NGC internal vSphere rig are located in the Terraform folder. To deploy a vm based on other local terraform configuration, use the `--directory` flag followed by the directory path.

**Ensure that the terraform configuration files follow the same file tree format as those found in the 'terraform/' folder of this repository. Keep the directory names for the 'vsphere-persistent-disk' and 'vsphere-fusion-vm' folders and their contents consistent.**

#### Deploy a Fusion Core VM

To deploy a Fusion Core VM on vSphere run:

~~~~
cd terraform

fusion-vm-tf-deploy deploy
~~~~

**Note: this command must be run from the folder which contains the terraform configuration files e.g. fusion_vm_tf_deploy/terraform/. To run the command from another path, use the '--directory' flag:

~~~~
fusion-vm-tf-deploy deploy --directory <path_to_terraform_files>
~~~~
Any changes or overrides to the configuration variables are passed in using the command line arguments. **

E.g. to give the vm a unique name, use:
~~~~
fusion-vm-tf-deploy **deploy** --directory <path_to_terraform_files> --node_name Bob_Smith_3_Test_VM
~~~~

#### Destroy the Fusion Core VM
To destroy a Fusion Core VM on vSphere run:

~~~~
fusion-vm-tf-deploy destroy
~~~~

### Fusion Core VM Regression tests

To run the test module:

~~~~
test-fusion-vm-tf-deploy
~~~~

The test module deploys a virtual machine, runs the tests and then destroys the virtual machine once completed. 

The tests are based on the pytest framework and will accept any pytest command line arguments.To run one or more specific tests, use the"-k" keystring argument followed by the test name. 

The deployment configuration can be modified using the same process as above. For example:

~~~~
test-fusion-vm-tf-deploy --directory <path_to_terraform_files> --node_name Bob_Smith_3_Test_VM --k test_fusion_configuration
~~~~

## Development and Deployment

See the [Contribution guidelines for this project](CONTRIBUTING.md) for details on how to make changes to this library.

Note: This library was generated from the centrally owned [template package](https://git.datcon.co.uk/tools.core/python-template-library).