Skip to content

Cycle dependency when importing resources with access_token in default Google provider #22804

@xynova

Description

@xynova

Filed the original issue in under google-provider but the problem seems to be in TF core as mentioned here:
hashicorp/terraform-provider-google#4443

Terraform Version

Terraform version: 0.12.8

provider.google v2.14.0
provider.google-beta v2.14.0

Terraform Configuration Files

terraform {
  required_version = ">=v0.12.8"
  required_providers {
    google = "v2.14.0"
    google-beta = "v2.14.0"
  }
}

provider "google" {
  alias = "myself"
}

data "google_service_account_access_token" "impersonated" {
  provider = "google.myself"
  target_service_account = "${var.run_plan_as_svcacc}"
  lifetime = "300s"
  scopes = [
    "https://www.googleapis.com/auth/cloud-platform"
    ]
}

provider "google" {
  access_token = "${data.google_service_account_access_token.impersonated.access_token}"
  project = "${var.project}"
  region = "${local.location}"
}

Debug Output

https://gist.github.com/xynova/4117bfe303fb04260ad6c64d87c55374

Expected Behavior

I would have expected the provider hierarchy to be resolved

Actual Behavior

Error: Cycle: data.google_service_account_access_token.impersonated, provider.google

Steps to Reproduce

terraform import google_kms_crypto_key.etcd_enc_key projects/myproject/locations/australia-southeast1/keyRings/gke-clusters-keyring/cryptoKeys/experiments-cluster-v2-cluster-etcd-key

References

hashicorp/terraform-provider-google#4443

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions