which implements a script of shell commands to move around files, create
a KinD cluster and, finally, deploy your MetalLB service as done in [Lab K8s](https://gitedu.hesge.ch/lsds/teaching/bachelor/cloud-and-deployment/lab-k8s/-/blob/main/README.md#part-5-actually-deploying-an-application).
The solution might be something like:
``` hcl
resource"terraform_data""kind_cluster"{
connection{
type="ssh"
user=...
private_key=...
host=...
}
provisioner"file"{
source=...
destination=...
}
provisioner"file"{
...
}
provisioner"remote-exec"{
inline=[
"shell command",
...,
]
}
}
```
:bulb: Please mind that:
- The provisioner blocks are processed in the order of appearance.
- For a maximum of flexibility, it is advisable to write 2
`terraform_data` blocks: one for KinD and another for MetalLB. This way you
can test the creation of the two resources separately.
:warning: You will probably hit some thorny issues:
- Depending on how you code the `terraform_data` block(s), the resource(s)
might get processed too soon or in the wrong order. So, be sure of using
*variable references* so as to induce indirect dependencies. You might also
need to explicitly declare a `depends_on` list.
- Before doing anything, you must wait for Cloud-init to finish its tasks:
this can take several minutes (at least 4-5).
- KinD and K8s are very complex and, during set up, might fail in unexpected
ways, chiefly because of system/network issues. Thus, it is wise to wait a
bit (at least 20-30 seconds) after each `kind/kubectl` command.
#### Task #10.2 Auxiliary K8s plan provisioning ####
:warning: **Under construction!**
As you have you seen, the resource-less provisioning approach is ridden with
pitfalls. A better, more programmatic way is to employ an auxiliary TF plan