Skip to content

Instantly share code, notes, and snippets.

@negz
Last active January 23, 2021 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save negz/64ae8854f82488556f57b72d8e1dec1e to your computer and use it in GitHub Desktop.
Save negz/64ae8854f82488556f57b72d8e1dec1e to your computer and use it in GitHub Desktop.
String transform
- base:
apiVersion: identity.aws.crossplane.io/v1alpha1
kind: IAMPolicy
spec:
forProvider:
description: "policy to access dynamodb table."
patches:
- type: PatchSet
patchSetName: Metadata
- fromFieldPath: "metadata.name"
toFieldPath: "spec.forProvider.name"
- fromFieldPath: "spec.tableName" # Change as needed.
toFieldPath: "spec.forProvider.document"
transforms:
# Note the '%s' string format verb gets replaced with the
# content of spec.tableName (i.e. the fromFieldPath).
- type: string
string:
fmt: |
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"dynamodb:DescribeTable",
"dynamodb:Get*",
"dynamodb:PutItem"
],
"Resource": [
"arn:aws:dynamodb:*:*:table/%s*"
],
"Effect": "Allow"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment