/iac-cloudrun

Deploy a Cloud Run service with terraform!

Primary LanguageHCL

IaC for Cloud Run

Create and manage a Cloud Run application in terraform

Deployment

  1. Create a terraform.tfvars file with a minimum of project and
    domains variables defined.

  2. Create the public IP address with a targeted apply.

    terraform apply -target google_compute_global_address.app -out run.plan
    terraform apply run.plan
    
  3. Update dns for each domain in the domains list to point to the created public IP. Then create the rest of the infrastructure.

    terraform apply
    

App Requirements

  • The container must listen for requests on 0.0.0.0.
  • By default, requests are sent to port 8080.
  • The PORT env var in the runtime always contains the port used for requests.

App Access

Developer request against a service without public_access enabled.

curl -H "Authorization: Bearer $(gcloud auth print-identity-token)" SERVICE_URL

Additional Links

Next Steps