Skip to content

Commit

Permalink
Fix output object name (value -> result) (#658)
Browse files Browse the repository at this point in the history
* Fix output object name (value -> result)

* Spellcheck

* Move Bicep into snippet

---------

Co-authored-by: Aaron Crawfis <[email protected]>
  • Loading branch information
kachawla and AaronCrawfis authored Aug 11, 2023
1 parent d11699a commit 4d85c27
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .github/config/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,6 @@ tcp
BucketName
roadmap
Balancer
azureCache
listKeys
primaryKey
17 changes: 3 additions & 14 deletions docs/content/operations/custom-recipes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,9 @@ Linking is done automatically for any new Azure or AWS resource ([_Kubernetes co

[Bicep `existing`](https://learn.microsoft.com/azure/azure-resource-manager/bicep/existing-resource) resources are not currently linked as part of Recipe-enabled resources, meaning you won't see them in the definition of the resource and they aren't [deleted later on](#infrastructure-lifecycle), unlike new resources.

You can also manually link resources via the `values` output of a Recipe. This can be used for Kubernetes resources, [which aren't currently linked automatically]({{< ref "faq#why-do-i-need-to-manually-output-a-kubernetes-ucp-id-as-part-of-my-bicep-recipe" >}}). To link a resource to a Recipe-enabled resource, add its ID to an array of resource IDs:

```bicep
// ....resources defined above
output values object = {
resources: [
// ID via reference (Azure/AWS)
resource1.id
// ID via manual entry (Kubernetes)
'/planes/kubernetes/local/namespaces/${deployment.metadata.namespace}/providers/apps/Deployment/${deployment.metadata.name}'
]
}
```
You can also manually link resources via the `result` output of a Recipe. This can be used for Kubernetes resources, [which aren't currently linked automatically]({{< ref "faq#why-do-i-need-to-manually-output-a-kubernetes-ucp-id-as-part-of-my-bicep-recipe" >}}). To link a resource to a Recipe-enabled resource, add its ID to an array of resource IDs:

{{< rad file="snippets/recipe-outputs.bicep" embed=true marker="//OUTVALUES" >}}

### Step 5: Store your template in a Bicep registry

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource azureResource 'Microsoft.Cache/redis@2022-06-01' existing = {
name: 'mycache'
}

param svc object
param deployment object

//OUTVALUES
output result object = {
resources: [
'/planes/kubernetes/local/namespaces/${svc.metadata.namespace}/providers/core/Service/${svc.metadata.name}'
'/planes/kubernetes/local/namespaces/${deployment.metadata.namespace}/providers/apps/Deployment/${deployment.metadata.name}'
]
values: {
host: '${svc.metadata.name}.${svc.metadata.namespace}.svc.cluster.local'
port: 6379
}
}
//OUTVALUES

0 comments on commit 4d85c27

Please sign in to comment.