-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerfile path does not work #585
Comments
@zahornyak try this:
|
@shoootyou Hi, thanks for your response but the main point is to use |
@zahornyak I think if you use the Dockerfile inside of the module you need to specify just "files" in context, something like this:
This originates because the value of path.module depends on the execution. If you run it in the root of your code and it calls the module that has this config, the value of path.module will be the root of your code, not the root of your module. Check this: https://developer.hashicorp.com/terraform/language/expressions/references |
@shoootyou Thanks for the response. I've got it works by setting |
There is a test of this behaviour: terraform-provider-docker/testdata/resources/docker_image/testDockerImageDockerfileOutsideContext.tf Lines 4 to 8 in 7155ab0
seems it should work? |
But behaviour's inconsistent:
i.e. in the latter case, if Which makes sense in isolation / is a usual way to terraform - what's weird is the first case, where it also can't be (It's especially confusing if you have a module for dealing with your images, these are inputs to it, and you have some of each case...) |
I've come across this problem, I've created an extra issue as I did not come across this straightaway. #650 |
Community Note
Terraform (and docker Provider) Version
Terraform v1.5.1
on darwin_amd64
Affected Resource(s)
docker_image
Terraform Configuration Files
Debug Output
Expected Behaviour
Building an image from Dockerfile provided by path in module
Actual Behaviour
Error failed to read dockerfile : no such file or directory
Steps to Reproduce
set the path to your dockerfile(not just "Dockerfile") in module
terraform apply
The text was updated successfully, but these errors were encountered: