Packer
Google Cloud Platform
@hashicorp
The googlecompute plugin can be used with HashiCorp Packer to create custom images on GCE.
- Official
- HCP Ready
Updated 3 years ago
- GitHub(opens in new tab)
Parameter Manager
The Parameter Manager data source provides the capability to retrieve the parameters stored in google cloud along with revealed secrets
Note: Data sources is a feature exclusively available to HCL2 templates.
Basic examples of usage:
data "googlecompute-parametermanager" "basic-example" {
  project_id = "debian-cloud"
  name       = "packer_test_parameter"
  key        = "packer_test_key"
  version    = "1"
  location   = "us-east1"    
}
# usage example of the data source output
locals {
  value = data.googlecompute-parametermanager.basic-example.value
  payload = data.googlecompute-parametermanager.basic-example.payload
}
Reading key-value pairs from JSON back into a native Packer map can be accomplished with the jsondecode() function.
Reading key-value pairs from YAML back into a native Packer map can be accomplished with the yamldecode() function.
Configuration Reference
Required
- project_id(string) - The Google Cloud project ID where the parameter is stored.
- name(string) - The name of the parameter within the Parameter Manager.
- version(string) - The version of the parameter within the Parameter Manager.
Optional
- location(string) - The location in which parameter is stored. Defaults to "global" if not specified.
- key(string) - A specific key to extract from the parameter payload if it's a JSON or YAML object.
Output Data
- payload(string) - The raw string payload of the parameter version.
- value(string) - The value extracted using the 'key', if provided.
Authentication
To authenticate with GCE, this data-source supports everything the plugin does. To get more information on this, refer to the plugin's description page, under the authentication section.