I have this mono repository structure:
└── ansible
└── roles
└── ansible.cfg
└── configure_docker_host.yml
└── terraform
└── docker_servers
└── account_1
└── docker_server.yaml
└── terragrunt.hcl
└── account_2
└── docker_server.yaml
└── terragrunt.hcl
└── terragrunt.hcl
└── common.hcl
└── modules
└── docker_server
I’m trying to copy ansible directory inside the directory where terragrunt will launch terraform
command, so in file terraform/docker_servers/common.hcl
I have the following:
terraform {
after_hook "copy_ansible_playbooks" {
commands = ["init-from-module", "init", "init-all" ]
execute = [
"mkdir -p ${get_working_dir()}",
"cp -R ${get_parent_terragrunt_dir()}/../../ansible} ${get_working_dir()}"
]
}
source = "${get_terragrunt_dir()}/../../modules/docker_server"
}
But I’m having this error:
1 error occurred:
* fork/exec mkdir -p /home/ares/dev/rust/profit_prophet/infrastructure/terraform/docker_servers/account_1/.terragrunt-cache/FB6PXWmS5hbIpIw_-Vf5vQwqLi8/wDv2CAJIERc6793miieXN-ahOEI: no such file or directory
Is there any way to achieve what I’m trying to do ?