api-version: 2024-02-02-preview
location: {{ .Env.AZURE_LOCATION }}
identity:
  type: UserAssigned
  userAssignedIdentities:
    ? "{{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}"
    : {}
properties:
  environmentId: {{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_ID }}
  configuration:
    activeRevisionsMode: single
    runtime:
      dotnet:
        autoConfigureDataProtection: true
    ingress:
      external: false
      targetPort: 6379
      transport: tcp
      allowInsecure: false
    registries:
      - server: {{ .Env.AZURE_CONTAINER_REGISTRY_ENDPOINT }}
        identity: {{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}
    secrets:
      - name: redis-password
        value: '{{ securedParameter "cache_password" }}'
  template:
    containers:
      - image: {{ .Image }}
        name: cache
        args:
          - -c
          - redis-server --requirepass $REDIS_PASSWORD
        command: [/bin/sh]
        env:
          - name: AZURE_CLIENT_ID
            value: {{ .Env.MANAGED_IDENTITY_CLIENT_ID }}
          - name: REDIS_PASSWORD
            secretRef: redis-password
    scale:
      minReplicas: 1
tags:
  azd-service-name: cache
  aspire-resource-name: cache
