Day 2 operations with Terraform Open Source Connector
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-10-2022 11:26 PM
I need to handle few Day 2 use cases like Adding disks to a VM, Resizing a VM, Snapshot of VM which are currently executed using Terraform Open Source scripts by a customer and we are looking to configure the same via CPG Terraform Connector. Is it possible to achieve this via CPG resource blocks out of box? I also do not see any CAPI setup for Terraform operations.
Any support is appreciated

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 01:37 AM
hi, Terraform does not understand the concept of day-2 use-cases as it follows a declarative approach. whatever is 'applied' is really a current state - unlike additive approaches that we have with CAPI.
An approach that you can check out is to reuse existing workspaces with the modified terraform template brought in via IaC changes. you can see more details in this video.
all our existing day-2 operations will work with resources deployed through terraform however, there's an issue that the state file is out of sync once the action is complete. e.g. if a disk is added through CAPI resource operation, the disk is not present in the terraform state file unless a separate terraform import is called.
ideally a terraform apply operation needs to be provided but there's some complexity in this area, especially around response processing.
regards,
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 02:59 AM
Thanks for detail update
My understanding is that after Day 1 resource provisioning with TF, the cloud specific API need to be used for Day 2 Ops and then TF state file need to be refreshed with another operation to add the additional disk information. Can you clarify on how the second part of state file refresh could be done via CPG?
I am aware of TF Apply spoke but does it work with the open source connector? Totally new with Terraform, so please bear with the questions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-11-2022 04:57 AM
Normal scenario is - terraform file is changed to add an additional disk, this will be put through plan and apply phases. and likely this is what will be done in the test/dev stage by a terraform developer/infrastructure coder for their own testing.
in the production however, with ServiceNow in the picture, the code change will be done in the module, the change will get picked up in the CPG terraform integration's next IaC discovery schedule run, and then change will go through CPG's IaC approval process. once this is approved, the change is added in the catalog item. the next time the catalog item is ordered, the same workspace should be chosen as before - then what happens is that the change is brought in the existing resources in the workspace.
please see the video for the details
regards,
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-12-2022 01:09 AM