crossplane / crossplane/upjet

Allow configMapRefs for certain properties

Open
#541 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
481
Forks
131
Avg merge
2d 1h
Merged PRs (30d)
11

Description

### What problem are you facing?
I am working on a provider for `auth0/auth0`. Auth0 supports custom HTML and JS files/snippets in many places such as https://registry.terraform.io/providers/auth0/auth0/latest/docs/resources/branding.

In Terraform, i can just maintain the html file alongside the TF and then inline the file contents as given in the example.
The same is not inherently possible in Crossplane, as there is no repo context for the Crossplane controller.

Workarounds:
1. wrap manifests in Helm chart and use `{{ .Files }}`
2. use configurable config languages such as KCL, Jsonnet etc to preprocess manifests and inline the file contents
3. use kustomize to create ConfigMap, then wrap manifests in Compositions and use KCL/go/python as pipeline function to do workaround 2.

### How could Upjet help solve your problem?
Support a resource configuration that allowed to give a configMapRef for certain way.
In the example of `auth0_branding`, the crossplane resource must look like this currently:
```yaml
apiVersion: branding.auth0.crossplane.io/v1alpha1
kind: Branding
name: my-brand
spec:
forProvider:
universalLogin:
- body: |

hello

```
But i would like it to look like this, roughly following what Kubernetes offers for e.g. Pod environments:
```yaml
apiVersion: branding.auth0.crossplane.io/v1alpha1
kind: Branding
name: my-brand
spec:
forProvider:
universalLogin:
- bodyConfigMapKeyRef:
name: tenant-files
key: universal_login_body.html
```

This would allow me to use kustomize with `configMapGenerator` to maintain all files in my repo alongside the crossplane manifests and then reference like this:
```yaml
# kustomize
files:
- branding.yaml
configMapGenerator:
- name: tenant-files
files:
- universal_login_body.html
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.