How to launch an instance in GCP using Terraform

0 votes
Hi Guys,

I want to launch one instance on the GCP cloud using Terraform. How can I do that?
Sep 11, 2020 in Terraform by akhtar
• 38,170 points
140 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the google_compute_instance resource in Terraform. This resource has the capability to launch an instance n GCP Cloud. You can see the below example.

resource "google_compute_instance" "vm_instance" {
  name         = "terraform-instance"
  machine_type = "f1-micro"
  zone = "us-central1-a"
  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-9"
    }
  }
  network_interface {
    # A default network is created for all GCP projects
    network = "default"
    access_config {
    }
  }
answered Sep 12, 2020 by MD
• 95,160 points

Related Questions In Terraform

0 votes
1 answer

How to do ssh in EC2 instance using Terraform?

Hi@akhtar, To ssh in your EC2 instance, you ...READ MORE

answered Jun 15, 2020 in Terraform by MD
• 95,160 points
3,411 views
0 votes
1 answer

How to launch one Pod in Minikube using Terraform?

Hi@akhtar, You can use kubernetes_pod resource to launch ...READ MORE

answered Jun 16, 2020 in Terraform by MD
• 95,160 points
1,290 views
0 votes
1 answer

How to create a rds snapshot from running rds instance in AWS using terraform?

Hi, I think you can use aws_db_instance resource to ...READ MORE

answered Jul 20, 2020 in Terraform by MD
• 95,160 points
952 views
0 votes
1 answer

How to launch EC2 windows instance with powershell script using terraform?

Hi, In your Terraform code, you have written ...READ MORE

answered Jul 21, 2020 in Terraform by MD
• 95,160 points
1,359 views
0 votes
1 answer

Create a project in GCP using Terraform.

Hi@akhtar, Terraform has a resource named google_project. This ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,160 points
193 views
0 votes
1 answer

How to set an IAM policy for a project in GCP using Terraform?

Hi@akhtar, You can create a policy and give ...READ MORE

answered Sep 13, 2020 in Terraform by akhtar
• 38,170 points
204 views
0 votes
2 answers

How to create a customized IAM policy in GCP using Terraform?

You can visit Terraform official site for ...READ MORE

answered Sep 13, 2020 in Terraform by Peter
• 180 points
378 views
0 votes
1 answer

How to create a security rule in GCP using Terraform?

Hi@akhtar, A Security Policy defines an IP blacklist ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,160 points
139 views
0 votes
1 answer

How to create Filestore instance in GCP using Terraform?

Hi@akhtar, You can manage services in the GCP ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,160 points
204 views
0 votes
1 answer

How to attach an EBS volume to EC2 instance using terraform?

Hi@akhtar, You can use aws_volume_attachment resource to attach ...READ MORE

answered Jun 12, 2020 in Terraform by MD
• 95,160 points
3,698 views