Hi,
I would like to create an access key to save as a json file for credentials for gcp provider for Terraform.
Here is video showing not able to create access key.
Please help.
Thank you,
John Kennedy
Not able to create access key
Hi,
I would like to create an access key to save as a json file for credentials for gcp provider for Terraform.
Here is video showing not able to create access key.
Please help.
Thank you,
John Kennedy
Not able to create access key
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "3.84.0"
}
}
}
provider "google" {
project = "clgcporg8-065"
region = "us-central1"
zone = "us-central1-c"
}
resource "google_compute_instance" "vm_test_instance" {
name = "terraform-my-instance"
machine_type = "e2-medium"
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
labels = {
my_label = "value"
}
}
}
network_interface {
network = "default"
access_config {}
}
}
$ terraform init
Initializing the backend…
Initializing provider plugins…
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.
Home@DESKTOP-489BGE8 MINGW64 /c/KodeKloud_Pro/terraform/terraform-associate-labs/021_providers_gcp
$ terraform plan
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
Terraform will perform the following actions:
can_ip_forward = false
cpu_platform = (known after apply)
current_status = (known after apply)
deletion_protection = false
guest_accelerator = (known after apply)
id = (known after apply)
instance_id = (known after apply)
label_fingerprint = (known after apply)
machine_type = “e2-medium”
metadata_fingerprint = (known after apply)
min_cpu_platform = (known after apply)
name = “terraform-my-instance”
project = (known after apply)
self_link = (known after apply)
tags_fingerprint = (known after apply)
zone = (known after apply)
boot_disk {
auto_delete = true
device_name = (known after apply)
disk_encryption_key_sha256 = (known after apply)
kms_key_self_link = (known after apply)
mode = “READ_WRITE”
source = (known after apply)
initialize_params {
network_interface {
name = (known after apply)
network = “default”
network_ip = (known after apply)
subnetwork = (known after apply)
subnetwork_project = (known after apply)
access_config {
Plan: 1 to add, 0 to change, 0 to destroy.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
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.
Home@DESKTOP-489BGE8 MINGW64 /c/KodeKloud_Pro/terraform/terraform-associate-labs/021_providers_gcp
$ terraform apply --auto-approve
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
Terraform will perform the following actions:
can_ip_forward = false
cpu_platform = (known after apply)
current_status = (known after apply)
deletion_protection = false
guest_accelerator = (known after apply)
id = (known after apply)
instance_id = (known after apply)
label_fingerprint = (known after apply)
machine_type = “e2-medium”
metadata_fingerprint = (known after apply)
min_cpu_platform = (known after apply)
name = “terraform-my-instance”
project = (known after apply)
self_link = (known after apply)
tags_fingerprint = (known after apply)
zone = (known after apply)
boot_disk {
auto_delete = true
device_name = (known after apply)
disk_encryption_key_sha256 = (known after apply)
kms_key_self_link = (known after apply)
mode = “READ_WRITE”
source = (known after apply)
initialize_params {
network_interface {
name = (known after apply)
network = “default”
network_ip = (known after apply)
subnetwork = (known after apply)
subnetwork_project = (known after apply)
access_config {
Plan: 1 to add, 0 to change, 0 to destroy.
google_compute_instance.vm_test_instance: Creating…
╷
│ Error: Error loading zone ‘us-central1-c’: Get “https://compute.googleapis.com/compute/v1/projects/clgcporg8-065/zones/us-central1-c?alt=json&prettyPrint=false”: oauth2: cannot fetch token: 400 Bad Request
│ Response: {
│ “error”: “invalid_grant”,
│ “error_description”: “Account has been deleted”
│ }
│
│ with google_compute_instance.vm_test_instance,
│ on main.tf line 16, in resource “google_compute_instance” “vm_test_instance”:
│ 16: resource “google_compute_instance” “vm_test_instance” {