I was building a simple infrastructure using terraform (for AWS), I came accross the chicken egg of Lambda functions needing an image to be created. The options I envisioned are two:

1 - I decouple docker images and infrastructure (but this means that I need to be careful about having syncd the infrastructure and deployment scripts and I need to manually transmit infrastructure variables to the deployment pipeline (e.g. account number/ docker registry)

2 - Unify infrastructure and deployment, I build and update docker images directly from terraform, every time I want to update any part of my application I will terraform apply. Usually this will update only the docker images.

I think this second option is great, and will allow me to basically replicate my application anywhere with a single command and with a single configuration. At the same time, many people scream bad practice. What are possible disadvantages and why should not it be done ?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.