Skip to content

googleServiceAccountKey

Get service account public key. For more information, see the official documentation and API.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleServiceAccountMyaccount = new google.serviceAccount.ServiceAccount(
  this,
  "myaccount",
  {
    account_id: "dev-foo-account",
  }
);
const googleServiceAccountKeyMykey =
  new google.serviceAccountKey.ServiceAccountKey(this, "mykey", {
    service_account_id: googleServiceAccountMyaccount.name,
  });
const dataGoogleServiceAccountKeyMykey =
  new google.dataGoogleServiceAccountKey.DataGoogleServiceAccountKey(
    this,
    "mykey_2",
    {
      name: googleServiceAccountKeyMykey.name,
      public_key_type: "TYPE_X509_PEM_FILE",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataGoogleServiceAccountKeyMykey.overrideLogicalId("mykey");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the service account key. This must have format projects/{projectId}/serviceAccounts/{account}/keys/{keyid}, where {account} is the email address or unique id of the service account.

  • project - (Optional) The ID of the project that the service account will be created in. Defaults to the provider project configuration.

  • publicKeyType (Optional) The output format of the public key requested. TYPE_X509_PEM_FILE is the default output format.

Attributes Reference

The following attributes are exported in addition to the arguments listed above:

  • publicKey - The public key, base64 encoded