Skip to content

google_client_config data-source fails to issue token : oauth2/google: invalid response from Secure Token Server: Post "https://sts.googleapis.com/v1/token": context canceled #18774

Closed
@alexsomesan

Description

@alexsomesan

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform v1.9.2
on arm64

  • provider registry.terraform.io/hashicorp/google v5.38.0
  • provider registry.terraform.io/hashicorp/google-beta v5.38.0

Affected Resource(s)

google_client_config data-source

Terraform Configuration

provider "google" {
#    credentials = "adc.json" # uncomment to trigger error
}

data "google_client_config" "current" {}

resource "local_file" "token" {
    filename = "google_token"
    content = data.google_client_config.current.access_token
}

Debug Output

No response

Expected Behavior

Apply should succeed and a token should be written to the google_token file in the working directory.

Actual Behavior

Planning fails with following errors:

data.google_client_config.current: Reading...
data.google_client_config.current: Read complete after 0s
local_file.token: Refreshing state... [id=83053c275a52dbd8f9b4a73c3d9e529e18523939]

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Invalid Attribute Combination
│ 
│   with local_file.token,
│   on main.tf line 7, in resource "local_file" "token":
│    7: resource "local_file" "token" {
│ 
│ No attribute specified when one (and only one) of [content,sensitive_content,content_base64] is required
╵
╷
│ Error: Invalid Attribute Combination
│ 
│   with local_file.token,
│   on main.tf line 7, in resource "local_file" "token":
│    7: resource "local_file" "token" {
│ 
│ No attribute specified when one (and only one) of [content,content_base64,source] is required
╵
╷
│ Error: Invalid Attribute Combination
│ 
│   with local_file.token,
│   on main.tf line 7, in resource "local_file" "token":
│    7: resource "local_file" "token" {
│ 
│ No attribute specified when one (and only one) of [content,sensitive_content,source] is required
╵
╷
│ Error: Invalid Attribute Combination
│ 
│   with local_file.token,
│   on main.tf line 9, in resource "local_file" "token":
│    9:     content = data.google_client_config.current.access_token
│ 
│ No attribute specified when one (and only one) of [sensitive_content,content_base64,source] is required

Steps to reproduce

  1. Authenticate to GCP for ADC with gcloud auth application-default login
  2. terraform apply should succeed and produce a token
  3. Copy ADC creds to local file: cp ~/.config/gcloud/application_default_credentials.json adc.json
  4. Uncomment the credentials attribute on the provider block
  5. terraform apply should fail with above mentioned error

Important Factoids

This doesn't seem to be specific to ADC credentials. I was able to reproduce with workload identity credentials as well.

References

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions