I'm currently working on a project to automate the cloud environment setup using Infrastructure as Code (IaC). I'm planning on using tools such as ansible and terraform but I need to test if the cloud environment is set up as expected or not. In particular, I'm interested in checking not only the settings itself but also the connectivity among different services before installing applications. For instance, I need to check if the instance is associated with a load balancer and can receiving requests, or an instance can read/write to object storage.
The problem is we want to parameterize the settings so that we can use the same tool to setup different environment (e.g. different project, VPC, etc.) and IPs/names would change for the different environment. We are considering either: 1) using IaC tool to gather settings and test them after building, and 2) use testing tool (e.g. testinfra, inspec, serverspec) to read parameters and test accordingly. My concern is it would require a lot of effort to parse parameters and test accordingly since each environment would have a different environment (e.g. use of different services, # of nodes).
Does anyone have a suggestion for this problem?