terraform

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIsInstalled

func CheckIsInstalled() error

func GetInstanceIDs added in v1.3.1

func GetInstanceIDs(terraformDir string) ([]string, error)

func GetPublicIPs added in v1.3.1

func GetPublicIPs(terraformDir string) ([]string, error)

func InitConf

func InitConf() (*hclwrite.File, *hclwrite.Body, error)

InitConf creates hclFile where we define all terraform configuration in hclFile.Body() and create .tf file where we save the content in

func RemoveDirectory

func RemoveDirectory(terraformDir string) error

RemoveDirectory remove terraform directory in .avalanche-cli. We need to call this before and after creating ec2 instance

func RunTerraform

func RunTerraform(terraformDir string) ([]string, []string, error)

RunTerraform executes terraform apply function that creates the EC2 instances based on the .tf file provided returns a list of AWS node-IDs and node IPs

func SaveConf

func SaveConf(terraformDir string, hclFile *hclwrite.File) error

SaveConf writes all terraform configuration defined in hclFile to tfFile

func SetCloudCredentials

func SetCloudCredentials(rootBody *hclwrite.Body, region string) error

SetCloudCredentials sets AWS account credentials defined in .aws dir in user home dir

func SetElasticIPs added in v1.3.1

func SetElasticIPs(rootBody *hclwrite.Body, numNodes uint32)

SetElasticIPs attach elastic IP(s) to the associated ec2 instance(s)

func SetKeyPair

func SetKeyPair(rootBody *hclwrite.Body, keyName, certName string)

SetKeyPair define the key pair that we will create in our EC2 instance if it doesn't exist yet and download the .pem file to home dir

func SetOutput

func SetOutput(rootBody *hclwrite.Body)

SetOutput adds output section in terraform state file so that we can call terraform output command and print instance_ip and instance_id to user

func SetSecurityGroup

func SetSecurityGroup(rootBody *hclwrite.Body, ipAddress, securityGroupName string)

SetSecurityGroup whitelists the ip addresses allowed to ssh into cloud server

func SetSecurityGroupRule

func SetSecurityGroupRule(rootBody *hclwrite.Body, ipAddress, sgID string, ipInTCP, ipInHTTP bool)

func SetupInstances added in v1.3.1

func SetupInstances(rootBody *hclwrite.Body, securityGroupName string, useExistingKeyPair bool, existingKeyPairName, ami string, numNodes uint32)

SetupInstances adds aws_instance section in terraform state file where we configure all the necessary components of the desired ec2 instance(s)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL