Home > other >  terraform import google_vpc_access_connector.default throws "Error: unknown resource type: goog
terraform import google_vpc_access_connector.default throws "Error: unknown resource type: goog

Time:12-13

I'm trying to import GCP serveless vpc connector:

 terraform import google_vpc_access_connector.default connector-id

Then I get error:

google_vpc_access_connector.default: Importing from ID "connector-id"...
╷
│ Error: unknown resource type: google_vpc_access_connector

I'm on Mac M1 arch so to use terraform I had to install it via tfenv, wondering if that might be the cause:

brew uninstall terraform
brew install tfenv
TFENV_ARCH=amd64 tfenv install 1.3.4
tfenv use 1.3.4

When running terraform providers I get:

Providers required by configuration:
.
└── provider[registry.terraform.io/hashicorp/google] 3.5.0

Providers required by state:

    provider[registry.terraform.io/hashicorp/google]

CodePudding user response:

Version 3.5.0 of the Terraform google provider is too old to support the google_vpc_access_connector resource. It was added in version 3.11.0. You would need to update your provider to at least that version to support the resource.

Alternatively: you could switch to the beta version of the google provider at that version to support the beta version of the resource, but since patch version updates are safe anyway, then the better course of action would be a patch version update to at least 3.11.0.

A terraform block in your config (typically versions.tf) may appear like:

terraform {
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "~> 3.11"
    }
  }
}
  • Related