{
  // Allows creating and deleting vault parameters
  "id": "vault/provision",
  "description": "Allows creating and deleting vault parameters",
  "platforms": {
    "aws": [
      {
        "grant": {
          "actions": ["ssm:PutParameter", "ssm:DeleteParameter"]
        },
        "binding": {
          "stack": {
            "resources": ["arn:aws:ssm:${awsRegion}:${awsAccountId}:parameter/${stackPrefix}-*"]
          },
          "resource": {
            "resources": [
              "arn:aws:ssm:${awsRegion}:${awsAccountId}:parameter/${stackPrefix}-${resourceName}-*"
            ]
          }
        }
      }
    ],
    "gcp": [
      {
        "grant": {
          "permissions": [
            "secretmanager.secrets.create",
            "secretmanager.secrets.delete",
            "resourcemanager.projects.getIamPolicy",
            "resourcemanager.projects.setIamPolicy"
          ]
        },
        "binding": {
          "stack": {
            "scope": "projects/${projectName}",
            "condition": {
              "title": "Vault provision access",
              "expression": "resource.type == 'secretmanager.googleapis.com/Secret' && resource.name.startsWith('projects/${projectName}/secrets/${stackPrefix}-')"
            }
          },
          "resource": {
            "scope": "projects/${projectName}",
            "condition": {
              "title": "Vault provision access",
              "expression": "resource.type == 'secretmanager.googleapis.com/Secret' && resource.name.startsWith('projects/${projectName}/secrets/${stackPrefix}-${resourceName}-')"
            }
          }
        }
      }
    ],
    "azure": [
      {
        "grant": {
          "actions": ["Microsoft.KeyVault/vaults/write", "Microsoft.KeyVault/vaults/delete"]
        },
        "binding": {
          "stack": {
            "scope": "/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.KeyVault/vaults/${stackPrefix}-*"
          },
          "resource": {
            "scope": "/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.KeyVault/vaults/${stackPrefix}-${resourceName}"
          }
        }
      }
    ]
  }
}
