getAccountJwt

This data source provides a self-signed JWT. Tokens issued from this data source are typically used to call external services that accept JWTs for authentication.

Example Usage

Note: in order to use the following, the caller must have at least roles/iam.serviceAccountTokenCreator on the target_service_account.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceAccount.ServiceAccountFunctions;
import com.pulumi.gcp.serviceAccount.inputs.GetAccountJwtArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var foo = ServiceAccountFunctions.getAccountJwt(GetAccountJwtArgs.builder()
.targetServiceAccount("impersonated-account@project.iam.gserviceaccount.com")
.payload(serializeJson(
jsonObject(
jsonProperty("foo", "bar"),
jsonProperty("sub", "subject")
)))
.expiresIn(60)
.build());
ctx.export("jwt", foo.applyValue(getAccountJwtResult -> getAccountJwtResult.jwt()));
}
}

Return

A collection of values returned by getAccountJwt.

Parameters

argument

A collection of arguments for invoking getAccountJwt.


suspend fun getAccountJwt(delegates: List<String>? = null, expiresIn: Int? = null, payload: String, targetServiceAccount: String): GetAccountJwtResult

Return

A collection of values returned by getAccountJwt.

Parameters

delegates

Delegate chain of approvals needed to perform full impersonation. Specify the fully qualified service account name.

expiresIn

Number of seconds until the JWT expires. If set and non-zero an exp claim will be added to the payload derived from the current timestamp plus expires_in seconds.

payload

The JSON-encoded JWT claims set to include in the self-signed JWT.

targetServiceAccount

The email of the service account that will sign the JWT.

See also


Return

A collection of values returned by getAccountJwt.

Parameters

argument

Builder for com.pulumi.gcp.serviceAccount.kotlin.inputs.GetAccountJwtPlainArgs.

See also