Giter VIP home page Giter VIP logo

custom-quantum-computing-terraform-provider's Introduction

Setup local development to run the provider and scripts

Requirements

  • Terraform cli (x86_64)
  • Golang (x86_64)
  • azure-cli
  • Set this environment variable on your shell: export GOBIN=$HOME/go/bin # can be other directory
  • AWS credentials setup under ~/.aws
  • Azure credentials setup

Installations

Compile custom provider implementation

$ go mod tidy
$ go install .

Mirror all standard terraform providers to your system

This step is needed because terraform only supports either running all providers from remote sources, or local sources. Since we have a custom local provider, we have to download all the standard providers that we need. Run these commands under deploy_quantum_task directory:

$ mkdir -p ~/.terraform.d/plugins
$ terraform providers mirror ~/.terraform.d/plugins

The command will fail with provider local and our custom providers, which are missing. This is expected because those are not available online.

Configure terraform to use downloaded providers

Have this file .terraformrc under $HOME (replace all $HOME with actual absolute paths). Please note the actual downloaded version of the providers might differ, so let's double check the version in the path.

provider_installation {

  dev_overrides {
      "hashicorp.com/edu/quantumrunners" = "$HOME/go/bin"
      "hashicorp/local" = "$HOME/.terraform.d/plugins/registry.terraform.io/hashicorp/local/<VERSION>/darwin_amd64"
      "registry.terraform.io/hashcorp/local" = "$HOME/.terraform.d/plugins/registry.terraform.io/hashicorp/local/<VERSION>/darwin_amd64"
      "hashicorp/aws" = "$HOME/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/<VERSION>/darwin_amd64"
      "registry.terraform.io/hashicorp/aws" = "$HOME/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/<VERSION>/darwin_amd64"
      "hashicorp/azurerm" = "$HOME/.terraform.d/plugins/registry.terraform.io/hashicorp/azurerm/<VERSION>/darwin_amd64"
      "registry.terraform.io/hashicorp/azurerm" = "$HOME/.terraform.d/plugins/registry.terraform.io/hashicorp/azurerm/<VERSION>/darwin_amd64"
      "scottwinkler/shell" = "$HOME/.terraform.d/plugins/registry.terraform.io/scottwinkler/shell/<VERSION>/darwin_amd64"
      "registry.terraform.io/scottwinkler/shell" = "$HOME/.terraform.d/plugins/registry.terraform.io/scottwinkler/shell/<VERSION>/darwin_amd64"
  }
}

Disable a cloud provider if not needed.

The project supports AWS braket and Azure Quantum service. Each service is defined under aws_ and azure_ prefix under deploy_quantum_task. Change the file extension of those service from .tf to .xtf will disable the deployment on those cloud. If such cloud services are needed, simply change the file name back again.

Deploy the terraform code

Under deploy_quantum_task, run

$ terraform plan # This will make terraform to describe what it will do
$ # This -var will not be needed if azure platform are not deployed.
$ terraform apply -var azure_subscription_id=<YOUR AZURE SUBSCRIPTION ID>

Develop the custom Terraform Provider Quantum Runner

Run the following command to build the provider and install to the target destination ($GOBIN)

$ go install .

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.