-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
45 lines (35 loc) · 886 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
provider "aws" {
region = var.region
}
data "aws_ami" "ubuntu_arm64" {
most_recent = true
owners = ["099720109477"]
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-arm64-server-*"]
}
}
resource "tls_private_key" "example" {
algorithm = "RSA"
rsa_bits = 4096
}
resource "aws_key_pair" "example" {
key_name = var.key_name
public_key = tls_private_key.example.public_key_openssh
}
resource "aws_instance" "example" {
ami = data.aws_ami.ubuntu_arm64.id
instance_type = var.instance_type
key_name = var.key_name
vpc_security_group_ids = [aws_security_group.example.id]
subnet_id = aws_subnet.public.id
private_ip = "10.0.0.12"
root_block_device {
volume_size = var.disk_size
}
tags = {
Name = "QDrant"
}
user_data_replace_on_change = true
user_data = "${file("${path.module}/init.sh")}"
}