After-deploy Hook - "There is no variable named 'artifact'"

Hi,

trying to find a workaround for this issue Use existing AWS target group · Issue #1174 · hashicorp/waypoint · GitHub I am playing around with an after deployment hook. Unfortunately when trying to use the artifact output variable of the aws-ecs plugin waypoint gives an error saying “There is no variable named ‘artifact’”.

This is my waypoint.hcl

project = "soccerquoteapp"

app "soccerquoteapp" {
  labels = {
    "service" = "soccerquoteapp",
    "env"     = "prod"
  }

  build {
    # use pre-built image (e.g. built from gitlab ci/cd pipeline):
    use "docker-pull" {
      image              = "xxx/soccerquoteapp"
      tag                = "latest"
      disable_entrypoint = true
      encoded_auth       = filebase64("${path.app}/ecr.config.json")
    }
  }

  deploy {
    use "aws-ecs" {
      region = "eu-central-1"
      memory = "1024"
      logging {}
      alb {
        certificate = "xxx"
      }
      log_group    = "wp-soccerquoteapp"
    }

    hook {
      when    = "after"
      command = ["./align_healthcheck.sh", artifact.target_group_arn]
    }
  }
}

I also tried the deploy variable, no luck either. Any ideas anyone?
Thx

I’ve encountered a similar issue with Waypoint and AWS ECS. I’ve followed the provided configuration in waypoint.hcl Futbol libre, but still facing errors regarding the ‘artifact’ variable. Anyone with insights or solutions, your help would be greatly appreciated.

Hi,

It looks like you’re facing an issue with Waypoint and AWS ECS deployment. The error message “There is no variable named ‘artifact’” suggests that the ‘artifact’ variable is not recognized in your configuration.

To troubleshoot this, make sure you are using the correct variable name for the AWS ECS plugin. Instead of ‘artifact.target_group_arn’, you should use ‘deploy.target_group_arn’ to reference the target group ARN.

Here’s the modified section in your ‘waypoint.hcl’ file:

hclCopy code

hook {
  when    = "after"
  command = ["./align_healthcheck.sh", deploy.target_group_arn]
}

Please update your configuration with this change, and it should resolve the issue house. If you encounter any further problems or have more questions, feel free to ask for assistance.