See the supported connectors for Application Integration.

Create a Terraform deployment module for the VM

This page describes how to create a virtual machine (VM) and Terraform deployment module for the VM.

Create the licensed VM Image

  1. 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:
    gcloud compute disks create CLONE_DISK \ --description="cloned disk" \ --source-disk=projects/PROJECT/zones/ZONE/disks/SOURCE_VM_DISK
  2. Create the clone of the VM. For information, see Create a VM similar to an existing VM.
  3. In the Advanced options section, attach the cloned disk.
  4. Create the VM.
  5. Verify that the server is running for this VM. The startup script ensures that the VM is running.
  6. Stop and remove connector-service in docker.
  7. 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.
  8. Edit the VM and select the deletion rule to Keep disk
  9. Delete this VM.
  10. For creating the licensed image, get the license from the producer portal. Visit Producer portal
  11. Create a new Virtual Machine product. Visit the Deployment Package section and copy the VM license.
  12. To create the licensed VM image, run the following command:
  13. gcloud compute images create VM_IMAGE_NAME \
     --project PUBLIC_PROJECT_NAME \
     --source-disk projects/DEV_PROJECT_NAME/zones/ZONE/disks/SOURCE_VM_DISK \
     --licenses LICENSE \
     --description VM_IMAGE_DESCRIPTION

    For more information, see Building your VM.

Create a terraform deployment module

Marketplace provides the Autogen tool to generate the terraform modules for the deployment of VM image on Marketplace.

This tool uses Autogen proto definition to generate the deployment. For more information, see Example config.

  1. Add the details of your solution:
  2. solutionInfo:
      name: 
      packagedSoftwareGroups:
        - type: SOFTWARE_GROUP_OS
          components:
            - name: Ubuntu
              version: 16.04 LTS
        - components:
            - name: Apache
              version: 2.4.23
  3. For connectors, create a module with a VM. Enter the project name, VM image name and labels for the image in your public project.
  4. 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, see VM instance pricing.
        machineType:
          # Check http://cloud.google.com/compute/docs/machine-types for all available types
          defaultMachineType:
            gceMachineType: n2d-standard-2
          # Minimum CPU and memory constraints for the machine type to run your solution properly
          minimum:
            cpu: 2
            ramGb: 8
  5. Use pd-standard as the default disk type.
        bootDisk:
          diskType:
            defaultType: pd-standard
  6. Add the startup script to the autogen config. Stringify the startup script and add it in bashScriptContent.
    gceStartupScript:
       bashScriptContent: 
  7. 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_TOP
              name: CONNECTOR_SETTINGS
              title: Connectors settings
              description: Connectors settings
              tooltip: Setting with which connector VM will be running
              # List of input fields that this section has
              fields:
                - required: false
                  name: TEST_DATA
                  title: Test Data
                  description: Test data
                  tooltip: random data for testing
                  string_box: {}
                - required: false
                  name: PORT
                  title: Port to run service
                  tooltip: Port to run connector service
                  string_box: {}
                - required: false
                  name: LOG_LEVEL
                  title: Log level
                  description: Log level for the web service. Allowed values are DEBUG, INFO, WARNING, ERROR. Default is INFO
                  string_box: {}

    Keep the placement as CUSTOM_TOP and name as CONNECTOR_SETTINGS.

    Define the field, and the type of input required for them. In this example, the Test Data and Port to run service fields appear for the customers of the Marketplace connector.

  8. 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_PORT
            value_from_deploy_input_field: PORT
          - key: CONNECTOR_ENV_TEST_DATA
            value_from_deploy_input_field: TEST_DATA
    - key: CONNECTOR_ENV_LOG_LEVEL
            value_from_deploy_input_field: LOG_LEVEL
  9. Add the steps details which will be shown to customers post deployment.
        postDeploy:
          # List of suggested action items for users, after deployment is successful
          actionItems:
            - heading: Create the Private service attachment
              description: Now the connector service is running on the VM, please create the PSC service attachment to create the connection. Follow https://cloud.google.com/integration-connectors/docs/configure-psc for the detailed guide.
            - heading: Create the connection
              description: After creating the connectors endpoint attachment, use the endpoint attachment to create a connection to the partner connector.
  10. To setup the autogen, run the following command:
    alias autogen='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
  11. To generate the terraform module, run the following command:
    mkdir solution_folder
    
    autogen \
      --input_type YAML \
      --single_input example-config/solution.yaml \
      --output_type PACKAGE \
      --output solution_folder

    The solution_folder contains the terraform module. This module will be used while publishing products on Marketplace.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-12-19 UTC.