genvid.toolbox.TerraformTool¶
Warning
This module has been deprecated. Although the code is still working for our oldest model, it is not expected to work with the new Bastion API. Please, use the new genvid-bastion tool.
-
class
genvid.toolbox.
TerraformTool
(**kwargs)¶ Bases:
genvid.toolbox.runtime.RuntimeTool
,genvid.toolbox.docker.DockerTool
Main tool for managing the cloud environment using terraform.
-
ARTIFACTS_URL_TEMPLATE
= '{images_domain_name}/'¶ The template for the base URL for loading the Docker images. It is formatted with the information inside the
terraform_config
property.
-
DESCRIPTION
= 'Genvidtech Terraform Utility'¶
-
NAME
= 'terraform'¶
-
SERVER_CLASSES
= ('server', 'public_worker', 'internal_worker')¶ The list of server nodes classes.
-
TF
¶ The location of the terraform executable.
-
TFS3DIR
¶ The location of the terraform-s3-dir executable.
-
add_commands
()¶
-
add_terraform_commands
()¶ Add all the commands available from :class:TerraformTool.
Run it from
add_commands()
to add all the commands available from terraform to the parser. See alsoRuntimeTool.add_runtime_commands()
for other commands available from :class:TerraformTool.
-
apply_cluster
(*args, **kwargs)¶ Run terraform apply.
-
destroy_cluster
(*args, **kwargs)¶ Run terraform destroy.
-
get_cluster_ips
(public=False)¶ Return the list of the private ips of all nodes on the cluster.
If public is True, returns the public ips instead.
-
get_consul_ip
()¶
-
get_ip
()¶
-
output_cluster
(*args, check=False, **kwargs)¶ Run terraform output.
-
plan_cluster
(*args, **kwargs)¶ Run terraform plan.
-
refresh
()¶ Refresh the
terraform_config
values.
-
run_command
(command, options)¶
-
run_nomad_fs
(*args, ip=None, **kwargs)¶ Run nomad fs on the server, using ssh.
This is necessary for nomad fs to be able to run on nodes which are only available through a reverse proxy.
-
run_terraform_command
(command, options)¶ Detect if the command is a terraform command and execute it.
Call it from
run_command()
to handle terraform commands. Terraform commands are added with the help ofadd_terraform_commands()
.- Returns:
- handled, result: A tuple with a boolean saying if the command were handled, and it’s result if that the case.
-
run_tf
(*args, cwd=None, **kwargs)¶ Run terraform with the following arguments.
Note that the default cwd is set to self.ROOTDIR when not specified.
-
setup_jobs
(**kwargs)¶
-
show_cluster
(*args, **kwargs)¶ Run terraform show.
-
ssh
(*cmd, ip=None)¶ Run cmd on the server designated by ip using ssh.
Used the first server ip if None is passed.
-
ssh_config
()¶ Returns the ssh command line parameters to connect to the main
Used the first server ip if None is passedserver.
-
ssh_shell
(ip=None)¶
-
status
(*jobs)¶
-
terraform_config
¶ A dictionary of some of the terraform output and variables.
You must call
refresh()
to refresh them.
-
update_images
()¶ Update all docker images in the terraform configuration.
-