This terraform code configures a Ubuntu virtual machine on packet and configures BIRD for BGP routing.
- Install Terraform
- A Packet Host Account
- Linux host to run Terraform
A Packet API key and Project ID is required for Terraform to provision hardare.
Your Packet API key must be available in the PACKET_AUTH_TOKEN
environment variable
and the Project ID stored in the PACKET_PROJECT_ID
environment variable.
Alternatively, the Project ID can be saved in vars.tf.
The Packet API key is typically stored outside of the code repo since it is considered secret. If someone gets this key, they can startup/shutdown hosts in your project!
For more information on how to generate an API key or find your project ID, please see: https://support.packet.com/kb/articles/api-integrations
For more information about the API, please see: https://www.packet.com/developers/api/
Example:
$ export TF_VAR_packet_auth_token="Example-API-Token"
$ export TF_VAR_packet_project_id="Example-Project-ID"
Steps
- Populate vars.tf with your API token and project ID or use environment variables TF_VAR_packet_project_id and TF_VAR_packet_auth_token
- Generate an SSH key named mykey using ssh-keygen -f mykey
- Copy terraform.tfvars.sample to terraform.tfvars and edit the bgp_md5 value to a random password
- Set the same bgp_md5 password into your Packet Project
- terraform init
- terraform plan
- terraform apply
- Test that request go across all servers with curl <elastic_ip>