Skip to main content

GCP Example: deploy GCS bucket

In this quick start we will show you how you can use Hyper Cloud Automation to deploy a GCS bucket as a part of a simple architecture. The example will walk you through creating a simple environment, adding a module, and deploy it.

Prerequisite

For this example we will assume that you already have a GCP project created.

  1. Go to your cloud shell https://shell.cloud.google.com/
  2. Create service account: gcloud --project <YOUR_PROJECT_ID> iam service-accounts create xoogify-example
  3. Grant Storage Admin role to the account: gcloud projects add-iam-policy-binding <YOUR_PROJECT_ID> --member serviceAccount:xoogify-example@<YOUR_PROJECT_ID>.iam.gserviceaccount.com --role roles/storage.admin
  4. Create a service account key: gcloud --project <YOUR_PROJECT_ID> iam service-accounts keys create credentials.json --iam-account xoogify-example@<YOUR_PROJECT_ID>.iam.gserviceaccount.com
  5. Note down the value of the key by doing cat credentials.json
  6. In the Hyper Cloud Automation click on Organization in the left hand navigation menu.
  7. Scroll to the Cloud Keys section.
  8. Press on +Add button.
  9. For Cloud Key choose GOOGLE_CLOUD_KEYFILE_JSON.
  10. Paste the value of the credentials.json in the above steps
  11. For Environment choose global.
  12. Press Save button
  13. You should have something like this Access Keys

Create environment

In this example we will create a simple environment which consist of a module that deploys a GCS bucket.

  1. In the left naviation menu select Environments
  2. Click on Add Environment
  3. Name your environment example-gcs-environment
  4. Press Add
  5. Select EXAMPLE-GCS-ENVIRONMENT in the tabs
  6. Press on the + button in the Root of the Environment
  7. Select GCP Project Data Source Data Source
    tip

    Press Expand Environment button to expand/collapse the tree

  8. In the GCP Project Data Source node press on the button and fill in the Project ID with the value of <YOUR_PROJECT_ID> from the Prerequisites section
  9. Press Save
  10. On GCP Project Data Source node press and select GCS Bucket Module
  11. Click on button and set the settings like in this image GCS Module Settings
  12. Scroll down and press Save.

Your first simple environment should look something like this: Simple Environment

Deploy

Deployment process consists of running a plan action folowed by approval process and then running apply

  1. In your environment locate GCS Bucket module
  2. Press on the in the module to start the plan. Notice that the Deployment Status will change. Plan Running
  3. Once the Deployment Status is changed to PLAN SUCCESS click on button to pop up the deployment PLAN
  4. In the top right corner press TERRAFORM-APPLY button
  5. Wait for deployment to finish. Apply finished
  6. Go to your GCP Cloud Console
  7. Go to Cloud Storage
  8. You will find the bucket that has been deployed

To review deployments log do:

  1. In the left navigation menu click on Deployment Jobs
  2. Click on the deployment job IDs to see the full logs Deploment Jobs

Destroy the bucket

  1. In the naviagion menu on the left select Environments
  2. In the tabs select EXAMPLE-GCS-ENVIRONMENT
  3. Click on Expand Environment
  4. Click on button on the GCS Bucket module.
  5. Confirm the destruction plan
  6. Wait for Destroy to complete destroy bucket
  7. Go to your GCP Cloud Console
  8. Go to Cloud Storage
  9. The bucket is deleted

Cleanup

  1. In the left navigation menu click on Organization
  2. Delete the environment EXAMPLE-GCS-ENVIRONMENT. See also delete envrionment
  3. Delete the Service Account Key created in prerequisite