Giter Club home page Giter Club logo

terraform-azure-stir's Introduction

terraform-azure-stir

DOI

This repo demonstrates how to build and install STIR on an Azure VM using Terraform. The VM is described in Terraform files (.tf). Terraform deploys a VM in the cloud and then copies and executes a bash script to perform the actual building of STIR.

An Azure account is required for deployment.

Configure Terraform access to Azure

  • Query your Azure account to get a list of subscription and tenant ID values:
az account show --query "{subscriptionId:id, tenantId:tenantId}"
  • Note the subscriptionId and tenantId for future use.
  • Set the environment variable SUBSCRIPTION_ID to the subscription ID returned by the az account show command. In Bash, this would be:
export SUBSCRIPTION_ID=your_subscription_id
  • Create an Azure service prinicpal for Terraform to use:
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}"
  • Make a note of the appId and password

Configure Terraform environment variables

  • Copy var_values.tfvars.example to var_values.tfvars
  • Edit var_values.tfvars such that YOUR_SUBSCRIPTION_ID_HERE, YOUR_APPLICATION_ID_HERE,YOUR_SECRET_KEY_HERE and YOUR_TENANT_ID_HERE are replaced by your subscriptionId, appId, password and tenantId respectively.

Running the Terraform script

  • Initialise Terraform:
terraform init
  • To preview the actions that Terraform will take, run:
terraform plan -var-file var_values.tfvars
  • To run the script:
terraform apply -var-file var_values.tfvars
  • If this succeeded, a virtual machine will be running on Azure.
  • Find the public IP address of the machine:
az vm show --resource-group stirGroup --name stirVM -d --query [publicIps] --o tsv
  • Make a note of the IP address.
  • To access the machine via ssh:
ssh USERNAME@PUBLICIP

where USERNAME is the value set for vm_username (default: stiruser) and PUBLICIP is the public IP address found with the previous command.

Removing the infrastructure

terraform destroy -var-file var_values.tfvars

To avoid incurring unexpected costs, it is highly recommended that you check the Azure web portal to ensure that all resources have successfully been destroyed.

Troubleshooting

If you get an error related to SkuNotAvailable, try to display all available machine types and see if the chosen machine exists in the region:

az vm list-skus --output table

terraform-azure-stir's People

Contributors

bathomas avatar

Watchers

 avatar  avatar  avatar  avatar

terraform-azure-stir's Issues

Jupyter support

Provide jupyter front-end on VM. Is it possible to pass user-specified password to terraform?

Make VM size a variable

Allow user to specify size of machine to build. Ideally pass-through no. of cores for parallel build of STIR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.