Topic lessonTopic: IaC selection and existing-resource adoption
CloudFormation vs AWS CDK vs Terraform: choosing and planning adoption
CloudFormation centers on templates, AWS CDK generates CloudFormation deployment artifacts from code, and Terraform uses providers and state. Compare review artifacts, ownership and team operations rather than choosing by popularity.
Compare approaches against the same requirements and explain checks needed before importing existing resources or changing management tools.
Knowledge of IaC, CloudFormation change review, CDK synthesis and Terraform plan/apply/state helps. This lesson does not ask you to install every tool.
Compare execution models as well as authoring syntax
| Axis | CloudFormation | AWS CDK | Terraform |
|---|---|---|---|
| Primary authoring | JSON/YAML templates | Supported language code and constructs | Configuration such as HCL, plus providers |
| Review artifacts | Templates and proposed changes | Code, generated templates/assets and changes | Configuration, inputs, providers and plans |
| Management model | CloudFormation stacks and resources | CloudFormation applies synthesized infrastructure | State mappings and provider operations |
| Operational checks | Target stack, permissions, changes and failures | Those checks plus app execution, dependencies and synthesis | Backend, locking, provider coverage and partial failure |
CDK and CloudFormation are not two unrelated deployment engines. Moving to Terraform also changes how managed objects are recorded and owned; it is more than a syntax rewrite.
The same report system can have different team requirements
| Condition | Candidate and reason | Still verify |
|---|---|---|
| Existing AWS stacks, reviewed by a team comfortable with YAML | Consider retaining CloudFormation and its established review workflow. | Resource coverage, change impact and remaining operational needs. |
| Reusable TypeScript building blocks while retaining CloudFormation management | Consider CDK, reviewing generated artifacts as well as reusable code. | Dependencies, app execution, generated resources and stable logical IDs. |
| One plan-review workflow across multiple services | Evaluate Terraform against the required providers. | Specific resource/property/version support, state ownership and backend. |
These candidates are design judgments for the stated conditions. Do not assume universal resource, property, Region or version coverage. Retaining an established workflow can be the appropriate choice.
Define ownership and review before choosing tools
- Identify requirements → Define ownershipAlign scope
- Define ownership → Review proposed changesMake responsibility explicit
- Review proposed changes → Verify after executionApply and inspect
- Identify requirements
- Targets, team and constraints
- Define ownership
- Responsibility for objects and settings
- Review proposed changes
- Artifacts, differences and impact
- Verify after execution
- Outcomes, functions and data
Avoid having multiple systems concurrently write the same settings of the same object. Referencing an existing object is different from adopting it for managed updates. Record read-only references separately from write ownership.
Adoption requires mappings and the next proposed change
| Approach | Before import | After import |
|---|---|---|
| CloudFormation | Supported identifiers, a template modeling current configuration, and DeletionPolicy. | Stack mapping, actual configuration and the impact of the next update. |
| CDK | Constructs modeling current state and the cdk import restriction on unrelated changes. | Generated templates, resource mappings and unintended differences. |
| Terraform | The resource identity and destination resource address/configuration. | One-to-one state mapping and changes proposed by the next plan. |
Import is not an automatic conversion of configuration and data into your desired state. Read resource-specific support and constraints, then inspect differences for unintended changes to existing configuration. No import command or live operation is performed here.
Separate management migration from data recovery
| Outcome | Required checks |
|---|---|
| Management adopted | Resource identity, ownership, configuration, records and differences. |
| Application usable | Endpoints, permissions, communication and required functions. |
| Data recoverable | Stored contents, recovery points, destinations, consistency and recovery procedure. |
- Record target resources/properties, existing ownership and reasons for accepting or rejecting options.
- Design artifact/plan review, secret flows, permissions and concurrency controls.
- Prepare adoption, cutover, failure decisions and verification, starting with a testable scope.
- Verify resources, applications and data using evidence appropriate to each.
Check your reasoning against requirements
Choose an option to see the result and explanation.
Check, then explain in your own words
- Separate authoring from deployment in the comparison table.
- Explain candidates and unresolved checks for the three team cases.
- Check adoption and recovery boundaries in the questions and review.
Check your understanding: What evidence should an IaC selection proposal retain?
Record scope and ownership, team review practices, required resource coverage, state and secret handling, adoption and subsequent differences, failure decisions and function/data verification.
Convenient syntax alone cannot establish workable deployment and maintenance conditions.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- What is AWS CloudFormation?Checked:
Scope and conditionsTemplates and stack management as comparison fundamentals; resource-specific support remains a separate check.
Used in this lessonCompare execution models as well as authoring syntax The same report system can have different team requirements Define ownership and review before choosing tools Check your reasoning against requirements
Scope and conditionsCloud assembly templates/assets and synthesizer/deployment conditions; synthesis success is not deployment success.
Used in this lessonCompare execution models as well as authoring syntax Define ownership and review before choosing tools Separate management migration from data recovery Check your reasoning against requirements
- Terraform providersChecked:
Scope and conditionsProvider-specific resource/property coverage and independent versions; no universal multi-service coverage claim.
Used in this lessonCompare execution models as well as authoring syntax The same report system can have different team requirements Check your reasoning against requirements
- Purpose of Terraform StateChecked:
Scope and conditionsResource mappings and recorded attributes; state is not continuous monitoring or a data restore point.
Used in this lessonCompare execution models as well as authoring syntax The same report system can have different team requirements Define ownership and review before choosing tools Separate management migration from data recovery Check your reasoning against requirements
- Terraform apply commandChecked:
Scope and conditionsReplanning without a saved plan, no approval prompt in saved-plan mode, and no automatic rollback of partially completed operations.
Used in this lessonCompare execution models as well as authoring syntax Define ownership and review before choosing tools Separate management migration from data recovery
- Terraform state lockingChecked:
Scope and conditionsLocking depends on backend support; remote storage alone does not guarantee it, and force-unlock is not a routine fix.
Used in this lessonCompare execution models as well as authoring syntax Separate management migration from data recovery
- AWS CDK constructsChecked:
Scope and conditionsConstruct containment and abstraction levels; inspect generated settings and do not interpret containment as traffic.
Used in this lessonThe same report system can have different team requirements
- Identifiers and the AWS CDKChecked:
Scope and conditionsScope-local identifiers, paths, logical and physical IDs; review refactoring risks without inventing generated hashes.
Used in this lessonThe same report system can have different team requirements
- Terraform plan commandChecked:
Scope and conditionsNormal planning reads targets and proposes changes; distinguish a proposal from an applied outcome.
Used in this lessonThe same report system can have different team requirements Define ownership and review before choosing tools Separate management migration from data recovery
- Terraform state overviewChecked:
Scope and conditionsOne-to-one object mappings, access and concurrency; no state hand-editing or VCS-storage instructions.
Used in this lessonDefine ownership and review before choosing tools Adoption requires mappings and the next proposed change Check your reasoning against requirements
- Terraform import overviewChecked:
Scope and conditionsResource identity and import/resource mappings with provider-specific requirements; adoption is not data recovery.
Used in this lessonDefine ownership and review before choosing tools Adoption requires mappings and the next proposed change Separate management migration from data recovery Check your reasoning against requirements
Scope and conditionsCurrent configuration, resource identifiers, DeletionPolicy and update restrictions; import not executed.
Used in this lessonDefine ownership and review before choosing tools Adoption requires mappings and the next proposed change Separate management migration from data recovery Check your reasoning against requirements
- AWS CDK import commandChecked:
Scope and conditionsModel current state accurately and avoid unrelated changes during import; review subsequent differences.
Used in this lessonAdoption requires mappings and the next proposed change
Scope and conditionsRedaction differs from persistence; inspect state/plan handling and separate ephemeral and write-only conditions.
Used in this lessonSeparate management migration from data recovery