Akash Deployments may now be launched and managed via Terraform!
Within this guide we will break down the deployment process using this new path.
We begin with a review of the Terraform Manifest file components and provide a Full Manifest Example for additional clarity.
The following activities are possible currently via the Terraform Akash Provider:
Prerequisites
The following applications must be installed on the machine performing the Akash deployment via Terraform covered in this guide.
Terraform
Download and install the latest version of Terraform if a pre-existing installation is not present.
The Terraform client for Windows, MacOS, and Linux is available here.
Akash
The Akash CLI is necessary and the recommended version is 0.1.0.
Akash CLI install instructions are available here. Note only the `Install Akash CLI` and `Create/Fund Account` sections of this guide are necessary for Terraform use.
Terraform Manifest - Template
Overview
Within this section we review a Terraform Manifest example for building an Akash deployment.
Terraform Manifest File
- Use the blocks reviewed in this section to create your Terraform Manifest.
- Create a directory to house the files for your Terraform project and use this directory for all files created in the rest of this guide
- Create a file named
akashdeployment.tf
and populate the file with the blocks review below - Refer to the Terraform Manifest - Complete Example for clarity on how the blocks covered in this section fit together.
Terraform Block
- The
akash
provider is defined and current version specified - No adjustments to the Terraform manifest block should be necessary
- Periodically check to ensure the latest version is specified
Provider Block
- Provider attributes are defined in this block
- Replace the
account_address
andkey_name
attributes with your own values
Resource Block
- Definition of the Akash Deployment
- Replace
hello_world
with the preferred name of your deployment - Assumes that the
deploy.yaml
Akash SDL exists in the same directory as the Terraform file
Output Block
- Output the assigned URI and ports of the deployment
- Replace
hello_world
with the name of your deployment defined in the Resource Block
Akash SDL Hello World Example
Overview
- Use the example Akash SDL below for our Terraform demonstration
- Create a file named
deploy.yaml
with the Terraform project direct created prior - Copy the contents of the
Hello World SDL
below into thedeploy.yaml
file
Hello World SDL
Create Akash Deployment
Overview
In this section we create an Akash Deployment via Terraform.
Complete the construction of the Terraform manifest before initiating the deployment creation.
Ensure that the steps detailed in this section are executed from the directory in which the Terraform manifest exists.
NOTE - at this time the selection of the Akash provider from the bid list is automatic and selects the lowest priced bid. Consider adding attributes to the SDL to further limit provider bids received if necessary. Many providers advertise an organization
attribute and inclusion of this attribute within the SDL would allow only that provider to bid. In the near future other schemes will be introduced to allow specific provider bid selection in the deployment creation process via Terraform.
Steps
Initialize the Terraform Project
Confirm Resources to be Created
Create the Akash Deployment via Terraform
Expected/Example Output from Deployment Creation
- Confirm the application successfully deployed onto the Akash Network by visiting the generated and displayed in output
service_uri
Close Akash Deployment
Overview
In this section we close an Akash Deployment via Terraform.
Ensure that the steps detailed in this section are executed from the directory in which the Terraform manifest exists.
Steps
Close the Deployment
Terraform Manifest - Complete Example
- Replace the account_address and key-name values