![]() ( gcloud auth application-default login creates it) GOOGLE_APPLICATION_CREDENTIALS environment variable.Ī JSON file in a location known to the gcloud command-line tool. Packer looks for credentials in the following places, preferring the firstĪn access_token option in your packer file.Īn account_file option in your packer file.Ī JSON file (Service Account) whose path is specified by the Set the Environment Variable GOOGLE_APPLICATION_CREDENTIALS to point to the path of the service account key. Generate a JSON Key and save it in a secure location. Straightforwarded, it is documented here.Ĭlick Select a project, choose your project, and click Open.Įnter a service account name (friendly display name), an optional description, select the Compute Engine Instance Admin (v1) and Service Account User roles, and then click Save. You to create and download a credential file that will let you use the No account file specified in the Packer configuration file. The service account will be used automatically by Packer as long as there is $ gcloud iam service-accounts create packer \ -project YOUR_GCP_PROJECT \ -description = "Packer Service Account" \ -display-name = "Packer Service Account" $ gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT \ -member \ -role =roles/1 $ gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT \ -member \ -role =roles/iam.serviceAccountUser $ gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT \ -member \ -role =roles/iap.tunnelResourceAccessor $ gcloud compute instances create INSTANCE-NAME \ -project YOUR_GCP_PROJECT \ -image-family ubuntu-2004-lts \ -image-project ubuntu-os-cloud \ -network YOUR_GCP_NETWORK \ -zone YOUR_GCP_ZONE \ -service-account \ -scopes = "" It is recommended that you create a custom service account for Packer and assign itĬompute Instance Admin (v1)
0 Comments
Leave a Reply. |