Last active
May 22, 2022 15:34
-
-
Save pivotaljohn/9593f971ac5962055ff38c5eeaf1df11 to your computer and use it in GitHub Desktop.
Replacing an array item (rather than appending)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: SecretProviderClass | |
metadata: | |
namespace: default | |
name: db_credentials | |
spec: | |
provider: aws | |
parameters: | |
objects: | | |
- objectName: TO_BE_REPLACED_BY_YTT | |
objectType: "secretsmanager" | |
jmesPath: | |
- path: username | |
objectAlias: dbusername | |
- path: password | |
objectAlias: dbpassword |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:overlay", "overlay") | |
#@ load("@ytt:yaml", "yaml") | |
#@ load("@ytt:data", "data") | |
#@ def updates(): | |
#@overlay/match by=lambda idx,left,right: "objectName" in left | |
- objectName: #@ data.values.db_secret_name | |
#@ end | |
#@overlay/match by=overlay.subset({"kind": "SecretProviderClass", "metadata": {"name": "db_credentials"}}) | |
--- | |
spec: | |
provider: aws | |
parameters: | |
#@overlay/replace via=lambda a,_: yaml.encode(overlay.apply(yaml.decode(a), updates())) | |
objects: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@data/values | |
--- | |
db_secret_name: db-secret-staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment