As a Schematics user why do I need multiple environments and what purpose do they serve?

93 views Asked by At

I'm looking for some guidance as to what an environment is within this context. What are some best practices for setting up an environment in Schematics?

1

There are 1 answers

1
ckelner On BEST ANSWER

A Schematics environment is analogous to a software environment or sometimes referred to as a tier. At a minimum these often consist of a development, test, and production environment. Read more on this concept here: https://en.wikipedia.org/wiki/Deployment_environment.

Environments allow for the separation of concerns for cloud resources. Each environment is encapsulated from the other, therefore each can operate independently. This allows a development team to simultaneously make a change to a dev and test environment all while not impacting a production grade environment where users interact with the solution.

Schematic environments further allow teams to potentially separate components of their cloud solutions. This could be product based. For example Product A may have three schematic environments: “product-a-dev”, “product-a-qa”, and “product-a-prod”, and Product B may have two environments: “product-b-non-prod” and “product-b-prod”. This further allows customers to decouple their products and their resources.

Schematics environments are the glue which bring together several distributed elements. A Schematic environment ties together information necessary to execute a terraform template. Specifically schematic environments are comprised of the following:

  • A pointer (url) to a Terraform template
  • A specific target Terraform version
  • Some arbitrary user defined data which helps with organizing environments: name and description
  • Variable definitions and overrides as configured in the terraform template

When brought together this information can be executed upon by the Schematic service allowing the invocation of Terraform to create, update, and destroy cloud resources.

It is also important to understand the underlying technology, Terraform. Terraform maintains a “state”. This allows Terraform to “map the real world” between your arbitrary resource names and the actual identifier used by the cloud provider. For example, if you had defined an IBM Cloud bare metal server similar to resource “ibmcloud_infra_bare_metal” “twc_terraform_sample” and created this resource using Schematics, the IBM Cloud id for this resource might be “253372”. Terraform uses state to map these two elements.