Skip to content

Commit

Permalink
Import tf resources (#411)
Browse files Browse the repository at this point in the history
* add kol-memory-viewer POC resources to TF

* import blockscout taurus server to TF
  • Loading branch information
DaMandal0rian authored Jan 30, 2025
1 parent 50378c6 commit 5ed7c49
Show file tree
Hide file tree
Showing 8 changed files with 394 additions and 0 deletions.
9 changes: 9 additions & 0 deletions auto-kol-memory/poc/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
cloud {
organization = "subspace-sre"

workspaces {
name = "auto-kol-memory"
}
}
}
92 changes: 92 additions & 0 deletions auto-kol-memory/poc/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
}
94 changes: 94 additions & 0 deletions auto-kol-memory/poc/outputs.tf
Original file line number Diff line number Diff line change
@@ -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)
}
4 changes: 4 additions & 0 deletions auto-kol-memory/poc/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "region" {
description = "AWS region"
default = "us-east-1"
}
9 changes: 9 additions & 0 deletions explorer/terraform/aws/blockscout/taurus/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
cloud {
organization = "subspace-sre"

workspaces {
name = "blockscout"
}
}
}
88 changes: 88 additions & 0 deletions explorer/terraform/aws/blockscout/taurus/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
}
94 changes: 94 additions & 0 deletions explorer/terraform/aws/blockscout/taurus/outputs.tf
Original file line number Diff line number Diff line change
@@ -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)
}
Loading

0 comments on commit 5ed7c49

Please sign in to comment.