Skip to content

Commit

Permalink
Update documentation after required TypeInstance syntax change in Policy
Browse files Browse the repository at this point in the history
  • Loading branch information
pkosiec committed Aug 20, 2021
1 parent b2e32fe commit 6169c1e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/content-development/terraform-manifests.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ To make sure the Terraform-based Implementation is selected, you may use additio
requires:
- path: "cap.type.gcp.auth.service-account"
inject:
typeInstances:
requiredTypeInstances:
# (...)
```
6 changes: 2 additions & 4 deletions docs/example/mattermost-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,9 @@ To change the Mattermost installation, we need to adjust our Global policy to pr
requires:
- path: "cap.type.gcp.auth.service-account"
inject:
typeInstances:
requiredTypeInstances:
- id: ${TI_ID}
typeRef:
path: "cap.type.gcp.auth.service-account"
revision: "0.1.0"
description: "GCP Service Account"
- interface:
path: cap.*
oneOf:
Expand Down
10 changes: 5 additions & 5 deletions docs/feature/policies/global-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ rules: # Configures the following behavior for Engine during rendering Action
- path: "cap.type.gcp.auth.service-account"
# in any revision
inject:
typeInstances: # For such Implementation, inject the following TypeInstances:
requiredTypeInstances: # For such Implementation, inject the following TypeInstances if matching Type Reference is used in `Implementation.spec.requires` property along with `alias`:

# Find Type Reference for the given TypeInstance ID. Then, find the alias of the Type reference in `spec.requires` property.
# If it is defined, inject the TypeInstance with ID `9038dcdc-e959-41c4-a690-d8ebf929ac0c` under this alias.
- id: 9038dcdc-e959-41c4-a690-d8ebf929ac0c
typeRef: # Find the alias of the Type reference in `spec.requires` property.
# If it is defined, inject the TypeInstance with ID `9038dcdc-e959-41c4-a690-d8ebf929ac0c` under this alias.
path: "cap.type.gcp.auth.service-account"
revision: "0.1.0"
description: "GCP Service Account" # optional

- implementationConstraints: # In second place find and select Implementation which:
attributes: # contains the following attributes
Expand Down
12 changes: 6 additions & 6 deletions docs/feature/policies/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ You can also deny all Implementations for a given Interface with the following s
oneOf: [] # deny all Implementations for a given Interface
```

### TypeInstance injection
### Required TypeInstance injection

Along with Implementation constraints, Cluster Admin may configure TypeInstances, which are downloaded and injected in the Implementation workflow. This can be helpful for example, in case you are using Implementations, which are deploying infrastructure on a public cloud (like AWS or GCP) and you want to ensure that everything is deployed in the same account. For example:
Along with Implementation constraints, Cluster Admin may configure TypeInstances, which are downloaded and injected in the Implementation workflow. The prerequisite is that the Implementation must contain matching Type Reference in `spec.requires` property, along with defined `alias` for such requirement.

This can be helpful, for example, in case you are using Implementations, which are deploying infrastructure on a public cloud (like AWS or GCP) and you want to ensure that everything is deployed in the same account. For example:

```yaml
rules:
Expand All @@ -135,11 +137,9 @@ rules:
requires:
- path: "cap.type.gcp.auth.service-account"
inject:
typeInstances:
requiredTypeInstances:
- id: 9038dcdc-e959-41c4-a690-d8ebf929ac0c
typeRef:
path: "cap.type.gcp.auth.service-account"
revision: "0.1.0"
description: "GCP Service Account" # optional
```

> **NOTE:** Instructions how to create a TypeInstance using the Capact CLI can be found [here](./../../cli/commands/capact_typeinstance_create.md).
Expand Down

0 comments on commit 6169c1e

Please sign in to comment.