- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 11:00 PM
Hello Experts,
I have observed below while doing POC on CPG using terraform connector:
Expectations of the “use existing workspace”
- Ability to deploy multiple stacks from the same catalog item into a single TFE workspace.
Challenge
- In testing we have found that the second catalog item to deploy into an existing workspace, terminates and destroys the first catalog item's provisioned resource. The third, destroys the second, the end result only one stack can be deployed to a workspace at any one point in time. Thus a 1-1 relationship between stack and workspace.
As we know Terraform Enterprise is licensed per workspace so the incentive / requirement is to reduce the number of workspaces we require. But above scenario doesn't help . Is this really how the ServiceNow design is or i am missing something?
Appreciate any help around this.
Best Regards,
Vishwajeet Anand
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2022 11:16 PM
Deletion of resources/over-write is controlled by Terraform. if the state file is retained and you are applying the new configuration on top (while also having existing config) then the old resources would not go.
if you are using entirely new config and applying it, Terraform being declarative will keep only the resources defined in current template.
e.g. i have a terraform config to deploy VM with 1 disk, network card, and i run this through CPG catalog request - this creates the resources and saves the state file with the resource (VM, 1 disk, network card). now the devops team modifies the terraform config and *adds* 1 more disk to the config. then you can update the catalog item via IaC discovery and change task. with new catalog item, you can choose existing workspace and now it will deploy the config, but it will not remove existing resources as these are already in state file.
btw - you can try the same steps outside of cpg workflow - you will get same result.
Ram

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2023 05:57 PM - edited 01-04-2023 10:08 PM
Hi wish you a happy new year.
Explained this feature and its usage in this youtube video.
Please take a look
https://www.youtube.com/watch?v=MrvfCmVOUE4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 02:37 AM
Happy New Year Ram. Thanks for sharing. This is very helpful.