Skip to content

Commit 1056b1c

Browse files
committed
Updated documentation and tests
1 parent acfb061 commit 1056b1c

File tree

6 files changed

+64
-66
lines changed

6 files changed

+64
-66
lines changed

docs/resources/lab.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ A lab resource represents a CML lab. At create time, a lab title, lab descriptio
1414

1515
```terraform
1616
# This shows the use of a lab with nodes and links the links are explicitly
17-
# specified with slots Nothing will be started, just basic create, read update /
18-
# delete.
17+
# specified with slots Nothing will be started, just basic create, read update
18+
# and delete.
1919
2020
resource "cml2_lab" "twonode" {
2121
title = "two node lab"

docs/resources/lifecycle.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,17 @@ resource "cml2_link" "l4" {
105105
106106
resource "cml2_lifecycle" "top" {
107107
lab_id = cml2_lab.this.id
108-
# the elements list has the dependencies
109-
elements = [
110-
cml2_node.ext.id,
111-
cml2_node.ums1.id,
112-
cml2_node.r1.id,
113-
cml2_node.r2.id,
114-
cml2_node.r3.id,
115-
cml2_link.l0.id,
116-
cml2_link.l1.id,
117-
cml2_link.l2.id,
118-
cml2_link.l3.id,
119-
cml2_link.l4.id,
108+
depends_on = [
109+
cml2_node.ext,
110+
cml2_node.ums1,
111+
cml2_node.r1,
112+
cml2_node.r2,
113+
cml2_node.r3,
114+
cml2_link.l0,
115+
cml2_link.l1,
116+
cml2_link.l2,
117+
cml2_link.l3,
118+
cml2_link.l4,
120119
]
121120
staging = {
122121
stages = ["infra", "group1"]

examples/resources/cml2_lab/resource.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This shows the use of a lab with nodes and links the links are explicitly
2-
# specified with slots Nothing will be started, just basic create, read update /
3-
# delete.
2+
# specified with slots Nothing will be started, just basic create, read update
3+
# and delete.
44

55
resource "cml2_lab" "twonode" {
66
title = "two node lab"

examples/resources/cml2_lifecycle/eleven-nodes.tf

+24-24
Original file line numberDiff line numberDiff line change
@@ -199,34 +199,34 @@ resource "cml2_link" "l10" {
199199

200200
resource "cml2_lifecycle" "top" {
201201
lab_id = cml2_lab.this.id
202-
elements = [
202+
depends_on = [
203203
# Note that referencing all elements is not strictly
204204
# required. As an alternative, a single "sentinel"
205205
# node could be used which is started at the very end
206206
# based on its tag. In particular, links could be ommited.
207-
cml2_node.ext.id,
208-
cml2_node.ums1.id,
209-
cml2_node.ios.id,
210-
cml2_node.r1.id,
211-
cml2_node.r3.id,
212-
cml2_node.r4.id,
213-
cml2_node.r5.id,
214-
cml2_node.r6.id,
215-
cml2_node.r7.id,
216-
cml2_node.r8.id,
217-
cml2_node.r9.id,
218-
219-
cml2_link.l0.id,
220-
cml2_link.l1.id,
221-
cml2_link.l2.id,
222-
cml2_link.l3.id,
223-
cml2_link.l4.id,
224-
cml2_link.l5.id,
225-
cml2_link.l6.id,
226-
cml2_link.l7.id,
227-
cml2_link.l8.id,
228-
cml2_link.l9.id,
229-
cml2_link.l10.id
207+
cml2_node.ext,
208+
cml2_node.ums1,
209+
cml2_node.ios,
210+
cml2_node.r1,
211+
cml2_node.r3,
212+
cml2_node.r4,
213+
cml2_node.r5,
214+
cml2_node.r6,
215+
cml2_node.r7,
216+
cml2_node.r8,
217+
cml2_node.r9,
218+
219+
cml2_link.l0,
220+
cml2_link.l1,
221+
cml2_link.l2,
222+
cml2_link.l3,
223+
cml2_link.l4,
224+
cml2_link.l5,
225+
cml2_link.l6,
226+
cml2_link.l7,
227+
cml2_link.l8,
228+
cml2_link.l9,
229+
cml2_link.l10
230230
]
231231
configs = {
232232
"R1" : "hostname injected-hostname"

examples/resources/cml2_lifecycle/resource.tf

+11-12
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,17 @@ resource "cml2_link" "l4" {
9090

9191
resource "cml2_lifecycle" "top" {
9292
lab_id = cml2_lab.this.id
93-
# the elements list has the dependencies
94-
elements = [
95-
cml2_node.ext.id,
96-
cml2_node.ums1.id,
97-
cml2_node.r1.id,
98-
cml2_node.r2.id,
99-
cml2_node.r3.id,
100-
cml2_link.l0.id,
101-
cml2_link.l1.id,
102-
cml2_link.l2.id,
103-
cml2_link.l3.id,
104-
cml2_link.l4.id,
93+
depends_on = [
94+
cml2_node.ext,
95+
cml2_node.ums1,
96+
cml2_node.r1,
97+
cml2_node.r2,
98+
cml2_node.r3,
99+
cml2_link.l0,
100+
cml2_link.l1,
101+
cml2_link.l2,
102+
cml2_link.l3,
103+
cml2_link.l4,
105104
]
106105
staging = {
107106
stages = ["infra", "group1"]

internal/provider/resource/lifecycle/lifecycle_test.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,10 @@ resource "cml2_link" "l1" {
308308
309309
resource "cml2_lifecycle" "top" {
310310
lab_id = cml2_lab.this.id
311-
elements = [
312-
cml2_node.r1.id,
313-
cml2_node.r2.id,
314-
cml2_link.l1.id,
311+
depends_on = [
312+
cml2_node.r1,
313+
cml2_node.r2,
314+
cml2_link.l1,
315315
]
316316
}
317317
`, cfg)
@@ -380,13 +380,13 @@ resource "cml2_link" "l2" {
380380
381381
resource "cml2_lifecycle" "top" {
382382
lab_id = cml2_lab.this.id
383-
elements = [
384-
cml2_node.ext.id,
385-
cml2_node.ums.id,
386-
cml2_node.r1.id,
387-
cml2_node.r2.id,
388-
cml2_link.l1.id,
389-
cml2_link.l2.id,
383+
depends_on = [
384+
cml2_node.ext,
385+
cml2_node.ums,
386+
cml2_node.r1,
387+
cml2_node.r2,
388+
cml2_link.l1,
389+
cml2_link.l2,
390390
]
391391
staging = {
392392
stages = [ "bla" ]
@@ -404,7 +404,7 @@ resource "cml2_lab" "this" {
404404
}
405405
resource "cml2_lifecycle" "top" {
406406
lab_id = cml2_lab.this.id
407-
elements = []
407+
depends_on = []
408408
state = %[2]q
409409
}
410410
`, cfg, state)
@@ -526,7 +526,7 @@ resource "cml2_link" "l2" {
526526
527527
resource "cml2_lifecycle" "top" {
528528
lab_id = cml2_lab.this.id
529-
elements = [
529+
depends_on = [
530530
cml2_node.ext.id,
531531
cml2_node.ums.id,
532532
cml2_node.r1.id,
@@ -601,7 +601,7 @@ resource "cml2_link" "l3" {
601601
602602
resource "cml2_lifecycle" "top" {
603603
lab_id = cml2_lab.this.id
604-
elements = [
604+
depends_on = [
605605
cml2_node.ext.id,
606606
cml2_node.ums.id,
607607
cml2_node.r1.id,

0 commit comments

Comments
 (0)