Skip to content

Commit 6760f2a

Browse files
authored
release 0.6.0 (#57)
* changes for beta2 - workaround UseStateForUnknown issue with TF framework in nested object schemas - wait for 100ms when deleting links to avoid race in core controller - updated dependencies * documentation update - added examples for newly added resources and data sources - made user password "sensitive" in schema - another dependency update round * changed terraform version matrix (use 1.4) * fix system data source * move the wait from link to node delete
1 parent 3c5128a commit 6760f2a

File tree

21 files changed

+274
-121
lines changed

21 files changed

+274
-121
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ jobs:
6363
terraform:
6464
# - "1.0.*"
6565
# - "1.1.*"
66-
- "1.3.*"
66+
# - "1.3.*"
67+
- "1.4.*"
6768
steps:
6869
- uses: actions/setup-go@v4
6970
with:

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ sense and what doesn't.
1010

1111
## Items Done
1212

13+
- added group and user resources and data sources
1314
- basic acceptance tests
1415
- documentation (content, consistency)
1516
- added image definition data source

docs/data-sources/groups.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,23 @@ description: |-
1010

1111
A data source that retrieves a list of permission group information from the controller.
1212

13-
13+
## Example Usage
14+
15+
```terraform
16+
# Get a list of all groups on the system or a specific group.
17+
# For a specific group, the length of the list is always one if the
18+
# group is found, zero otherwise.
19+
#
20+
# Group names are enforced to be unique!
21+
22+
data "cml2_groups" "students" {
23+
name = "students"
24+
}
25+
26+
output "student_group_id" {
27+
value = data.cml2_groups.students.groups[0].id
28+
}
29+
```
1430

1531
<!-- schema generated by tfplugindocs -->
1632
## Schema

docs/data-sources/system.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ description: |-
1010

1111
A data source that retrieves system state information from the controller. If a `timeout` is set then this will only return when the system responds.
1212

13-
13+
## Example Usage
14+
15+
```terraform
16+
# ensure the system is ready to talk to by using this data source
17+
# with a timeout like 5m (5 minutes)
18+
19+
data "cml2_system" "wait_for_ready" {
20+
timeout = "5m"
21+
}
22+
output "readiness" {
23+
value = data.cml2_system.wait_for_ready.version
24+
}
25+
```
1426

1527
<!-- schema generated by tfplugindocs -->
1628
## Schema

docs/data-sources/users.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,23 @@ description: |-
1010

1111
A data source that retrieves a list of users from the controller.
1212

13+
## Example Usage
1314

15+
```terraform
16+
# Get a list of all users on the system or a specific user.
17+
# For a specific user, the length of the list is always one if the
18+
# user is found, zero otherwise.
19+
#
20+
# User names are enforced to be unique!
21+
22+
data "cml2_users" "get_admin" {
23+
username = "admin"
24+
}
25+
26+
output "admin_id" {
27+
value = data.cml2_users.get_admin.users[0].id
28+
}
29+
```
1430

1531
<!-- schema generated by tfplugindocs -->
1632
## Schema
@@ -38,7 +54,7 @@ Read-Only:
3854
- `is_admin` (Boolean) True if the user has admin rights.
3955
- `labs` (Set of String) Set of lab IDs the user owns.
4056
- `opt_in` (Boolean) True if has opted in to sending telemetry data.
41-
- `password` (String) Password of the user.
57+
- `password` (String, Sensitive) Password of the user.
4258
- `resource_pool` (String) Resource pool ID, if any.
4359
- `username` (String) Login name of the user.
4460

docs/resources/group.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,47 @@ description: |-
1010

1111
A resource which handles permission groups.
1212

13-
13+
## Example Usage
14+
15+
```terraform
16+
# this example shows the use of user and group resources
17+
# to control access to a lab.
18+
# Note that these resources will be removed at destroy time!
19+
20+
resource "cml2_user" "student1" {
21+
username = "student1"
22+
password = "secret"
23+
fullname = "Joe Learner"
24+
25+
description = "This is the Student 1 account"
26+
is_admin = false
27+
}
28+
29+
resource "cml2_user" "student2" {
30+
username = "student2"
31+
password = "secret"
32+
fullname = "Jane Learner"
33+
34+
description = "This is the Student 2 account"
35+
is_admin = false
36+
}
37+
38+
resource "cml2_lab" "student_lab" {
39+
title = "Student Lab"
40+
}
41+
42+
resource "cml2_group" "students" {
43+
description = "Permission group for all students"
44+
name = "students"
45+
members = [cml2_user.student1.id, cml2_user.student2.id]
46+
labs = [
47+
{
48+
id = cml2_lab.student_lab.id
49+
permission = "read_write"
50+
},
51+
]
52+
}
53+
```
1454

1555
<!-- schema generated by tfplugindocs -->
1656
## Schema

docs/resources/user.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,27 @@ description: |-
1010

1111
A resource which handles users.
1212

13+
## Example Usage
1314

15+
```terraform
16+
# Create a user account
17+
18+
resource "cml2_user" "student1" {
19+
username = "student1"
20+
password = "secret"
21+
fullname = "Joe Learner"
22+
23+
description = "This is the Student 1 account"
24+
is_admin = false
25+
}
26+
```
1427

1528
<!-- schema generated by tfplugindocs -->
1629
## Schema
1730

1831
### Required
1932

20-
- `password` (String) Password of the user.
33+
- `password` (String, Sensitive) Password of the user.
2134
- `username` (String) Login name of the user.
2235

2336
### Optional
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Get a list of all groups on the system or a specific group.
2+
# For a specific group, the length of the list is always one if the
3+
# group is found, zero otherwise.
4+
#
5+
# Group names are enforced to be unique!
6+
7+
data "cml2_groups" "students" {
8+
name = "students"
9+
}
10+
11+
output "student_group_id" {
12+
value = data.cml2_groups.students.groups[0].id
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ensure the system is ready to talk to by using this data source
2+
# with a timeout like 5m (5 minutes)
3+
4+
data "cml2_system" "wait_for_ready" {
5+
timeout = "5m"
6+
}
7+
output "readiness" {
8+
value = data.cml2_system.wait_for_ready.version
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Get a list of all users on the system or a specific user.
2+
# For a specific user, the length of the list is always one if the
3+
# user is found, zero otherwise.
4+
#
5+
# User names are enforced to be unique!
6+
7+
data "cml2_users" "get_admin" {
8+
username = "admin"
9+
}
10+
11+
output "admin_id" {
12+
value = data.cml2_users.get_admin.users[0].id
13+
}

0 commit comments

Comments
 (0)