resource "aws_cognito_user_pool" "main" {
name = "zero-trust-pool"
password_policy {
minimum_length = 12
require_numbers = true
require_symbols = true
require_uppercase = true
}
mfa_configuration = "ON"
software_token_mfa_configuration {
enabled = true
}
}
resource "aws_cognito_identity_pool" "main" {
identity_pool_name = "zero-trust-identity"
allow_unauthenticated_identities = false
}
apiVersion: networking.istio.io/v1alpha3
kind: AuthorizationPolicy
metadata:
name: zero-trust-policy
spec:
selector:
matchLabels:
app: secure-service
action: ALLOW
rules:
- from:
- source:
principals: ["cluster.local/ns/*/sa/authorized-service"]
requestPrincipals: ["https://accounts.google.com/*/"]
to:
- operation:
methods: ["GET"]
paths: ["/api/secure/*"]
when:
- key: request.auth.claims[groups]
values: ["secure-access-group"]
apiVersion: v1
kind: ServiceAccount
metadata:
name: workload-identity-user
annotations:
iam.gke.io/gcp-service-account: gsa-name@project-id.iam.gserviceaccount.com
---
apiVersion: iam.cnrm.cloud.google.com/v1beta1
kind: IAMServiceAccount
metadata:
name: gsa-name
spec:
displayName: "Workload Identity Service Account"
apiVersion: azure.microsoft.com/v1beta1
kind: AzureIdentity
metadata:
name: pod-identity
spec:
type: 0
resourceID: /subscriptions/<id>/resourcegroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<name>
clientID: <clientID>
---
apiVersion: azure.microsoft.com/v1beta1
kind: AzureIdentityBinding
metadata:
name: pod-identity-binding
spec:
azureIdentity: pod-identity
selector: azure-pod-identity