chapter seven
7 CI/CD Pipelines as Code
This chapter covers:
- Designing an end-to-end CI/CD pipeline for Docker containers on GCP
- Enacting a two-stage strategy for deploying static and dynamic infrastructure
- Iterating over complex types with for-each and dynamic blocks
- Explicitly overriding default providers at the resource and module level
- Creating custom resources with local-exec provisioners
CI/CD stands for Continuous Integration (CI) and Continuous Deployment (CD). It’s a DevOps methodology for enabling development teams to quickly ship code changes to production environments. CI/CD means changes are integrated faster, which results in smaller changes and decreased risk. This, in combination with the agility to deliver features faster is the key successes of CI/CD.
CI/CD is typically implemented by a CI/CD pipeline, which describes how code gets from version control systems through to end users and customers. In a CI/CD pipeline, each stage performs some discreet task, such as building, testing, and deploying, before automatically promoting to the next stage in the pipeline (see figure 7.1).
Figure 7.1 CI/CD stands for Continuous Integration (CI) and Continuous Deployment (CD). It’s normally implemented by a CI/CD pipeline, in which one stage automatically promotes into the next