It seems Chef isn’t good at deploying cloud infrastructure. According to this, Chef is procedural, not declarative. This means the following pseudocode in Chef:
spin-up four web-servers using AMI: LAMP-Server-AMI
Will result in four new web-servers being deployed each time the code is run. Whereas declarative tools like Terraform and Puppet will ignore the code after the first time because the web-servers already exist. The latter is preferable since it is idempotent and automation-pipeline friendly. Can of course use Terraform for the infrastructure alongside Chef to do any in-OS config, but there shouldn’t be any in-OS config if you’re running a microservices environment, since you should just be changing AMIs and re-deploying instances\environments.
My question is: does the same apply to docker? If I want to run the following pseudocode:
spin-up four web-servers in docker containers using image: LAMP-Server-Docker-Image
Will Chef be aware that either the docker-host or cluster being deployed to already has four such web-servers, or will it re-provision them every time?