Skip to content

Commit

Permalink
tidy up examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cheelim1 committed Apr 21, 2023
1 parent 52ec1bf commit b4d17e3
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 49 deletions.
3 changes: 0 additions & 3 deletions examples/system-groups/base.tf

This file was deleted.

26 changes: 24 additions & 2 deletions examples/system-groups/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
# Setup: User groups
resource "jumpcloud_user" "test_user1" {
username = "testuser1"
firstname = "test"
lastname = "user1"
email = "[email protected]"
enable_mfa = true
}

resource "jumpcloud_user_group_membership" "test_membership" {
userid = jumpcloud_user.test_user1.id
groupid = jumpcloud_user_group.test_group.id
}

# Setup: System groups
resource "jumpcloud_user_group" "test_group" {
name = "test_group"
attributes = {
posix_groups = "32:testerino"
}
}

resource "jumpcloud_system_group" "test_group" {
name = "Jumpcloud Provider Group"
}

resource "jumpcloud_system_group_user_group_membership" "test_group" {
users_group_id = jumpcloud_user_group.test_group.id
systems_group_id = jumpcloud_system_group.test_group.jc_id
users_group_id = jumpcloud_user_group.test_group.id
systems_group_id = jumpcloud_system_group.test_group.jc_id
}
28 changes: 0 additions & 28 deletions examples/system-groups/users.tf

This file was deleted.

11 changes: 11 additions & 0 deletions examples/system-groups/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
terraform {
required_providers {
jumpcloud = {
source = "cheelim1/jumpcloud"
}
}
}

provider "jumpcloud" {
api_key = "MY_API_KEY"
}
3 changes: 0 additions & 3 deletions examples/user-groups/provider.tf

This file was deleted.

11 changes: 11 additions & 0 deletions examples/user-groups/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
terraform {
required_providers {
jumpcloud = {
source = "cheelim1/jumpcloud"
}
}
}

provider "jumpcloud" {
api_key = "MY_API_KEY"
}
20 changes: 7 additions & 13 deletions examples/user-mgmt-with-module/module/module.tf
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
# All variables are mandatory, no defaults
variable "band_id" {}
variable "position_id" {}
variable "firstname" {}
variable "lastname" {}

locals {
username_lowercase = "${lower(var.firstname)}.${lower(var.lastname)}"
}

resource "jumpcloud_user" "user_from_module" {
username = "${local.username_lowercase}"
firstname = "${var.firstname}"
lastname = "${var.lastname}"
username = local.username_lowercase
firstname = var.firstname
lastname = var.lastname
email = "${local.username_lowercase}@rockstar.org"

# Even rockstars need MFA
enable_mfa = true
}

resource "jumpcloud_user_group_membership" "band" {
userid = "${jumpcloud_user.user_from_module.id}"
groupid = "${var.band_id}"
userid = jumpcloud_user.user_from_module.id
groupid = var.band_id
}

resource "jumpcloud_user_group_membership" "position" {
userid = "${jumpcloud_user.user_from_module.id}"
groupid = "${var.position_id}"
userid = jumpcloud_user.user_from_module.id
groupid = var.position_id
}
5 changes: 5 additions & 0 deletions examples/user-mgmt-with-module/module/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# All variables are mandatory, no defaults
variable "band_id" {}
variable "position_id" {}
variable "firstname" {}
variable "lastname" {}

0 comments on commit b4d17e3

Please sign in to comment.