Terraform


Terraform is an open-source infrastructure as code software tool that provides a consistent CLI workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files.

Commands

terraform console
terraform apply
terraform 

terraform plan -target=aws_instance.myinstance
terraform apply -target=aws_instance.myinstance
# Workaround https://github.com/hashicorp/terraform-provider-google/issues/6782
    sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 net.ipv6.conf.lo.disable_ipv6=1 > /dev/null
    export APIS="googleapis.com www.googleapis.com storage.googleapis.com iam.googleapis.com container.googleapis.com cloudresourcemanager.googleapis.com"
    for name in $APIS
    do
      ipv4=$(getent ahostsv4 "$name" | head -n 1 | awk '{ print $1 }')
      grep -q "$name" /etc/hosts || ([ -n "$ipv4" ] && sudo sh -c "echo '$ipv4 $name' >> /etc/hosts")
    done
# Workaround end

Wishlist

  • configure OAuth consent screen for a Google Cloud Project
  • manage OAuth client Credentials for a Google Cloud Project

Workaround: Create your OAUTH credentials manually in a separate project and define them as data sources in your Terraform setup.

Issues

https://issuetracker.google.com/issues/116182848
https://github.com/hashicorp/terraform-provider-google/issues/1287

Alternatives:

Pulumi

Interesting

https://github.com/ahmetb/cloud-run-iap-terraform-demo
https://cloud.google.com/community/tutorials/serverless-grafana-with-iap