From 5ed7c49406ac4e0e9686b79ea5aaeb1087d054fb Mon Sep 17 00:00:00 2001 From: DaMandal0rian <3614052+DaMandal0rian@users.noreply.github.com> Date: Thu, 30 Jan 2025 17:11:55 +0300 Subject: [PATCH] Import tf resources (#411) * add kol-memory-viewer POC resources to TF * import blockscout taurus server to TF --- auto-kol-memory/poc/backend.tf | 9 ++ auto-kol-memory/poc/main.tf | 92 ++++++++++++++++++ auto-kol-memory/poc/outputs.tf | 94 +++++++++++++++++++ auto-kol-memory/poc/variables.tf | 4 + .../aws/blockscout/taurus/backend.tf | 9 ++ .../terraform/aws/blockscout/taurus/main.tf | 88 +++++++++++++++++ .../aws/blockscout/taurus/outputs.tf | 94 +++++++++++++++++++ .../aws/blockscout/taurus/variables.tf | 4 + 8 files changed, 394 insertions(+) create mode 100644 auto-kol-memory/poc/backend.tf create mode 100644 auto-kol-memory/poc/main.tf create mode 100644 auto-kol-memory/poc/outputs.tf create mode 100644 auto-kol-memory/poc/variables.tf create mode 100644 explorer/terraform/aws/blockscout/taurus/backend.tf create mode 100644 explorer/terraform/aws/blockscout/taurus/main.tf create mode 100644 explorer/terraform/aws/blockscout/taurus/outputs.tf create mode 100644 explorer/terraform/aws/blockscout/taurus/variables.tf diff --git a/auto-kol-memory/poc/backend.tf b/auto-kol-memory/poc/backend.tf new file mode 100644 index 0000000..fbd5764 --- /dev/null +++ b/auto-kol-memory/poc/backend.tf @@ -0,0 +1,9 @@ +terraform { + cloud { + organization = "subspace-sre" + + workspaces { + name = "auto-kol-memory" + } + } +} diff --git a/auto-kol-memory/poc/main.tf b/auto-kol-memory/poc/main.tf new file mode 100644 index 0000000..a14a183 --- /dev/null +++ b/auto-kol-memory/poc/main.tf @@ -0,0 +1,92 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 5.0" + } + } + + required_version = ">= 1.0.0" +} + +provider "aws" { + region = var.region +} + +# imported with `terraform import aws_instance.kol-memory-viewer i-0d3f0c603df4eabf4` +# aws_instance.kol-memory-viewer: +resource "aws_instance" "kol-memory-viewer" { + ami = "ami-0e2c8caa4b6378d8c" + associate_public_ip_address = true + availability_zone = "us-east-1a" + disable_api_stop = false + disable_api_termination = false + ebs_optimized = true + get_password_data = false + hibernation = false + instance_initiated_shutdown_behavior = "stop" + instance_type = "t3.large" + key_name = "auto-kol" + monitoring = false + placement_partition_number = 0 + secondary_private_ips = [] + security_groups = [] + source_dest_check = true + subnet_id = "subnet-0c9c609637361967a" + tags = { + "Name" = "kol-memory-viewer" + } + tags_all = { + "Name" = "kol-memory-viewer" + } + tenancy = "default" + vpc_security_group_ids = [ + "sg-012ef042c43b155ec", + ] + + capacity_reservation_specification { + capacity_reservation_preference = "open" + } + + cpu_options { + core_count = 1 + threads_per_core = 2 + } + + credit_specification { + cpu_credits = "standard" + } + + enclave_options { + enabled = false + } + + maintenance_options { + auto_recovery = "default" + } + + metadata_options { + http_endpoint = "enabled" + http_protocol_ipv6 = "disabled" + http_put_response_hop_limit = 2 + http_tokens = "required" + instance_metadata_tags = "disabled" + } + + private_dns_name_options { + enable_resource_name_dns_a_record = false + enable_resource_name_dns_aaaa_record = false + hostname_type = "ip-name" + } + + root_block_device { + delete_on_termination = true + encrypted = false + iops = 3000 + tags = {} + tags_all = {} + throughput = 125 + volume_size = 8 + volume_type = "gp3" + } +} diff --git a/auto-kol-memory/poc/outputs.tf b/auto-kol-memory/poc/outputs.tf new file mode 100644 index 0000000..f48901e --- /dev/null +++ b/auto-kol-memory/poc/outputs.tf @@ -0,0 +1,94 @@ +output "instance_id" { + description = "The ID of the EC2 instance" + value = aws_instance.kol-memory-viewer.id +} + +output "instance_arn" { + description = "The ARN of the EC2 instance" + value = aws_instance.kol-memory-viewer.arn +} + +output "instance_state" { + description = "The current state of the instance" + value = aws_instance.kol-memory-viewer.instance_state +} + +output "private_ip" { + description = "Private IP address of the instance" + value = aws_instance.kol-memory-viewer.private_ip +} + +output "public_ip" { + description = "Public IP address of the instance" + value = aws_instance.kol-memory-viewer.public_ip +} + +output "public_dns" { + description = "Public DNS of the instance" + value = aws_instance.kol-memory-viewer.public_dns +} + +output "subnet_id" { + description = "Subnet ID where the instance is running" + value = aws_instance.kol-memory-viewer.subnet_id +} + +output "vpc_security_group_ids" { + description = "List of associated security groups" + value = aws_instance.kol-memory-viewer.vpc_security_group_ids +} + +output "key_name" { + description = "Name of the key pair used to launch the instance" + value = aws_instance.kol-memory-viewer.key_name +} + +output "instance_type" { + description = "The instance type of the EC2 instance" + value = aws_instance.kol-memory-viewer.instance_type +} + +output "cpu_core_count" { + description = "Number of CPU cores" + value = aws_instance.kol-memory-viewer.cpu_core_count +} + +output "cpu_threads_per_core" { + description = "Number of threads per core" + value = aws_instance.kol-memory-viewer.cpu_threads_per_core +} + +output "ebs_optimized" { + description = "Indicates whether the instance is EBS optimized" + value = aws_instance.kol-memory-viewer.ebs_optimized +} + +output "root_volume_id" { + description = "ID of the root EBS volume" + value = aws_instance.kol-memory-viewer.root_block_device[0].volume_id +} + +output "root_volume_size" { + description = "Size of the root volume in GB" + value = aws_instance.kol-memory-viewer.root_block_device[0].volume_size +} + +output "root_volume_type" { + description = "Type of the root volume (gp3, gp2, io1, etc.)" + value = aws_instance.kol-memory-viewer.root_block_device[0].volume_type +} + +output "root_volume_iops" { + description = "IOPS of the root volume" + value = aws_instance.kol-memory-viewer.root_block_device[0].iops +} + +output "root_volume_throughput" { + description = "Throughput of the root volume in MiB/s" + value = aws_instance.kol-memory-viewer.root_block_device[0].throughput +} + +output "instance_details_json" { + description = "Complete instance details in JSON format" + value = jsonencode(aws_instance.kol-memory-viewer) +} diff --git a/auto-kol-memory/poc/variables.tf b/auto-kol-memory/poc/variables.tf new file mode 100644 index 0000000..2d3c2ca --- /dev/null +++ b/auto-kol-memory/poc/variables.tf @@ -0,0 +1,4 @@ +variable "region" { + description = "AWS region" + default = "us-east-1" +} diff --git a/explorer/terraform/aws/blockscout/taurus/backend.tf b/explorer/terraform/aws/blockscout/taurus/backend.tf new file mode 100644 index 0000000..13a8bd9 --- /dev/null +++ b/explorer/terraform/aws/blockscout/taurus/backend.tf @@ -0,0 +1,9 @@ +terraform { + cloud { + organization = "subspace-sre" + + workspaces { + name = "blockscout" + } + } +} diff --git a/explorer/terraform/aws/blockscout/taurus/main.tf b/explorer/terraform/aws/blockscout/taurus/main.tf new file mode 100644 index 0000000..7d042ec --- /dev/null +++ b/explorer/terraform/aws/blockscout/taurus/main.tf @@ -0,0 +1,88 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 5.0" + } + } + + required_version = ">= 1.0.0" +} + +provider "aws" { + region = var.region +} + +# imported with `terraform import aws_instance.blockscout_taurus i-0539bab3e0096f260` +resource "aws_instance" "blockscout_taurus" { + ami = "ami-05a9ac2fc2ef3e1d5" + associate_public_ip_address = true + availability_zone = "us-east-2b" + disable_api_stop = false + disable_api_termination = false + ebs_optimized = true + get_password_data = false + hibernation = false + instance_initiated_shutdown_behavior = "stop" + instance_type = "m7a.2xlarge" + key_name = "explorer-deployer" + monitoring = false + placement_partition_number = 0 + private_ip = "172.35.1.52" + secondary_private_ips = [] + security_groups = [] + source_dest_check = true + subnet_id = "subnet-0a57e78575b2bcf5a" + tags = { + "Name" = "blockscout-taurus" + } + tags_all = { + "Name" = "blockscout-taurus" + } + tenancy = "default" + vpc_security_group_ids = [ + "sg-05bfab744c63b40e9", + ] + + capacity_reservation_specification { + capacity_reservation_preference = "open" + } + + cpu_options { + core_count = 8 + threads_per_core = 1 + } + + enclave_options { + enabled = false + } + + maintenance_options { + auto_recovery = "default" + } + + metadata_options { + http_endpoint = "enabled" + http_protocol_ipv6 = "disabled" + http_put_response_hop_limit = 1 + http_tokens = "optional" + instance_metadata_tags = "disabled" + } + + private_dns_name_options { + enable_resource_name_dns_a_record = false + enable_resource_name_dns_aaaa_record = false + hostname_type = "ip-name" + } + + root_block_device { + delete_on_termination = true + encrypted = false + iops = 3000 + tags = {} + tags_all = {} + throughput = 125 + volume_size = 500 + volume_type = "gp3" + } +} diff --git a/explorer/terraform/aws/blockscout/taurus/outputs.tf b/explorer/terraform/aws/blockscout/taurus/outputs.tf new file mode 100644 index 0000000..a250e7b --- /dev/null +++ b/explorer/terraform/aws/blockscout/taurus/outputs.tf @@ -0,0 +1,94 @@ +output "instance_id" { + description = "The ID of the EC2 instance" + value = aws_instance.blockscout_taurus.id +} + +output "instance_arn" { + description = "The ARN of the EC2 instance" + value = aws_instance.blockscout_taurus.arn +} + +output "instance_state" { + description = "The current state of the instance" + value = aws_instance.blockscout_taurus.instance_state +} + +output "private_ip" { + description = "Private IP address of the instance" + value = aws_instance.blockscout_taurus.private_ip +} + +output "public_ip" { + description = "Public IP address of the instance" + value = aws_instance.blockscout_taurus.public_ip +} + +output "public_dns" { + description = "Public DNS of the instance" + value = aws_instance.blockscout_taurus.public_dns +} + +output "subnet_id" { + description = "Subnet ID where the instance is running" + value = aws_instance.blockscout_taurus.subnet_id +} + +output "vpc_security_group_ids" { + description = "List of associated security groups" + value = aws_instance.blockscout_taurus.vpc_security_group_ids +} + +output "key_name" { + description = "Name of the key pair used to launch the instance" + value = aws_instance.blockscout_taurus.key_name +} + +output "instance_type" { + description = "The instance type of the EC2 instance" + value = aws_instance.blockscout_taurus.instance_type +} + +output "cpu_core_count" { + description = "Number of CPU cores" + value = aws_instance.blockscout_taurus.cpu_core_count +} + +output "cpu_threads_per_core" { + description = "Number of threads per core" + value = aws_instance.blockscout_taurus.cpu_threads_per_core +} + +output "ebs_optimized" { + description = "Indicates whether the instance is EBS optimized" + value = aws_instance.blockscout_taurus.ebs_optimized +} + +output "root_volume_id" { + description = "ID of the root EBS volume" + value = aws_instance.blockscout_taurus.root_block_device[0].volume_id +} + +output "root_volume_size" { + description = "Size of the root volume in GB" + value = aws_instance.blockscout_taurus.root_block_device[0].volume_size +} + +output "root_volume_type" { + description = "Type of the root volume (gp3, gp2, io1, etc.)" + value = aws_instance.blockscout_taurus.root_block_device[0].volume_type +} + +output "root_volume_iops" { + description = "IOPS of the root volume" + value = aws_instance.blockscout_taurus.root_block_device[0].iops +} + +output "root_volume_throughput" { + description = "Throughput of the root volume in MiB/s" + value = aws_instance.blockscout_taurus.root_block_device[0].throughput +} + +output "instance_details_json" { + description = "Complete instance details in JSON format" + value = jsonencode(aws_instance.blockscout_taurus) +} diff --git a/explorer/terraform/aws/blockscout/taurus/variables.tf b/explorer/terraform/aws/blockscout/taurus/variables.tf new file mode 100644 index 0000000..f0ac917 --- /dev/null +++ b/explorer/terraform/aws/blockscout/taurus/variables.tf @@ -0,0 +1,4 @@ +variable "region" { + description = "AWS region" + default = "us-east-2" +}