-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add aarch64 testing terraform config
When testing the linux aarch64 code on a real platform (AWS graviton), it is a bit of a hassle walking through all the steps to instantiate, configure, and then run the test suite. So I created a terraform configuration that does it all for me (a la infrastructure as code). Right now, the config is a too tailored to me (assumes the default network policy allows inbound ssh and the ssh key is named "me"). But, I'm a terraform noob, so I welcome implementation suggestions.
- Loading branch information
1 parent
cf11588
commit fac4a8d
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
**/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
|
||
### Terraform ### | ||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
terraform plan | ||
terraform apply -auto-approve | ||
public_ip=$(terraform output --raw public_ip) | ||
sleep 30 | ||
ssh ec2-user@$public_ip " | ||
sudo yum update -y && | ||
sudo yum groupinstall -y 'Development Tools' && | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal -y && | ||
source "\$HOME/.cargo/env" && | ||
git clone https://github.com/nickbabcock/highway-rs.git && | ||
cd highway-rs && | ||
cargo test" | ||
|
||
if [[ $? = 0 ]]; then | ||
read -p "Test successful, preserve instance? (y/N): " -n 1 -r -t 300 | ||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then | ||
terraform destroy -auto-approve | ||
fi | ||
else | ||
echo "Test failed" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.0" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = "us-east-1" | ||
} | ||
|
||
resource "aws_instance" "highway_aarch64" { | ||
ami = "ami-055859c8e0f361065" | ||
instance_type = "t4g.small" | ||
key_name = "me" | ||
} | ||
|
||
output "public_ip" { | ||
value = aws_instance.highway_aarch64.public_ip | ||
} |