@growit-io/google-cloud-platform-types

0.2.5 • Public • Published

Google Cloud Platform Types

A curated repository of composite types and type providers to use in your own Deployment Manager configurations.

Initial Setup

  1. Create a new project. Call this project "Types", for example. This project will contain all of the shared types for your Deployment Manager configurations, and nothing else. The alphanumeric "project ID" is later used by other projects to reference these types, but otherwise it doesn't matter. Pick one of the random suggestions, if you like, or choose a more meaningful identifier if you plan to make these types available somewhere publicly.

  2. Grant the Deployment Manager Type Editor role to the project-number@cloudbuild.gserviceaccount.com service account, where project-number is the random numeric ID of the project you created in the first step.

    Hint: The list of all projects includes the numeric project IDs

    gcloud projects list
    
  3. Clone this repository from GitHub.

    git clone https://github.com/growit-io/google-cloud-platform-types.git
    cd google-cloud-platform-types
    
  4. Submit a build request from your local working copy to deploy all the types initially.

    gcloud container builds submit . --config=cloudbuild.yaml
    

Automating the Deployment

When you have completed the initial setup, choose one of the solutions below to automate future deployments depending on where you want your source repository to be located. In all cases, a push to the source repository will trigger the Cloud Builder service, which will run the steps layed out in /cloudbuild.yaml inside your "Types" project.

a) Repository on github.com

  1. Create a new Source Repository in your "Types" project. Call this repository "types", for example. Set the Source Repository up to mirror this repository from GitHub. You may have to fork the repository into your account before it will be listed in the console. It seems that you cannot mirror repositories outside of your account.
  2. Create a Build Trigger which runs /cloudbuild.yaml on every push to the master branch. Call this trigger "Deployment trigger", for example. After that, you can just commit and push to your fork of this repository on GitHub, and all types will be redeployed automatically. During the deployment, some or all types will be unavailable, as all types are recreated from scratch. The build results can be inspected in the Build history of your "Types" project.

b) Source Repository on Google Cloud Platform

  1. Create a new Source Repository in your "Types" project. Call this repository "types", for example.

  2. Create a Build Trigger which runs /cloudbuild.yaml on every push to the master branch. Call this trigger "Deployment trigger", for example.

  3. Import the local Git repository into your new repository on Google Cloud Platform, regardless of where you cloned the repository from, originally. In the future, you can just commit and push to your cloud source repository, or set up your own synchronisation from your original Git repository, and all types will be redeployed automatically. During the deployment, some or all types will be unavailable, as all types are recreated from scratch. The build results can be inspected in the Build history of your "Types" project.

    gcloud init && git config credential.helper gcloud.sh
    git remote add google \
      https://source.developers.google.com/p/example-project/r/types
    git push --all google
    

Usage with NPM

  1. Create a new directory and the file package.json in it.

    {
      ...
      "dependencies": {
        "@growit-io/google-cloud-platform-types": "0.2.x"
      }
    }
    
  2. Install the required NPM packages.

    npm install
    
  3. Import and use the composite types as templates in your own configurations.

    imports:
    - path: node_modules/@growit-io/google-cloud-platform-types/storage/regional-bucket.py
      name: regional-bucket.py
    
    resources:
    - name: example-regional-bucket
      type: regional-bucket.py
    

Composite Types

The types in this repository are grouped by a logical Google Cloud Platform service, but composite types can use resources from multiple services.

Type Providers

There are no type providers at this time.

Changelog

See the CHANGELOG.md file.

License

See the LICENSE file.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @growit-io/google-cloud-platform-types

      Weekly Downloads

      0

      Version

      0.2.5

      License

      ISC

      Last publish

      Collaborators

      • ustuehler