terraform

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 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 GetInstanceID

func GetInstanceID(terraformDir string) (string, error)

func GetPublicIP

func GetPublicIP(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 the AWS node-ID and node IP

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 SetElasticIP

func SetElasticIP(rootBody *hclwrite.Body)

SetElasticIP attach elastic IP to our ec2 instance

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 SetupInstance

func SetupInstance(rootBody *hclwrite.Body, securityGroupName string, useExistingKeyPair bool, existingKeyPairName, ami string)

SetupInstance adds aws_instance section in terraform state file where we configure all the necessary components of the desired ec2 instance

Types

This section is empty.

Jump to

Keyboard shortcuts

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