github.com/terraform-modules-krish/terratest@v0.29.0/examples/terraform-gcp-example/main.tf (about) 1 # --------------------------------------------------------------------------------------------------------------------- 2 # PIN TERRAFORM VERSION TO >= 0.12 3 # The examples have been upgraded to 0.12 syntax 4 # --------------------------------------------------------------------------------------------------------------------- 5 6 terraform { 7 required_version = ">= 0.12" 8 } 9 10 # --------------------------------------------------------------------------------------------------------------------- 11 # DEPLOY A CLOUD INSTANCE RUNNING UBUNTU 12 # See test/terraform_gcp_example_test.go for how to write automated tests for this code. 13 # --------------------------------------------------------------------------------------------------------------------- 14 15 resource "google_compute_instance" "example" { 16 project = var.gcp_project_id 17 name = var.instance_name 18 machine_type = var.machine_type 19 zone = var.zone 20 21 boot_disk { 22 initialize_params { 23 image = "ubuntu-os-cloud/ubuntu-1604-lts" 24 } 25 } 26 27 network_interface { 28 network = "default" 29 access_config { 30 } 31 } 32 } 33 34 # --------------------------------------------------------------------------------------------------------------------- 35 # CREATE A GOOGLE STORAGE BUCKET 36 # --------------------------------------------------------------------------------------------------------------------- 37 38 resource "google_storage_bucket" "example_bucket" { 39 project = var.gcp_project_id 40 name = var.bucket_name 41 location = var.bucket_location 42 } 43