diff --git a/example/filesystem/templates.tmpl b/example/filesystem/templates.tmpl index 884e879..be04f66 100644 --- a/example/filesystem/templates.tmpl +++ b/example/filesystem/templates.tmpl @@ -7,11 +7,7 @@ metadata: gotemplating.fn.crossplane.io/composition-resource-name: test-user-{{ $i }} labels: testing.upbound.io/example-name: test-user-{{ $i }} - {{ if or ( eq $.observed.resources nil ) ( eq ( index $.observed.resources ( print "test-user-" $i ) ) nil ) }} - dummy: {{ randomChoice "foo" "bar" "baz" }} - {{ else }} - dummy: {{ ( index $.observed.resources ( print "test-user-" $i ) ).resource.metadata.labels.dummy }} - {{ end }} + dummy: {{ dig "resources" (print "test-user-" $i) "resource" "metadata" "labels" "dummy" ( randomChoice "foo" "bar" "baz" ) $.observed }} spec: forProvider: {} --- diff --git a/example/inline/composition.yaml b/example/inline/composition.yaml index 11e52ea..c3bf663 100644 --- a/example/inline/composition.yaml +++ b/example/inline/composition.yaml @@ -26,11 +26,7 @@ spec: {{ setResourceNameAnnotation (print "test-user-" $i) }} labels: testing.upbound.io/example-name: test-user-{{ $i }} - {{ if or ( eq $.observed.resources nil ) ( eq ( index $.observed.resources ( print "test-user-" $i ) ) nil ) }} - dummy: {{ randomChoice "foo" "bar" "baz" }} - {{ else }} - dummy: {{ ( index $.observed.resources ( print "test-user-" $i ) ).resource.metadata.labels.dummy }} - {{ end }} + dummy: {{ dig "resources" (print "test-user-" $i) "resource" "metadata" "labels" "dummy" ( randomChoice "foo" "bar" "baz" ) $.observed }} spec: forProvider: {} ---