Azure / terraform-azure-container-apps

A Terraform module to deploy a container app in Azure
https://github.com/Azure/terraform-azure-container-apps
35 stars 22 forks source link

Unable to pull container from docker hub #10

Closed nfishel48 closed 12 months ago

nfishel48 commented 1 year ago

Is there an existing issue for this?

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.5.3

Module Version

0.1.0

AzureRM Provider Version

3.65.0

Affected Resource(s)/Data Source(s)

azurerm_container_app

Terraform Configuration Files

terraform {
backend "remote" {
    hostname = "app.terraform.io"
    organization = "<org>"

    workspaces {
      name = "<workspace>"
    }
  }
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 3.11, < 4.0"
    }
  }
}

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "rg" {
  location = var.location
  name     = var.resource_group_name
}

module "containerapps" {
    source = "./containerapps/"
    container_app_environment_name = var.container_app_environment_name
    container_apps = var.container_apps
    location = var.location
    log_analytics_workspace_name = var.log_analytics_workspace_name
    resource_group_name = azurerm_resource_group.rg.name
    container_app_secrets = var.container_app_secrets

}

tfvars variables values

container_app_environment_name = "dev1"
log_analytics_workspace_name = "dev1"
resource_group_name = "dev1"
location = "eastus2"
container_apps = {
    "proxy" = {
        name = "proxy" 
            revision_mode = "Single"
            template = {
                containers =[{
                    name = "proxy"
                    image = "registry.hub.docker.com/nfishel/proxy:latest"
                    cpu = ".25"
                    memory = "0.5Gi"
                    max_replicas = 10
                    min_replicas = 0
                    dapr = {
                        app_id = "proxy"
                        app_port = 3010
                    }
                    ingress = {
                        external_enabled = true
                        target_port = 3010
                    }
                    registry = [{
                        server = "registry.hub.docker.com"
                        username = "nfishel"
                        password_secret_name = "registry"
                    }]
                }]
            }
    }
}

container_app_secrets = {
    "proxy" = [
        {
            name = "registry"
            value = "******"
        }   
    ]
}

Debug Output/Panic Output

module.containerapps.azurerm_container_app.container_app["proxy"]: Modifying... [id=/subscriptions/************************************/resourceGroups/dev1/providers/Microsoft.App/containerApps/proxy]
╷
│ Error: updating Container App (Subscription: "************************************"
│ Resource Group Name: "dev1"
│ Container App Name: "proxy"): performing CreateOrUpdate: containerapps.ContainerAppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="InvalidParameterValueInContainerTemplate" Message="The following field(s) are either invalid or missing. Field 'template.containers.proxy.image' is invalid with details: 'Invalid value: \"registry.hub.docker.com/*******/proxy:latest\": GET https:: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:*******/proxy Type:repository]]';."
│ 
│   with module.containerapps.azurerm_container_app.container_app["proxy"],
│   on containerapps/main.tf line 59, in resource "azurerm_container_app" "container_app":
│   59: resource "azurerm_container_app" "container_app" {
│ 
│ updating Container App (Subscription: "************************************"
│ Resource Group Name: "dev1"
│ Container App Name: "proxy"): performing CreateOrUpdate: containerapps.ContainerAppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="InvalidParameterValueInContainerTemplate" Message="The following field(s) are either invalid or missing. Field 'template.containers.proxy.image' is invalid with details: 'Invalid value: \"registry.hub.docker.com/*******/proxy:latest\": GET https:: UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:*******/proxy Type:repository]]';."
╵

Exited with code exit status 1

Expected Behaviour

The container should be pull successfully, when configured through the web ui this works.

Actual Behaviour

Terrafrom apply fails

Steps to Reproduce

No response

Important Factoids

Azure for startups sponsored subscription, standard azure cloud

References

No response