Kirk Haines
kirk.haines@joshsoftware.com
Stable, customer facing environment
There are a lot of varying definitions.
At the core, though, staging is a production-like environment where software can be deployed for testing and validation before it goes to production.
The use of staging environments has some controversy.
The alternative to staging servers is extensive, comprehensive tests, leveraging CI/CD processes, real code reviews before merging, and feature flagging ALL major code changes.
Staging environments tend to create expense from the work to maintain them, and from running systems that aren't doing anything useful most of the time.
Staging environments tend to diverge from production, which feeds back into the issue that they can be functionally expensive.
If a staging environment can be created on demand, without needing a person to build it,
and...
If automation that can build it on demand can also destroy it on command, so that it doesn't carry an expense when it isn't being used,
then...
Staging servers become much more useful, both practically and economically.
Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.
-- Hashicorp
Infrastructure is defined using a rich configuration language.
Declarative -- define what you want, and let Terraform figure out what it needs to do to deliver that.
Vendor agnostic.
AWS, GCP, Azure, DigitalOcean, Heroku, and dozens of other providers are supported.
Terraform is stateful
Iterative changes to a configuration will result in iterative changes to the environment to match, without needing to rebuild the whole thing.
Won't make unneeded changes.
Environment can be destroyed, and when rebuilt, the new environment should look just like the previous one.
Because infrastructure is defined in files, revision control can be applied to infrastructure management.
Terraform binary doesn't ship with any vendor-specific support. Initialization step downloads extra needed modules.
That example is very simple. It's just a vanilla Ubuntu 20.04 instance running in us-east-2.
It isn't very useful.
Default security groups mean that the server can't be accessed from the outside world.
No SSH. No anything. Terraform config can handle this.
Security Group
Terraform can SSH on your behalf and can run commands or transfer and run scripts.
Infrastructure as Code
Configuration Management
Configuration Management
It doesn't replace a tool like Chef or Itamae
Infrastructure setup and teardown is fast.
It is precise and repeatable.
It can be version controlled.
It can work with configuration management for a complete solution to deploying and managing testing and staging instances.