Hey guys, I have the following scenario:
I'm running a certain job, let's stay a terraform init — this command runs in one container A, which runs successfully and I'm exporting two things to the host (this part works well): .terraform (folder with content, meaning files and subdirectories) and .terraform.lock.hcl file.
Then, there's (with the same dagger client connected) a second container that runs terraform plan — of course it's going to fail if I'm not passing it the generated .terraform directory and the .terraform.lock.hcl which is precisely what I'm doing with this function:
func (c *ContainerImporterImpl) AddDataToImportInContainer(container *dagger.Container, options *DataTransferToContainer) (*dagger.Container, error) {
for _, file := range options.Files {
daggerFile := c.td.DaggerBackend.Host().File(file.SourcePathInHostAbs)
container = container.WithFile(file.DestinationPathInContainer, daggerFile)
}
for _, dir := range options.Dirs {
daggerDir := c.td.DaggerBackend.Host().Directory(dir.SourcePathInHostAbs)
container = container.WithMountedDirectory(dir.DestinationPathInContainer, daggerDir)
}
return container, nil
}
I'm getting an error that says basically that the declared plugins into the .terraform.lock.hcl file aren't consistent with the .terraform plugins — which means, I'm uncertain that I've uploaded the whole content of the generated .terraform directory. Would the WithMountedDirectory be enough to mount the .terraform directory from the host (which was exported from the container A) to the workDir target path in container B? What I'm missing here?
