-
Notifications
You must be signed in to change notification settings - Fork 73
/
main.tf
50 lines (41 loc) · 970 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
46
47
48
49
50
terraform {
backend "s3" {
bucket = "terraform-infraestructura-como-codigo"
key = "servidor/terraform.tfstate"
region = "eu-west-1"
dynamodb_table = "terraform-infraestructura-como-codigo-locks"
encrypt = true
}
}
provider "aws" {
region = "eu-west-1"
}
resource "aws_s3_bucket" "terraform_state" {
bucket = "terraform-infraestructura-como-codigo"
lifecycle {
prevent_destroy = true
}
versioning {
enabled = true
}
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
}
resource "aws_dynamodb_table" "terraform_locks" {
name = "terraform-infraestructura-como-codigo-locks"
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
}
resource "aws_instance" "servidor" {
ami = "ami-0aef57767f5404a3c"
instance_type = "t2.micro"
}