Create a Terraform deployment module for the VM
Preview
This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
This page describes how to create a virtual machine (VM) and Terraform deployment module for the VM.
Create the licensed VM Image
- To ensure that the development VM is non impacted, create a copy of the disk used in the VM by running the following gcloud command:
gcloudcomputediskscreateCLONE_DISK\--description="cloned disk"\--source-disk=projects/PROJECT/zones/ZONE/disks/SOURCE_VM_DISK
- Create the clone of the VM. For information, seeCreate a VM similar to an existing VM.
- In theAdvanced options section, attach the cloned disk.
- Create the VM.
- Verify that the server is running for this VM. The startup script ensures that the VM is running.
- Stop and remove connector-service in docker.
- Remove the home directory and any other file which is not required for running the server. The same disk will be used for creating the VM image and will be accessible by customers later. This VM must only have libraries required for running the service.
- Edit the VM and select the deletion rule toKeep disk
- Delete this VM.
- For creating the licensed image, get the license from the producer portal. VisitProducer portal.Note: If you can't access Producer Portal, verify that you've selected the correct project. If you still can't access it, use thePartner Support Desk to request assistance, and include the word "Marketplace" in your description. For more information about Partner Support Desk, visitRequest assistance with Application Integration.
- Create a new Virtual Machine product. Visit theDeployment Package section and copy the VM license.
- To create the licensed VM image, run the following command:
gcloudcomputeimagescreateVM_IMAGE_NAME\--projectPUBLIC_PROJECT_NAME\--source-diskprojects/DEV_PROJECT_NAME/zones/ZONE/disks/SOURCE_VM_DISK\--licensesLICENSE\--descriptionVM_IMAGE_DESCRIPTION
For more information, seeBuilding your VM.
Create a terraform deployment module
Marketplace provides theAutogen tool to generate the terraform modules for the deployment of VM image on Marketplace.
This tool usesAutogen proto definition to generate the deployment. For more information, seeExample config.
- Add the details of your solution:
- For connectors, create a module with a VM. Enter the project name, VM image name andlabels for the image in your public project.
- Use n2d-standard-2 as the default machine type with min CPU as 2 and RAM as 8 Gb. N2d-standard is optimal for medium traffic web servers. The default VM can be set with 2 cores. If customers expect higher traffic, this can be changed during the VM creation from the Marketplace. For information about pricing for different machine types, seeVM instance pricing.
machineType:# Check http://cloud.google.com/compute/docs/machine-types for all available typesdefaultMachineType:gceMachineType:n2d-standard-2# Minimum CPU and memory constraints for the machine type to run your solution properlyminimum:cpu:2ramGb:8
- Usepd-standard as the default disk type.
bootDisk:diskType:defaultType:pd-standard
- Add the startup script to the autogen config. Stringify the startup script and add it in bashScriptContent.
gceStartupScript:bashScriptContent:
- Define the input fields which will be taken as input from customers during VM creation.
deployInput:sections:# The place int he Deployment Manager config that this section will appear. More details in deployment_package_autogen_spec.proto-placement:CUSTOM_TOPname:CONNECTOR_SETTINGStitle:Connectorssettingsdescription:Connectorssettingstooltip:SettingwithwhichconnectorVMwillberunning# List of input fields that this section hasfields:-required:falsename:TEST_DATAtitle:TestDatadescription:Testdatatooltip:randomdatafortestingstring_box:{}-required:falsename:PORTtitle:Porttorunservicetooltip:Porttorunconnectorservicestring_box:{}-required:falsename:LOG_LEVELtitle:Logleveldescription:Loglevelforthewebservice.AllowedvaluesareDEBUG,INFO,WARNING,ERROR.DefaultisINFOstring_box:{}
Keep the placement asCUSTOM_TOPand name asCONNECTOR_SETTINGS.
Define the field, and the type of input required for them. In this example, theTest Data andPort to run service fields appear for the customers of the Marketplace connector.
- Define the Compute Engine metadata items. While defining the VM metadata. Map the name of the input field to the metadata key.
gce_metadata_items:-key:CONNECTOR_ENV_PORTvalue_from_deploy_input_field:PORT-key:CONNECTOR_ENV_TEST_DATAvalue_from_deploy_input_field:TEST_DATA-key:CONNECTOR_ENV_LOG_LEVELvalue_from_deploy_input_field:LOG_LEVEL
- Add the steps details which will be shown to customers post deployment.
postDeploy:# List of suggested action items for users, after deployment is successfulactionItems:-heading:CreatethePrivateserviceattachmentdescription:NowtheconnectorserviceisrunningontheVM,pleasecreatethePSCserviceattachmenttocreatetheconnection.Followhttps://cloud.google.com/integration-connectors/docs/configure-pscforthedetailedguide.-heading:Createtheconnectiondescription:Aftercreatingtheconnectorsendpointattachment,usetheendpointattachmenttocreateaconnectiontothepartnerconnector.
- To setup the autogen, run the following command:
aliasautogen='docker run \ --rm \ --workdir /mounted \ --mount type=bind,source="$(pwd)",target=/mounted \ --user $(id -u):$(id -g) \ gcr.io/cloud-Marketplace-tools/dm/autogen'autogen--help
- To generate the terraform module, run the following command:
mkdirsolution_folderautogen\--input_typeYAML\--single_inputexample-config/solution.yaml\--output_typePACKAGE\--outputsolution_folder
The solution_folder contains the terraform module. This module will be used while publishing products on Marketplace.
solutionInfo:name:packagedSoftwareGroups:-type:SOFTWARE_GROUP_OScomponents:-name:Ubuntuversion:16.04LTS-components:-name:Apacheversion:2.4.23
What's next
- Learn how tosubmit the VM image for approval.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.