terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

Docker provider build error not surfaced

Open DanielMSchmidt opened this issue 4 years ago • 1 comments
trafficstars

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

Affected Resource(s)

  • RegistryImage in the kreuzwerker/docker provider

Debug Output

cdktf.log outputs this line:

[2021-06-02T13:20:52.443] [DEBUG] default - ╷
│ Error: Error building docker image: 0: When using ADD with more than one source file, the destination must be a directory and end with a /
│
│   with docker_registry_image.backend-image,
│   on cdk.tf.json line 87, in resource.docker_registry_image.backend-image:
│   87:       }
│
╵

Expected Behavior

I would want to see something similar to Error building docker image: 0: When using ADD with more than one source file, the destination must be a directory and end with a / as part of the cdktf output

Actual Behavior

This output is printed (note the double output, the missing error message, and the missing debug output)

⠴ Deploying Stack: aws
Resources
 ✔ AWS_ECR_REPOSITORY   backend-ecr         aws_ecr_repository.backend-ecr
 ⠧ DOCKER_REGISTRY_IMAG backend-image       docker_registry_image.backend-image
   E

Summary: 1 created, 0 updated, 0 destroyed.
╷
⠴ Deploying Stack: aws
Resources
 ✔ AWS_ECR_REPOSITORY   backend-ecr         aws_ecr_repository.backend-ecr
 ⠇ DOCKER_REGISTRY_IMAG backend-image       docker_registry_image.backend-image
   E

Summary: 1 created, 0 updated, 0 destroyed.
non-zero exit code 1

Steps to Reproduce

Use TerraformAsset + RegistryImage to build an invalid docker image

Workaround

Enabling the debug logs with CDKTF_DISABLE_LOGGING=false helped me debug this, I find this flag pretty hidden, maybe we could add a verbose/log entry in the cdktf.json so that people stumble upon it earlier

Important Factoids

References

  • #0000

DanielMSchmidt avatar Jun 02 '21 11:06 DanielMSchmidt

This seems to be related to https://github.com/hashicorp/terraform-cdk/issues/218

skorfmann avatar Jun 03 '21 08:06 skorfmann