Skip to content

Latest commit

 

History

History

development-debugging-sandbox

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Development and Debugging Sandbox

This is an example created for the development of new features, debugging clusters, or fixing bugs. All configuration and outputs are very specific for development purposes and specific for person who well known with a Terraform, Linux and Shell, there will not be a lot of details and comments so not recommended to apply if you are a beginner in Terraform. Some examples and information might to useful for involving to process of development and contribution. If you interesting with this recommended use this example.

Usage

Enter next commands to run this example:

$ terraform init
$ terraform plan
$ terraform apply

After applying you should see all needed information, for example:

...
Apply complete! Resources: 72 added, 0 changed, 0 destroyed.

Outputs:

bastion_host = 18.207.181.20
cluster_url = http://tf-vault-debug-alb-123456789.us-east-1.elb.amazonaws.com:443
ssh_connection_commands = {
  "node0" = "ssh -o StrictHostKeyChecking=no -J core@18.207.181.20 core@node0.vault.int -t 'sudo su'"
  "node1" = "ssh -o StrictHostKeyChecking=no -J core@18.207.181.20 core@node1.vault.int -t 'sudo su'"
  "node2" = "ssh -o StrictHostKeyChecking=no -J core@18.207.181.20 core@node2.vault.int -t 'sudo su'"
}

Useful CLI commands and tricks

  • Delete row from known_hosts

    sed -i '/node0.vault.int/d' ~/.ssh/known_hosts
  • Show last 40 log records in reverse order by journalctl

    journalctl --utc -a -u vault.service -r -n 40
  • Follow a logs in realtime by journalctl

    journalctl --utc -a -u vault.service -f

ATTENTION! Some resources cannot be covered by Amazon Free Tier or not Free usage and cost a money so after running this example should destroy all resources created previously

$ terraform destroy

Requirements

No requirements.

Providers

Name Version
local n/a

Modules

Name Source Version
bastion github.com/binlab/terraform-aws-bastion v0.1.5
vault ../.. n/a

Resources

Name Type
local_file.ssh_public_key data source

Inputs

Name Description Type Default Required
aws_profile AWS Profile string "default" no
aws_region AWS Region name string "us-east-1" no
cluster_count Count of Nodes in Cluster number 3 no
ssh_public_key_path Path to SSH public key in a HOME directory string "~/.ssh/id_rsa.pub" no

Outputs

Name Description
bastion_host Bastion public host (Public IP)
cluster_url Cluster public URL with schema, domain, and port.
All parameters depend on inputs values and calculated automatically
for convenient use. Can be created separately outside a module
ssh_connection_commands Fast CLI commands for connection to nodes