Crossplate GoTemplate Syntax

30 views
Skip to first unread message

Manoj Kumar

unread,
Jul 31, 2024, 9:27:08 AM7/31/24
to crossplane-dev
Hello guys,

I'm using the go-template function in crossplane composition, where I need to initialize the list of ports. Once the list is created I will loop and add the ports to the resource.

Desired Syntax
{{ $ports := [9000, 8000, 7008] }}
{{ range $port := $ports }}
               kind: some-resource
                fromPort: {{ $port }}
                toPort: {{ $port }}
                securityGroupIdRef:
                  name: some-group
                type: ingress

{{ end}}

How can I achieve the above syntax? If anyone has the examples?

Thanks in advance
Manoj
Reply all
Reply to author
Forward
0 new messages