-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
49 lines (44 loc) · 1.03 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
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
terraform {
required_providers {
apstra = {
source = "Juniper/apstra"
}
}
}
provider "apstra" {
url = "https://13.37.222.29:21809/"
tls_validation_disabled = true
blueprint_mutex_disabled = true
}
data "apstra_property_sets" "all" {}
# Loop over Property Set IDs, creating an instance of `apstra_property_set` for each.
data "apstra_property_set" "each_ps" {
for_each = toset(data.apstra_property_sets.all.ids)
id = each.value
}
locals {
payload = jsonencode({
value_str = "str"
value_int = 42
value_json = {
inner_value_str = "innerstr"
inner_value_int = 4242
}
})
}
resource "apstra_property_set" "r" {
name = "TF Property Set 12567"
data = local.payload
}
# Output the property set report
output "apstra_property_set_report" {
value = {for k, v in data.apstra_property_set.each_ps : k => {
name = v.name
data = jsondecode(v.data)
}}
}
output "new_property_set" {
value = resource.apstra_property_set.r
}