All available commands are described in the help file.
The defined stacks are listed:
Stack name Path learn-cdktf-go cdktf.out/stacks/learn-cdktf-go
The next step is to create the hcl file with:
You could step that step and go right to deploy. But with a synth before you check for errors before deploying.
Now in cdktf.out/stacks/learn-cdktf-go/cdk.tf.json the hcl file is generated
With the plan command you can see which resources will be created/changed/destroyed in the next apply run:
Stack: learn-cdktf-go Resources + AWS_INSTANCE cdktfgo aws_instance.cdktfgo Diff: 1 to create, 0 to update, 0 to delete.
With plan you check whether the crud action for the resources are as intended. Here we want to create an instance, so it’s ok.
With apply the resource(s) are created:
Output while apply-ing:
⠧ Deploying Stack: learn-cdktf-go Resources ⠼ AWS_INSTANCE cdktfgo aws_instance.cdktfgo Summary: 0 created, 0 updated, 0 destroyed.
Output at the end:
Summary: 1 created, 0 updated, 0 destroyed. Output: public_ip = 22.214.171.124
For the cleanup you destroy the stack:
Destroying Stack: learn-cdktf-go Resources ✔ AWS_INSTANCE cdktfgo aws_instance.cdktfgo Summary: 1 destroyed.