Terraform for GCP

 Terraform requires several key files to deploy virtual machines on cloud platforms. These typically include:

1. main.tf

This is your primary configuration file that defines the VM instance and a firewall rule to allow SSH access. It includes the VM's hardware configuration, networking, boot disk, and metadata.

2. variables.tf

This file declares all the variables used in your Terraform configuration, including project details, VM specifications, networking options, and security settings. Each variable has a description and many have default values.

3. terraform.tfvars

This is where you set the actual values for your variables. You'll need to customize this file with your specific GCP project ID, preferred VM configuration, and network settings.

4. outputs.tf

This defines useful information that will be displayed after a successful deployment, such as the VM's IP addresses and an SSH command to connect to it.

5. versions.tf

This specifies the required Terraform version and provider versions to ensure compatibility.

6. startup.sh

This is a sample startup script that runs when the VM boots. It updates the system, installs some common packages, sets up a simple nginx web server, and creates a test page.

Install terraform:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
brew tap hashicorp/tapbrew
 install hashicorp/tap/terraform

ramrajam@RAMRAJAM-M-YH12 terraform % terraform init

Terraform initialized in an empty directory!


The directory has no Terraform configuration files. You may begin working

with Terraform immediately by creating Terraform configuration files.

ramrajam@RAMRAJAM-M-YH12 terraform % ls

ramrajam@RAMRAJAM-M-YH12 terraform % pwd

/Users/ramrajam/Documents/terraform

ramrajam@RAMRAJAM-M-YH12 terraform % cd ../cisco_c9800_software_byol_terraform 

ramrajam@RAMRAJAM-M-YH12 cisco_c9800_software_byol_terraform % terraform init

Initializing the backend...

Initializing provider plugins...

- Finding latest version of hashicorp/google...

- Installing hashicorp/google v6.33.0...

- Installed hashicorp/google v6.33.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider

selections it made above. Include this file in your version control repository

so that Terraform can guarantee to make the same selections by default when

you run "terraform init" in the future.


Terraform has been successfully initialized!


You may now begin working with Terraform. Try running "terraform plan" to see

any changes that are required for your infrastructure. All Terraform commands

should now work.


If you ever set or change modules or backend configuration for Terraform,

rerun this command to reinitialize your working directory. If you forget, other

commands will detect it and remind you to do so if necessary.

ramrajam@RAMRAJAM-M-YH12 cisco_c9800_software_byol_terraform % terraform plan --var-file marketplace_test.tfvars --var project_id=cisco-public


Changes to Outputs:

  + instance_machine_type = "n1-standard-4"

  + instance_name         = ""

  + instance_network      = "default"

  + instance_zone         = "us-central1-f"

  + number_of_nics        = 1

  + project               = "cisco-public"


You can apply this plan to save these new output values to the Terraform state, without changing any real

infrastructure.

Warning: Value for undeclared variable

 

The root module does not declare a variable named "instanceKey" but a value was found in file

"marketplace_test.tfvars". If you meant to use this value, add a "variable" block to the configuration.

 

To silence these warnings, use TF_VAR_... environment variables to provide certain "global" settings to all

configurations in your organization. To reduce the verbosity of these warnings, use the -compact-warnings option.

Error: Attempted to load application default credentials since neither `credentials` nor `access_token` was set in the provider block.  No credentials loaded. To use your gcloud credentials, run 'gcloud auth application-default login'.  Original error: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information

 

  with provider["registry.terraform.io/hashicorp/google"],

  on main.tf line 1, in provider "google":

    1: provider "google" {

 

ramrajam@RAMRAJAM-M-YH12 cisco_c9800_software_byol_terraform % gcloud auth application-default login

zsh: command not found: gcloud

ramrajam@RAMRAJAM-M-YH12 cisco_c9800_software_byol_terraform % bash


The default interactive shell is now zsh.

To update your account to use zsh, please run `chsh -s /bin/zsh`.

For more details, please visit https://support.apple.com/kb/HT208050.

bash-3.2$ gcloud auth application-default login

bash: gcloud: command not found

bash-3.2$ gcloud auth application-default login

bash: gcloud: command not found

bash-3.2$ brew install --cask google-cloud-sdk

==> Downloading https://formulae.brew.sh/api/cask.jws.json

==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/d890fa6a5e74a8caa2447278dcc8e3066d011c74/Casks/g

################################################################################################################## 100.0%

==> Downloading https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-520.0.0-darwin-arm.tar.gz

################################################################################################################## 100.0%

==> Downloading https://formulae.brew.sh/api/formula.jws.json

==> Installing dependencies: mpdecimal, ca-certificates, openssl@3, readline, sqlite, xz, python@3.12

==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/manifests/4.0.1

################################################################################################################## 100.0%

==> Fetching mpdecimal

==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/blobs/sha256:e21da583e42e86d5a2f0aedfaf7820e51b8af3065da599cff

################################################################################################################## 100.0%

==> Installing mpdecimal

==> Pouring mpdecimal--4.0.1.arm64_sequoia.bottle.tar.gz

🍺  /opt/homebrew/Cellar/mpdecimal/4.0.1: 22 files, 645.6KB

==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2025-02-25

################################################################################################################## 100.0%

==> Fetching ca-certificates

==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:8f46fb05f753f80f2bc398c0a24b10d680bd77d496e

################################################################################################################## 100.0%

==> Installing ca-certificates

==> Pouring ca-certificates--2025-02-25.all.bottle.tar.gz

==> Regenerating CA certificate bundle from keychain, this may take a while...

🍺  /opt/homebrew/Cellar/ca-certificates/2025-02-25: 4 files, 235.8KB

==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.5.0

################################################################################################################## 100.0%

==> Fetching openssl@3

==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:7bbac0e84510570ec550deee1dce185569917378411263a9d

################################################################################################################## 100.0%

==> Installing openssl@3

==> Pouring openssl@3--3.5.0.arm64_sequoia.bottle.tar.gz

🍺  /opt/homebrew/Cellar/openssl@3/3.5.0: 7,563 files, 35.4MB

==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.13

################################################################################################################## 100.0%

==> Fetching readline

==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:738c27ceee9a8b198f98438477ef7a513a96a965e3a434ac3a

################################################################################################################## 100.0%

==> Installing readline

==> Pouring readline--8.2.13.arm64_sequoia.bottle.tar.gz

🍺  /opt/homebrew/Cellar/readline/8.2.13: 51 files, 1.7MB

==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/manifests/3.49.1

################################################################################################################## 100.0%

==> Fetching sqlite

==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/blobs/sha256:757c3d60f4d35fe1c3336207d63992fc804fa6ddd2c40ebb84eb

################################################################################################################## 100.0%

==> Installing sqlite

==> Pouring sqlite--3.49.1.arm64_sequoia.bottle.tar.gz

🍺  /opt/homebrew/Cellar/sqlite/3.49.1: 13 files, 4.7MB

==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.8.1

################################################################################################################## 100.0%

==> Fetching xz

==> Downloading https://ghcr.io/v2/homebrew/core/xz/blobs/sha256:dcd7823f2624cbcd08f55c232097a79300c7d76ab5969004db1a4785

################################################################################################################## 100.0%

==> Installing xz

==> Pouring xz--5.8.1.arm64_sequoia.bottle.tar.gz

🍺  /opt/homebrew/Cellar/xz/5.8.1: 96 files, 2.5MB

==> Downloading https://ghcr.io/v2/homebrew/core/python/3.12/manifests/3.12.10-1

################################################################################################################## 100.0%

==> Fetching python@3.12

==> Downloading https://ghcr.io/v2/homebrew/core/python/3.12/blobs/sha256:98e11945b3a54fc3808078abe98db7388a72e9c5e5bea0d

################################################################################################################## 100.0%

==> Installing python@3.12

==> Pouring python@3.12--3.12.10.arm64_sequoia.bottle.1.tar.gz

🍺  /opt/homebrew/Cellar/python@3.12/3.12.10: 3,596 files, 67MB

==> Installing Cask google-cloud-sdk

==> Running installer script 'google-cloud-sdk/install.sh'

Welcome to the Google Cloud CLI!


Your current Google Cloud CLI version is: 520.0.0

The latest available version is: 520.0.0


┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐

│                                                    Components                                                   │

├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────────┬───────────┤

│     Status    │                         Name                         │              ID              │    Size   │

├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────────┼───────────┤

│ Not Installed │ App Engine Go Extensions                             │ app-engine-go                │   4.5 MiB │

│ Not Installed │ Appctl                                               │ appctl                       │  18.5 MiB │

│ Not Installed │ Artifact Registry Go Module Package Helper           │ package-go-module            │   < 1 MiB │

│ Not Installed │ Cloud Bigtable Command Line Tool                     │ cbt                          │  19.3 MiB │

│ Not Installed │ Cloud Bigtable Emulator                              │ bigtable                     │   7.4 MiB │

│ Not Installed │ Cloud Datastore Emulator                             │ cloud-datastore-emulator     │  36.2 MiB │

│ Not Installed │ Cloud Firestore Emulator                             │ cloud-firestore-emulator     │  46.9 MiB │

│ Not Installed │ Cloud Pub/Sub Emulator                               │ pubsub-emulator              │  62.4 MiB │

│ Not Installed │ Cloud Run Proxy                                      │ cloud-run-proxy              │  11.3 MiB │

│ Not Installed │ Cloud SQL Proxy v2                                   │ cloud-sql-proxy              │  14.2 MiB │

│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr        │           │

│ Not Installed │ Kustomize                                            │ kustomize                    │   7.4 MiB │

│ Not Installed │ Log Streaming                                        │ log-streaming                │  16.0 MiB │

│ Not Installed │ Managed Flink Client                                 │ managed-flink-client         │ 383.4 MiB │

│ Not Installed │ Minikube                                             │ minikube                     │  43.5 MiB │

│ Not Installed │ Nomos CLI                                            │ nomos                        │  33.5 MiB │

│ Not Installed │ On-Demand Scanning API extraction helper             │ local-extract                │  22.4 MiB │

│ Not Installed │ Skaffold                                             │ skaffold                     │  33.3 MiB │

│ Not Installed │ Terraform Tools                                      │ terraform-tools              │  64.0 MiB │

│ Not Installed │ anthos-auth                                          │ anthos-auth                  │  20.9 MiB │

│ Not Installed │ config-connector                                     │ config-connector             │  88.7 MiB │

│ Not Installed │ enterprise-certificate-proxy                         │ enterprise-certificate-proxy │   7.6 MiB │

│ Not Installed │ gcloud Alpha Commands                                │ alpha                        │   < 1 MiB │

│ Not Installed │ gcloud Beta Commands                                 │ beta                         │   < 1 MiB │

│ Not Installed │ gcloud app Java Extensions                           │ app-engine-java              │ 118.9 MiB │

│ Not Installed │ gcloud app Python Extensions                         │ app-engine-python            │   3.8 MiB │

│ Not Installed │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras     │   < 1 MiB │

│ Not Installed │ gke-gcloud-auth-plugin                               │ gke-gcloud-auth-plugin       │   3.3 MiB │

│ Not Installed │ istioctl                                             │ istioctl                     │  23.9 MiB │

│ Not Installed │ kpt                                                  │ kpt                          │  14.5 MiB │

│ Not Installed │ kubectl                                              │ kubectl                      │   < 1 MiB │

│ Not Installed │ kubectl-oidc                                         │ kubectl-oidc                 │  20.9 MiB │

│ Not Installed │ pkg                                                  │ pkg                          │           │

│ Installed     │ BigQuery Command Line Tool                           │ bq                           │   1.8 MiB │

│ Installed     │ Cloud Storage Command Line Tool                      │ gsutil                       │  11.8 MiB │

│ Installed     │ Google Cloud CLI Core Libraries                      │ core                         │  21.5 MiB │

│ Installed     │ Google Cloud CRC32C Hash Tool                        │ gcloud-crc32c                │   1.3 MiB │

└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────────┴───────────┘


For more information on how to get started, please visit:

  https://cloud.google.com/sdk/docs/quickstarts



To install or remove components at your current SDK version [520.0.0], run:

  $ gcloud components install COMPONENT_ID

  $ gcloud components remove COMPONENT_ID


To update your SDK installation to the latest version [520.0.0], run:

  $ gcloud components update


==> Source [/opt/homebrew/share/google-cloud-sdk/completion.zsh.inc] in your profile to enable shell command completion for gcloud.

==> Source [/opt/homebrew/share/google-cloud-sdk/path.zsh.inc] in your profile to add the Google Cloud SDK command line tools to your $PATH.

==> Linking Binary 'gcloud' to '/opt/homebrew/bin/gcloud'

==> Linking Binary 'git-credential-gcloud.sh' to '/opt/homebrew/bin/git-credential-gcloud'

==> Linking Binary 'gsutil' to '/opt/homebrew/bin/gsutil'

==> Linking Binary 'completion.zsh.inc' to '/opt/homebrew/share/zsh/site-functions/_google_cloud_sdk'

==> Linking Binary 'completion.bash.inc' to '/opt/homebrew/etc/bash_completion.d/google-cloud-sdk'

==> Linking Binary 'bq' to '/opt/homebrew/bin/bq'

==> Linking Binary 'docker-credential-gcloud' to '/opt/homebrew/bin/docker-credential-gcloud'

🍺  google-cloud-sdk was successfully installed!

bash-3.2$ gcloud auth application-default login

Your browser has been opened to visit:


    https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsqlservice.login&state=L0GzqSVKXwE25fSeIerxLhNqf0E1vd&access_type=offline&code_challenge=aIv_QzK9CYyKVivuNuXeJNvBjJEjAfoFpDzTSSTHzco&code_challenge_method=S256



Credentials saved to file: [/Users/ramrajam/.config/gcloud/application_default_credentials.json]


These credentials will be used by any library that requests Application Default Credentials (ADC).

WARNING: 

Cannot find a quota project to add to ADC. You might receive a "quota exceeded" or "API not enabled" error. Run $ gcloud auth application-default set-quota-project to add a quota project.

bash-3.2$ exit

exit

ramrajam@RAMRAJAM-M-YH12 cisco_c9800_software_byol_terraform % terraform plan --var-file marketplace_test.tfvars --var project_id=cisco-public


Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the

following symbols:

  + create


Terraform will perform the following actions:


  # google_compute_firewall.tcp_22[0] will be created

  + resource "google_compute_firewall" "tcp_22" {

      + creation_timestamp = (known after apply)

      + destination_ranges = (known after apply)

      + direction          = (known after apply)

      + enable_logging     = (known after apply)

      + id                 = (known after apply)

      + name               = "test-deployment-tcp-22"

      + network            = "default"

      + priority           = 1000

      + project            = "cisco-public"

      + self_link          = (known after apply)

      + target_tags        = [

          + "test-deployment-deployment",

        ]


      + allow {

          + ports    = [

              + "22",

            ]

          + protocol = "tcp"

        }

    }


  # google_compute_firewall.tcp_80[0] will be created

  + resource "google_compute_firewall" "tcp_80" {

      + creation_timestamp = (known after apply)

      + destination_ranges = (known after apply)

      + direction          = (known after apply)

      + enable_logging     = (known after apply)

      + id                 = (known after apply)

      + name               = "test-deployment-tcp-80"

      + network            = "default"

      + priority           = 1000

      + project            = "cisco-public"

      + self_link          = (known after apply)

      + target_tags        = [

          + "test-deployment-deployment",

        ]


      + allow {

          + ports    = [

              + "80",

            ]

          + protocol = "tcp"

        }

    }


  # google_compute_instance.instance will be created

  + resource "google_compute_instance" "instance" {

      + can_ip_forward       = true

      + cpu_platform         = (known after apply)

      + creation_timestamp   = (known after apply)

      + current_status       = (known after apply)

      + deletion_protection  = false

      + effective_labels     = {

          + "goog-terraform-provisioned" = "true"

        }

      + id                   = (known after apply)

      + instance_id          = (known after apply)

      + label_fingerprint    = (known after apply)

      + machine_type         = "n1-standard-4"

      + metadata             = {

          + "fileUrl"        = null

          + "ssh-keys"       = ":"

          + "startup-script" = null

        }

      + metadata_fingerprint = (known after apply)

      + min_cpu_platform     = (known after apply)

      + name                 = "test-deployment-vm"

      + project              = "cisco-public"

      + self_link            = (known after apply)

      + tags                 = [

          + "test-deployment-deployment",

          + "test-deployment-tcp-22",

          + "test-deployment-tcp-80",

        ]

      + tags_fingerprint     = (known after apply)

      + terraform_labels     = {

          + "goog-terraform-provisioned" = "true"

        }

      + zone                 = "us-central1-f"


      + boot_disk {

          + auto_delete                = true

          + device_name                = "autogen-vm-tmpl-boot-disk"

          + disk_encryption_key_sha256 = (known after apply)

          + guest_os_features          = (known after apply)

          + kms_key_self_link          = (known after apply)

          + mode                       = "READ_WRITE"

          + source                     = (known after apply)


          + initialize_params {

              + architecture           = (known after apply)

              + image                  = "projects/cisco-public/global/images/c9800-1735a-apr07-2022"

              + labels                 = (known after apply)

              + provisioned_iops       = (known after apply)

              + provisioned_throughput = (known after apply)

              + resource_policies      = (known after apply)

              + size                   = 16

              + snapshot               = (known after apply)

              + type                   = "pd-ssd"

            }

        }


      + confidential_instance_config (known after apply)


      + guest_accelerator (known after apply)


      + network_interface {

          + internal_ipv6_prefix_length = (known after apply)

          + ipv6_access_type            = (known after apply)

          + ipv6_address                = (known after apply)

          + name                        = (known after apply)

          + network                     = "default"

          + network_attachment          = (known after apply)

          + network_ip                  = (known after apply)

          + stack_type                  = (known after apply)

          + subnetwork                  = (known after apply)

          + subnetwork_project          = (known after apply)


          + access_config {

              + nat_ip       = (known after apply)

              + network_tier = (known after apply)

            }

        }


      + reservation_affinity (known after apply)


      + scheduling (known after apply)


      + service_account {

          + email  = "default"

          + scopes = [

              + "https://www.googleapis.com/auth/cloud.useraccounts.readonly",

              + "https://www.googleapis.com/auth/devstorage.read_only",

              + "https://www.googleapis.com/auth/logging.write",

              + "https://www.googleapis.com/auth/monitoring.write",

            ]

        }

    }


Plan: 3 to add, 0 to change, 0 to destroy.


Changes to Outputs:

  + can_ip_forward        = true

  + has_external_ip       = (known after apply)

  + instance_machine_type = "n1-standard-4"

  + instance_name         = ""

  + instance_nat_ip       = (known after apply)

  + instance_network      = "default"

  + instance_self_link    = (known after apply)

  + instance_zone         = "us-central1-f"

  + number_of_nics        = 1

  + project               = "cisco-public"

Warning: Value for undeclared variable

 

The root module does not declare a variable named "instanceKey" but a value was found in file

"marketplace_test.tfvars". If you meant to use this value, add a "variable" block to the configuration.

 

To silence these warnings, use TF_VAR_... environment variables to provide certain "global" settings to all

configurations in your organization. To reduce the verbosity of these warnings, use the -compact-warnings option.


────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if

you run "terraform apply" now.

ramrajam@RAMRAJAM-M-YH12 cisco_c9800_software_byol_terraform % terraform apply

var.goog_cm_deployment_name

  The name of the deployment and VM instance.


  Enter a value: priya-gcp


var.project_id

  The ID of the project in which to provision resources.


  Enter a value: cisco-public



Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the

following symbols:

  + create


Terraform will perform the following actions:


  # google_compute_firewall.tcp_22[0] will be created

  + resource "google_compute_firewall" "tcp_22" {

      + creation_timestamp = (known after apply)

      + destination_ranges = (known after apply)

      + direction          = (known after apply)

      + enable_logging     = (known after apply)

      + id                 = (known after apply)

      + name               = "priya-gcp-tcp-22"

      + network            = "default"

      + priority           = 1000

      + project            = "cisco-public"

      + self_link          = (known after apply)

      + target_tags        = [

          + "priya-gcp-deployment",

        ]


      + allow {

          + ports    = [

              + "22",

            ]

          + protocol = "tcp"

        }

    }


  # google_compute_firewall.tcp_80[0] will be created

  + resource "google_compute_firewall" "tcp_80" {

      + creation_timestamp = (known after apply)

      + destination_ranges = (known after apply)

      + direction          = (known after apply)

      + enable_logging     = (known after apply)

      + id                 = (known after apply)

      + name               = "priya-gcp-tcp-80"

      + network            = "default"

      + priority           = 1000

      + project            = "cisco-public"

      + self_link          = (known after apply)

      + target_tags        = [

          + "priya-gcp-deployment",

        ]


      + allow {

          + ports    = [

              + "80",

            ]

          + protocol = "tcp"

        }

    }


  # google_compute_instance.instance will be created

  + resource "google_compute_instance" "instance" {

      + can_ip_forward       = true

      + cpu_platform         = (known after apply)

      + creation_timestamp   = (known after apply)

      + current_status       = (known after apply)

      + deletion_protection  = false

      + effective_labels     = {

          + "goog-terraform-provisioned" = "true"

        }

      + id                   = (known after apply)

      + instance_id          = (known after apply)

      + label_fingerprint    = (known after apply)

      + machine_type         = "n1-standard-4"

      + metadata             = {

          + "fileUrl"        = null

          + "ssh-keys"       = ":"

          + "startup-script" = null

        }

      + metadata_fingerprint = (known after apply)

      + min_cpu_platform     = (known after apply)

      + name                 = "priya-gcp-vm"

      + project              = "cisco-public"

      + self_link            = (known after apply)

      + tags                 = [

          + "priya-gcp-deployment",

          + "priya-gcp-tcp-22",

          + "priya-gcp-tcp-80",

        ]

      + tags_fingerprint     = (known after apply)

      + terraform_labels     = {

          + "goog-terraform-provisioned" = "true"

        }

      + zone                 = "us-central1-f"


      + boot_disk {

          + auto_delete                = true

          + device_name                = "autogen-vm-tmpl-boot-disk"

          + disk_encryption_key_sha256 = (known after apply)

          + guest_os_features          = (known after apply)

          + kms_key_self_link          = (known after apply)

          + mode                       = "READ_WRITE"

          + source                     = (known after apply)


          + initialize_params {

              + architecture           = (known after apply)

              + image                  = "projects/cisco-public/global/images/c9800-1735a-apr07-2022"

              + labels                 = (known after apply)

              + provisioned_iops       = (known after apply)

              + provisioned_throughput = (known after apply)

              + resource_policies      = (known after apply)

              + size                   = 16

              + snapshot               = (known after apply)

              + type                   = "pd-ssd"

            }

        }


      + confidential_instance_config (known after apply)


      + guest_accelerator (known after apply)


      + network_interface {

          + internal_ipv6_prefix_length = (known after apply)

          + ipv6_access_type            = (known after apply)

          + ipv6_address                = (known after apply)

          + name                        = (known after apply)

          + network                     = "default"

          + network_attachment          = (known after apply)

          + network_ip                  = (known after apply)

          + stack_type                  = (known after apply)

          + subnetwork                  = (known after apply)

          + subnetwork_project          = (known after apply)


          + access_config {

              + nat_ip       = (known after apply)

              + network_tier = (known after apply)

            }

        }


      + reservation_affinity (known after apply)


      + scheduling (known after apply)


      + service_account {

          + email  = "default"

          + scopes = [

              + "https://www.googleapis.com/auth/cloud.useraccounts.readonly",

              + "https://www.googleapis.com/auth/devstorage.read_only",

              + "https://www.googleapis.com/auth/logging.write",

              + "https://www.googleapis.com/auth/monitoring.write",

            ]

        }

    }


Plan: 3 to add, 0 to change, 0 to destroy.


Changes to Outputs:

  + can_ip_forward        = true

  + has_external_ip       = (known after apply)

  + instance_machine_type = "n1-standard-4"

  + instance_name         = ""

  + instance_nat_ip       = (known after apply)

  + instance_network      = "default"

  + instance_self_link    = (known after apply)

  + instance_zone         = "us-central1-f"

  + number_of_nics        = 1

  + project               = "cisco-public"


Do you want to perform these actions?

  Terraform will perform the actions described above.

  Only 'yes' will be accepted to approve.


  Enter a value: yes


google_compute_firewall.tcp_22[0]: Creating...

google_compute_firewall.tcp_80[0]: Creating...

google_compute_instance.instance: Creating...

google_compute_firewall.tcp_80[0]: Still creating... [10s elapsed]

google_compute_firewall.tcp_22[0]: Still creating... [10s elapsed]

google_compute_instance.instance: Still creating... [10s elapsed]

google_compute_firewall.tcp_80[0]: Creation complete after 14s [id=projects/cisco-public/global/firewalls/priya-gcp-tcp-80]

google_compute_firewall.tcp_22[0]: Creation complete after 14s [id=projects/cisco-public/global/firewalls/priya-gcp-tcp-22]

google_compute_instance.instance: Still creating... [20s elapsed]

google_compute_instance.instance: Still creating... [30s elapsed]

google_compute_instance.instance: Still creating... [40s elapsed]

google_compute_instance.instance: Still creating... [50s elapsed]

google_compute_instance.instance: Creation complete after 56s [id=projects/cisco-public/zones/us-central1-f/instances/priya-gcp-vm]


Apply complete! Resources: 3 added, 0 changed, 0 destroyed.


Outputs:


can_ip_forward = true

has_external_ip = true

instance_machine_type = "n1-standard-4"

instance_name = ""

instance_nat_ip = "34.27.206.52"

instance_network = "default"

instance_self_link = "https://www.googleapis.com/compute/v1/projects/cisco-public/zones/us-central1-f/instances/priya-gcp-vm"

instance_zone = "us-central1-f"

number_of_nics = 1

project = "cisco-public"


Comments