credentials

package
v0.19.1221 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchEnv

func FetchEnv(_ context.Context, cfg *Config) (map[string]string, error)

FetchEnv returns environment variables needed for Terraform to operate in a GCP project. When ImpersonateServiceAccount is set, GOOGLE_IMPERSONATE_SERVICE_ACCOUNT is exported so the Terraform google provider calls iamcredentials.generateAccessToken on demand and handles token refresh automatically — avoiding the 1-hour static-token expiry problem.

func ImpersonatedAccessToken added in v0.19.1207

func ImpersonatedAccessToken(ctx context.Context, targetSA string) (string, error)

ImpersonatedAccessToken mints an OAuth2 access token for targetSA using the caller's own credentials as the source.

Types

type Config

type Config struct {
	ProjectID                 string `json:"project_id" temporaljson:"project_id"`
	Region                    string `json:"region" temporaljson:"region"`
	ImpersonateServiceAccount string `json:"impersonate_service_account,omitempty" temporaljson:"impersonate_service_account,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL