{
  "id": "kv/provision",
  "description": "Allows provisioning and destroying KV stores",
  "platforms": {
    "aws": [
      {
        "grant": {
          "actions": [
            "dynamodb:CreateTable",
            "dynamodb:DeleteTable",
            "dynamodb:DescribeTable",
            "dynamodb:ListTables",
            "dynamodb:UpdateTable",
            "dynamodb:UpdateTimeToLive",
            "dynamodb:DescribeTimeToLive",
            "dynamodb:TagResource",
            "dynamodb:UntagResource",
            "dynamodb:ListTagsOfResource"
          ]
        },
        "binding": {
          "stack": {
            "resources": ["arn:aws:dynamodb:${awsRegion}:${awsAccountId}:table/${stackPrefix}-*"]
          },
          "resource": {
            "resources": ["arn:aws:dynamodb:${awsRegion}:${awsAccountId}:table/${resourceName}"]
          }
        }
      }
    ],
    "gcp": [
      {
        "grant": {
          "permissions": [
            "datastore.databases.get",
            "datastore.databases.create",
            "datastore.databases.update",
            "datastore.databases.delete",
            "datastore.databases.list",
            "datastore.entities.allocateIds",
            "datastore.entities.create",
            "datastore.entities.delete",
            "datastore.entities.get",
            "datastore.entities.list",
            "datastore.entities.update",
            "datastore.indexes.create",
            "datastore.indexes.delete",
            "datastore.indexes.get",
            "datastore.indexes.list",
            "datastore.indexes.update"
          ]
        },
        "binding": {
          "stack": {
            "scope": "projects/${projectName}"
          },
          "resource": {
            "scope": "projects/${projectName}"
          }
        }
      }
    ],
    "azure": [
      {
        "grant": {
          "actions": [
            "Microsoft.Storage/storageAccounts/tableServices/read",
            "Microsoft.Storage/storageAccounts/tableServices/tables/read",
            "Microsoft.Storage/storageAccounts/tableServices/tables/write",
            "Microsoft.Storage/storageAccounts/tableServices/tables/delete",
            "Microsoft.Storage/storageAccounts/read"
          ]
        },
        "binding": {
          "stack": {
            "scope": "/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.Storage/storageAccounts/${storageAccountName}"
          },
          "resource": {
            "scope": "/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.Storage/storageAccounts/${storageAccountName}"
          }
        }
      }
    ]
  }
}
