Skip to content

pasali/terraform-provider-googleappscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Google AppScript Provider

This is a Terraform provider for managing Google appscript projects.

Installation

  1. Download the latest compiled binary from GitHub releases.

  2. Unzip/untar the archive.

  3. Move it into $HOME/.terraform.d/plugins:

    $ mkdir -p $HOME/.terraform.d/plugins/linux_amd64
    $ mv terraform-provider-googleappscript $HOME/.terraform.d/plugins/terraform-provider-googleappscript_v0.1.0
  4. Create your Terraform configurations as normal, and run terraform init:

    $ terraform init

    This will find the plugin locally.

Usage

  1. Since google appscript api does not support service account authentication, you will need a OAuth token file to run provider and unfortunately you will have to renew your token file whenever its expired.

    1. Go to APIs & Services of Google Cloud Platform
    2. Create a credential and download as a file
    3. Run this script with credentials file
    4. Copy-paste url to your browser
    5. Give permissions and copy back code to terminal
    6. Your token file should be created.
  2. Create a Terraform configuration file:

       provider "googleappscript" {
         token_file = "token.json"
       }
    
       resource "googleappscript_project" "example" {
         title = "terraform-example"
    
         script {
           name = "appsscript"
           type = "JSON"
           source = "{\"timeZone\":\"America/New_York\",\"exceptionLogging\":\"CLOUD\"}"
         }
    
         script {
           name = "hello"
           type = "SERVER_JS"
           source = "function helloWorld() {\n  console.log('goodbye, world!');}"
         }
    
       }
  3. Run terraform init to pull in the provider:

    $ terraform init
  4. Run terraform plan and terraform apply to create events:

    $ terraform plan
    
    $ terraform apply

About

A @hashicorp Terraform provider for managing Google AppScript projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages