Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow get composed resource with dots in name #138

Closed
twobiers opened this issue Nov 12, 2024 · 0 comments · Fixed by #139
Closed

Allow get composed resource with dots in name #138

twobiers opened this issue Nov 12, 2024 · 0 comments · Fixed by #139
Labels
bug Something isn't working

Comments

@twobiers
Copy link
Contributor

What happened?

When trying to get a composed resource with dots in the name, it does not work.

How can we reproduce it?

apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
  name: example-function-get-composed-resource
spec:
  compositeTypeRef:
    apiVersion: example.crossplane.io/v1beta1
    kind: XR
  mode: Pipeline
  pipeline:
    - step: render-templates
      functionRef:
        name: function-go-templating
      input:
        apiVersion: gotemplating.fn.crossplane.io/v1beta1
        kind: GoTemplate
        source: Inline
        inline:
          template: |
            ---
            {{ $flexServerResourceName := "flex.server" }}
            # Create an initial composed resource for which we will retrieve a value
            apiVersion: dbforpostgresql.azure.upbound.io/v1beta1
            kind: FlexibleServer
            metadata:
              annotations:
                {{ setResourceNameAnnotation $flexServerResourceName }}
                gotemplating.fn.crossplane.io/ready: "False"
            spec:
              forProvider:
                storageMb: 32768
              providerConfigRef:
                name: my-provider-cfg
            ---
            # Use getComposedResource to retrieve the observed resource named "flexServer"
            {{ $flexServer := getComposedResource . $flexServerResourceName }}
            
            apiVersion: dbforpostgresql.azure.upbound.io/v1beta1
            kind: FlexibleServerConfiguration
            metadata:
              annotations:
                {{ setResourceNameAnnotation "flexServerConfig" }}
                gotemplating.fn.crossplane.io/ready: "False"
            spec:
              forProvider:
                # Populate the field using the observed status of the retrieved resource
                serverId: {{ get $flexServer.status "id" }}

              providerConfigRef:
                name: my-provider-cfg

What environment did it happen in?

Function version: 0.8.0

@twobiers twobiers added the bug Something isn't working label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant