-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.tf
49 lines (39 loc) · 986 Bytes
/
demo.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
## Terraform demo project
##
## Usage:
##
## $ tf init
## $ tf apply
## $ tf destroy
variable "n" {
type = number
description = "number of items"
default = 10
}
locals {
items = [for v in range(var.n) : "${v}s"]
}
## tflint-ignore: terraform_required_providers
resource "time_sleep" "this" {
for_each = toset(local.items)
triggers = {
key = each.key
}
create_duration = each.key
destroy_duration = each.key
}
## tflint-ignore: terraform_required_providers
resource "local_file" "this" {
for_each = toset(local.items)
content = "Content ${time_sleep.this[each.key].triggers.key}"
filename = "./demo-${each.key}.txt"
file_permission = "0664"
}
## tflint-ignore: terraform_required_providers,terraform_unused_declarations
data "local_file" "this" {
for_each = toset(local.items)
filename = local_file.this[each.key].filename
}
output "filenames" {
value = [for i in local.items : data.local_file.this[i].filename]
}