Skip to content

Commit ce21b52

Browse files
authored
Add documentation for environment config use (#74)
1 parent 7de2f12 commit ce21b52

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,60 @@ servicePrincipalsRef: "spec.servicePrincipalConfig.names" # Get service princip
339339
target: "status.servicePrincipals"
340340
```
341341

342+
## Using data from EnvironmentConfig
343+
344+
To use data from a Crossplane `EnvironmentConfig`, first load the data into the context using [function-environment-configs](https://github.com/crossplane-contrib/function-environment-configs). This function should be in the pipeline before you use function-msgraph.
345+
346+
function-environment-configs loads a merged map of environment config data to `context["apiextensions.crossplane.io/environment"]` but to refer to this correctly in function-msgraph the following syntax must be used: `context.[apiextensions.crossplane.io/environment]`.
347+
348+
### Example:
349+
350+
1. First, define your Environment Config:
351+
352+
```yaml
353+
apiVersion: apiextensions.crossplane.io/v1beta1
354+
kind: EnvironmentConfig
355+
metadata:
356+
name: example-config
357+
data:
358+
entraid:
359+
users:
360+
361+
```
362+
363+
2. Load the Environment Config in to your composition pipeline:
364+
365+
```yaml
366+
pipeline:
367+
- step: load-environment-config
368+
functionRef:
369+
name: crossplane-contrib-function-environment-configs
370+
input:
371+
apiVersion: environmentconfigs.fn.crossplane.io/v1beta1
372+
kind: Input
373+
spec:
374+
environmentConfigs:
375+
- type: Reference
376+
ref:
377+
name: example-config
378+
```
379+
380+
3. Reference the Environment Config data in your function input:
381+
382+
```yaml
383+
- step: load-environment-config
384+
# ... omitted for brevity
385+
- step: get-group-members
386+
functionRef:
387+
name: function-msgraph
388+
input:
389+
apiVersion: msgraph.fn.crossplane.io/v1alpha1
390+
kind: Input
391+
queryType: GroupMembership
392+
groupRef: context.[apiextensions.crossplane.io/environment].entraid.users
393+
target: "status.users"
394+
```
395+
342396
## Using Different Credentials
343397

344398
### Using ServicePrincipal credentials

0 commit comments

Comments
 (0)