{
  // Allows managing vault configuration (read-only metadata access)
  "id": "vault/management",
  "description": "Allows managing vault configuration (read-only metadata access)",
  "platforms": {
    "aws": [
      {
        "grant": {
          "actions": ["ssm:DescribeParameters"]
        },
        "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.get", "secretmanager.secrets.list"]
        },
        "binding": {
          "stack": {
            "scope": "projects/${projectName}",
            "condition": {
              "title": "Vault management access",
              "expression": "resource.type == 'secretmanager.googleapis.com/Secret' && resource.name.startsWith('projects/${projectName}/secrets/${stackPrefix}-')"
            }
          },
          "resource": {
            "scope": "projects/${projectName}",
            "condition": {
              "title": "Vault management access",
              "expression": "resource.type == 'secretmanager.googleapis.com/Secret' && resource.name.startsWith('projects/${projectName}/secrets/${stackPrefix}-${resourceName}-')"
            }
          }
        }
      }
    ],
    "azure": [
      {
        "grant": {
          "actions": ["Microsoft.KeyVault/vaults/read"]
        },
        "binding": {
          "stack": {
            "scope": "/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.KeyVault/vaults/${stackPrefix}-*"
          },
          "resource": {
            "scope": "/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.KeyVault/vaults/${stackPrefix}-${resourceName}"
          }
        }
      }
    ]
  }
}
