-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
55 lines (48 loc) · 1.17 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
#
# This example covers all use cases for the jumpcloud provider
#
terraform {
required_providers {
jumpcloud = {
source = "Spotnana-Tech/jumpcloud"
}
}
}
variable "api_key" {
type = string
sensitive = true
}
provider "jumpcloud" {
api_key = var.api_key
}
# Pulls all usergroups from the JumpCloud API
data "jumpcloud_usergroups" "all_usergroups" {}
data "jumpcloud_group_lookup" "group_lookup" {
name = "test"
limit = 1
}
# Pulls all apps from the JumpCloud API
data "jumpcloud_apps" "all_apps" {}
# Create a new usergroup
resource "jumpcloud_usergroup" "new_usergroup" {
name = "tf-provider-test-new_usergroup"
description = "This is a new usergroup from the Terraform provider"
members = []
}
# Importing the app association via applicationID
import {
to = jumpcloud_app.test_app
id = "65bc1fdaf6fc2af5f541a4c3"
}
# Associate the user groups with the app
resource "jumpcloud_app" "test_app" {
associated_groups = [
jumpcloud_usergroup.new_usergroup.id
]
}
output "num_usergroups" {
value = length(data.jumpcloud_usergroups.all_usergroups.usergroups)
}
output "num_apps" {
value = length(data.jumpcloud_apps.all_apps.apps)
}