From af7bd86a946d73f80e27c4bafe0502c5a24a391f Mon Sep 17 00:00:00 2001 From: Kye Date: Fri, 23 Feb 2024 23:19:06 -0800 Subject: [PATCH] [SCRIPTS][Terraform] --- scripts/hive3.tf | 37 +++++++++++++++++++++++++++++++++ scripts/hive_cloud_hopping.tf | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 scripts/hive3.tf create mode 100644 scripts/hive_cloud_hopping.tf diff --git a/scripts/hive3.tf b/scripts/hive3.tf new file mode 100644 index 0000000..521cd91 --- /dev/null +++ b/scripts/hive3.tf @@ -0,0 +1,37 @@ +provider "aws" { + region = "us-west-2" +} + +resource "aws_instance" "docker_vm" { + ami = "ami-0c55b159cbfafe1f0" + instance_type = "t2.micro" + key_name = "your-ssh-key-name" + + connection { + type = "ssh" + user = "ec2-user" + private_key = file("${path.module}/your-ssh-key.pem") + host = self.public_ip + } + + provisioner "remote-exec" { + inline = [ + "sudo yum update -y", + "sudo amazon-linux-extras install docker -y", + "sudo service docker start", + "sudo usermod -a -G docker ec2-user" + ] + } + + provisioner "remote-exec" { + inline = [ + "cd /path/to/your/app", + "sudo docker build -t my-app .", + "sudo docker run -d -p 80:80 my-app" + ] + } + + tags = { + Name = "DockerVM" + } +} diff --git a/scripts/hive_cloud_hopping.tf b/scripts/hive_cloud_hopping.tf new file mode 100644 index 0000000..4a8c5c8 --- /dev/null +++ b/scripts/hive_cloud_hopping.tf @@ -0,0 +1,39 @@ +provider "aws" { + region = "us-west-2" + # Additional configuration such as credentials +} + +provider "google" { + credentials = file(".json") + project = "" + region = "us-central1" + # Additional configuration +} + +module "aws_cluster_1" { + source = "./modules/aws_cluster" + cluster_name = "cluster-1" + region = "us-west-2" + # Additional variables +} + +module "aws_cluster_2" { + source = "./modules/aws_cluster" + cluster_name = "cluster-2" + region = "eu-central-1" + # Additional variables +} + +module "gcp_cluster_1" { + source = "./modules/gcp_cluster" + cluster_name = "cluster-1" + region = "us-central1" + # Additional variables +} + +module "gcp_cluster_2" { + source = "./modules/gcp_cluster" + cluster_name = "cluster-2" + region = "europe-west1" + # Additional variables +}