[Terraform] Deploying app is failing when you assign port numbers

this is the code that deploys the qovery application

resource "qovery_application" "docker_application" {
  environment_id = var.qovery_environment_id
  name           = var.app_name
  git_repository = {
    url       = var.git_url
    branch    = var.branch    # Optional
    root_path = var.root_path # Optional
  }

  build_mode            = var.docker_build_mode
  dockerfile_path       = var.dockerfile_path
  state                 = var.state
  auto_preview          = var.auto_preview
  cpu                   = var.cpu
  memory                = var.memory
  min_running_instances = var.min_running_instances
  max_running_instances = var.max_running_instances
  ports                 = ["5555"]
}

Then I get the following error

╷
│ Error: Incorrect attribute value type
│ 
│   on modules/qovery/app-docker/app.tf line 18, in resource "qovery_application" "docker_application":
│   18:   ports                 = ["5555"]
│ 
│ Inappropriate value for attribute "ports": element 0: object required.
╵
Operation failed: failed running terraform plan (exit 1)

@dugwa try this

...
  ports                 = [
    {
      internal_port       = 5555
      external_port       = 443
      protocol            = "HTTP"
      publicly_accessible = true
    }
  ]

It should work

bravo - thanks

did the trick

1 Like