I want to make a simple copy of file that is located in one module folder to another module folder, but it seems that terraform do not have such kind of resource. I tried to do this with null_resource, but interpreter looses all environment through execution. With local_file it also do not work properly. Can you advice how to do this?
Tried this, but "data" source is searching for file before apply and this failes:
data "local_file" "code" {
filename = "${path.module}/code.zip"
depends_on = [null_resource.build_package]
}
# copy package to module root directory
resource "local_file" "code" {
content_base64 = data.local_file.code.content_base64
filename = "${path.root}/resources/code_elasticsearch_proxy.zip"
}
Also tried:
resource "null_resource" "code" {
provisioner "local-exec" {
command = "cp ./${path.module}/code.zip ./code_elasticsearch_proxy.zip"
interpreter = ["bash"]
environment = {
PWD = path.root
}
}
}
But this one looses all environment and i could not have the full path to files