forked from star3am/hashiqube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
89 lines (79 loc) · 2.53 KB
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* helpful hints
* https://github.com/localstack-samples/localstack-terraform-samples
* https://www.terraform.io/docs/configuration/functions/
* Localstack Terraform configuration https://docs.localstack.cloud/integrations/terraform/
* https://github.com/localstack/localstack-pro-samples/tree/master/terraform-resources
* https://blog.wimwauters.com/devops/2022-03-01_terraformusecases/
*/
resource "null_resource" "ec2_instance_disk_allocations_indexed" {
for_each = local.ec2_instance_disk_allocations_indexed
triggers = {
availability_zone = each.value.az
ami_id = each.value.ami_id
subnet_id = each.value.subnet_id
disksize = each.value.disksize
disktype = each.value.disktype
}
}
resource "null_resource" "count" {
count = length(var.ec2_instance)
triggers = {
availability_zone = var.ec2_instance[count.index].az
ami_id = var.ec2_instance[count.index].ami_id
subnet_id = var.ec2_instance[count.index].subnet_id
instance_type = var.ec2_instance[count.index].instance_type
tags = replace(replace(jsonencode(var.ec2_instance[count.index].tags), "\"", ""), ":", "=")
}
}
resource "null_resource" "debug" {
for_each = local.tunnels_with_index
triggers = {
host = each.value.type == "host" ? each.value.host : null
type = each.value.type
address = each.value.type == "address" ? each.value.address : null
description = each.value.description
timestamp = timestamp()
}
}
resource "null_resource" "random_pet" {
triggers = {
random_pet = random_pet.random.id
}
}
resource "random_string" "random" {
length = 16
special = true
override_special = "/@$"
min_numeric = 6
min_special = 2
min_upper = 3
}
resource "random_pet" "random" {
length = 1
}
resource "aws_s3_bucket" "my-bucket" {
bucket = "my-bucket"
}
resource "aws_s3_bucket_acl" "my-bucket-acl" {
bucket = aws_s3_bucket.my-bucket.id
acl = "private"
}
resource "aws_security_group" "default-sec-group" {
name = "default-sec-group"
description = "Default Security Group"
ingress {
# TLS (change to whatever ports you need)
from_port = 22
to_port = 22
protocol = "tcp"
# Please restrict your ingress to only necessary IPs and ports.
# Opening to 0.0.0.0/0 can lead to security vulnerabilities.
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}