├── .copywrite.hcl ├── .gitattributes ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── feature_requests.md │ ├── plugin_integration.md │ ├── question.md │ └── ssh_or_winrm_times_out.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml ├── labeler-issue-triage.yml └── workflows │ ├── acceptance-test.yml │ ├── auto-close-stale-issues.yml │ ├── backport.yml │ ├── build.yml │ ├── create-release-branch.yml │ ├── go-test.yml │ ├── go-validate.yml │ ├── issue-comment-created.yml │ ├── issue-migrator.yml │ ├── issues-opened.yml │ ├── jira.yml │ ├── lock.yml │ ├── nightly-release-readme.md │ └── nightly-release.yml ├── .gitignore ├── .go-version ├── .golangci.yml ├── .release ├── ci.hcl ├── docker │ └── README.md ├── packer-artifacts.hcl ├── release-metadata.hcl └── security-scan.hcl ├── CHANGELOG.md ├── CODEOWNERS ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── Vagrantfile ├── acctest ├── plugin │ ├── component_acc_test.go │ ├── plugin_acc_test.go │ └── test-fixtures │ │ ├── basic-amazon-ami-datasource.pkr.hcl │ │ └── basic-amazon-ebs.pkr.hcl ├── testing.go └── testing_test.go ├── background_check.go ├── background_check_openbsd.go ├── builder ├── file │ ├── artifact.go │ ├── artifact_test.go │ ├── builder.go │ ├── builder_test.go │ ├── config.go │ ├── config.hcl2spec.go │ ├── config_test.go │ ├── test-fixtures │ │ └── artifact.txt │ └── version │ │ └── version.go ├── null │ ├── artifact_export.go │ ├── artifact_export_test.go │ ├── builder.go │ ├── builder_test.go │ ├── config.go │ ├── config.hcl2spec.go │ ├── config_test.go │ ├── ssh.go │ └── version │ │ └── version.go └── test-fixtures │ └── floppies │ ├── bar.bat │ └── foo.ps1 ├── checkpoint.go ├── cmd ├── generate-fixer-deprecations │ └── main.go └── ssh-keygen │ └── main.go ├── command ├── build.go ├── build_cancellation_test.go ├── build_cleanup_script_test.go ├── build_parallel_test.go ├── build_test.go ├── build_timeout_test.go ├── build_windows_test.go ├── cli.go ├── command_test.go ├── configtype_enumer.go ├── console.go ├── console_test.go ├── enumflag │ └── flag.go ├── exec_test.go ├── execute.go ├── fix.go ├── fix_test.go ├── flag-kv │ ├── flag.go │ ├── flag_json.go │ ├── flag_json_test.go │ ├── flag_strings.go │ ├── flag_strings_test.go │ ├── flag_test.go │ └── test-fixtures │ │ └── basic.json ├── flag-slice │ ├── flag.go │ └── flag_test.go ├── fmt.go ├── fmt_test.go ├── hcl2_upgrade.go ├── hcl2_upgrade_test.go ├── init.go ├── init_test.go ├── inspect.go ├── inspect_test.go ├── meta.go ├── plugins.go ├── plugins_install.go ├── plugins_install_test.go ├── plugins_installed.go ├── plugins_remove.go ├── plugins_required.go ├── signal.go ├── test-fixtures │ ├── build-name-and-type │ │ ├── all.json │ │ ├── all.pkr.hcl │ │ └── buildname.pkr.hcl │ ├── build-only │ │ ├── not-found.json │ │ ├── template.json │ │ ├── template.pkr.hcl │ │ └── template.pkr.json │ ├── build-variable-sharing │ │ └── template.json │ ├── cleanup-script │ │ └── template.json │ ├── fix-invalid │ │ └── template.json │ ├── fix │ │ └── template.json │ ├── fmt │ │ ├── formatted.pkr.hcl │ │ ├── unformatted.auto.pkrvars.hcl │ │ ├── unformatted.pkr.hcl │ │ └── unformatted.pkrvars.hcl │ ├── fmt_errs │ │ └── malformed.pkr.hcl │ ├── hcl-inspect-with-sensitive-vars │ │ ├── expected-output.txt │ │ └── vars.pkr.hcl │ ├── hcl-only-except │ │ └── build.pkr.hcl │ ├── hcl │ │ ├── build-var-in-pp.pkr.hcl │ │ ├── build_no_source.pkr.hcl │ │ ├── data-source-validation.pkr.hcl │ │ ├── datasource.pkr.hcl │ │ ├── dynamic │ │ │ └── build.pkr.hcl │ │ ├── empty_object │ │ │ ├── setting.auto.pkrvars.hcl │ │ │ └── var.pkr.hcl │ │ ├── force.pkr.hcl │ │ ├── inspect │ │ │ ├── aws-builds.pkr.hcl │ │ │ ├── fruit_string.pkr.hcl │ │ │ └── virtualbox-builds.pkr.hcl │ │ ├── local-ds-validate.pkr.hcl │ │ ├── nil-component-crash.pkr.hcl │ │ ├── no_build.pkr.hcl │ │ ├── provisioner-override.pkr.hcl │ │ ├── recipes │ │ │ ├── build.pkr.hcl │ │ │ └── sources.pkr.hcl │ │ ├── recursive_local_with_input │ │ │ └── locals.pkr.hcl │ │ ├── recursive_local_with_unset_input │ │ │ └── file.pkr.hcl │ │ ├── reprepare │ │ │ ├── hello.sh │ │ │ ├── shell-local-windows.pkr.hcl │ │ │ ├── shell-local.pkr.hcl │ │ │ └── test_cmd.cmd │ │ ├── test_except_manifest.pkr.hcl │ │ ├── validation │ │ │ ├── map │ │ │ │ ├── definition.pkr.hcl │ │ │ │ ├── invalid_value.pkrvars.hcl │ │ │ │ └── valid_value.pkrvars.hcl │ │ │ └── wrong_pause_before.pkr.hcl │ │ ├── var-in-pp-name.pkr.hcl │ │ ├── variables │ │ │ ├── list_of_string │ │ │ │ └── var.pkr.hcl │ │ │ ├── ref_non_existing │ │ │ │ ├── ref_non_existing_var.pkr.hcl │ │ │ │ └── variables.auto.pkrvars.hcl │ │ │ └── untyped_var │ │ │ │ ├── settings.auto.pkrvars.hcl │ │ │ │ └── var.pkr.hcl │ │ └── vars-in-build-block.pkr.hcl │ ├── hcl2_upgrade │ │ ├── ami_test │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── aws-access-config │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── azure_shg │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── bundled-plugin-used │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── complete-variables-with-template-engine │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── complete │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── error-cleanup-provisioner │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── escaping │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── minimal │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── placeholders │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── source-name │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── undeclared-variables │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── unknown_builder │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── varfile-with-no-variables-block │ │ │ ├── expected.pkr.hcl │ │ │ ├── input.json │ │ │ └── variables.json │ │ ├── variables-only │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── variables-with-variables │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ ├── vsphere_linux_options_and_network_interface │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ │ └── without-annotations │ │ │ ├── expected.pkr.hcl │ │ │ └── input.json │ ├── hcp │ │ ├── build-description.pkr.hcl │ │ ├── deprecated_labels.pkr.hcl │ │ ├── dup_build_blocks.pkr.hcl │ │ ├── duplicate.pkr.hcl │ │ ├── hcp_build.json │ │ ├── hcp_normal.pkr.json │ │ ├── multiple_sources.pkr.hcl │ │ ├── override-build-description.pkr.hcl │ │ ├── slug.pkr.hcl │ │ └── variable-for-bucket_name.pkr.hcl │ ├── inspect │ │ └── unset_var.json │ ├── parallel │ │ ├── 1lock-5wg.json │ │ ├── 1lock.json │ │ ├── 2lock-4wg.json │ │ ├── 2lock-timeout.json │ │ └── 2lock.json │ ├── provisioners │ │ ├── provisioner-only-except.json │ │ ├── provisioner-only-except.pkr.hcl │ │ └── provisioner-override.json │ ├── timeout │ │ └── template.json │ ├── validate-invalid │ │ ├── bad_provisioner.json │ │ ├── broken.json │ │ └── missing_build_block.pkr.hcl │ ├── validate │ │ ├── build.json │ │ ├── build.pkr.hcl │ │ ├── build_with_vars.pkr.hcl │ │ ├── circular_error.pkr.hcl │ │ ├── datasource.pkr.hcl │ │ ├── invalid_block_type.pkr.hcl │ │ ├── invalid_packer_block.pkr.hcl │ │ ├── null_var.json │ │ ├── template.json │ │ ├── validate_except.json │ │ ├── validate_except.pkr.hcl │ │ ├── var-file-tests │ │ │ ├── basic.pkr.hcl │ │ │ ├── basic.pkrvars.hcl │ │ │ ├── undeclared.json │ │ │ └── undeclared.pkrvars.hcl │ │ └── var_foo_with_no_default.pkr.hcl │ ├── var-arg │ │ ├── apple.hcl │ │ ├── apple.json │ │ ├── banana.json │ │ ├── chocolate.auto.pkrvars.hcl │ │ ├── fruit_builder.json │ │ ├── fruit_builder.pkr.hcl │ │ ├── map.pkr.hcl │ │ ├── var-arg-test-autovar-json │ │ │ ├── fruit_builder.pkr.hcl │ │ │ └── peanut.auto.pkrvars.json │ │ └── var-arg-tests │ │ │ ├── fruit_builder.pkr.hcl │ │ │ ├── icecream.auto.pkrvrs.hcl │ │ │ └── peanut.auto.pkrvars.json │ └── version_req │ │ ├── base_failure │ │ └── version.pkr.hcl │ │ ├── base_success │ │ └── version.pkr.hcl │ │ └── wrong_field_name │ │ └── version.pkr.hcl ├── test_utils.go ├── utils.go ├── utils_test.go ├── validate.go ├── validate_test.go ├── version.go └── version_test.go ├── commands.go ├── config.go ├── config_test.go ├── contrib └── zsh-completion │ └── _packer ├── datasource ├── .gitkeep ├── hcp-packer-artifact │ ├── data.go │ └── data.hcl2spec.go ├── hcp-packer-image │ ├── data.go │ └── data.hcl2spec.go ├── hcp-packer-iteration │ ├── data.go │ ├── data.hcl2spec.go │ ├── data_acc_test.go │ └── test-fixtures │ │ ├── hcp-setup-build.pkr.hcl │ │ └── template.pkr.hcl ├── hcp-packer-version │ ├── data.go │ ├── data.hcl2spec.go │ ├── data_acc_test.go │ └── test-fixtures │ │ ├── hcp-setup-build.pkr.hcl │ │ └── template.pkr.hcl ├── http │ ├── data.go │ ├── data.hcl2spec.go │ ├── data_acc_test.go │ └── test-fixtures │ │ ├── 404_url.pkr.hcl │ │ ├── basic.pkr.hcl │ │ ├── empty_url.pkr.hcl │ │ └── invalid_method.pkr.hcl └── null │ ├── data.go │ └── data.hcl2spec.go ├── examples ├── _common │ ├── minimize.sh │ ├── parallels.sh │ ├── sshd.sh │ ├── vagrant.sh │ ├── virtualbox.sh │ └── vmware.sh ├── hcl │ └── linux │ │ ├── README.md │ │ ├── build.alpine.pkr.hcl │ │ ├── build.ubuntu.pkr.hcl │ │ ├── etc │ │ ├── http │ │ │ ├── alpine-answers │ │ │ ├── alpine-setup.sh │ │ │ ├── alpine-vsphere-answers │ │ │ ├── preseed.cfg │ │ │ └── preseed_hardcoded_ip.cfg │ │ └── scripts │ │ │ ├── 010-update.sh │ │ │ ├── 020-sshd.sh │ │ │ ├── 030-networking.sh │ │ │ ├── 040-sudoers.sh │ │ │ ├── 050-vagrant.sh │ │ │ ├── 060-virtualbox.sh │ │ │ ├── 070-vmware.sh │ │ │ ├── 080-parallels.sh │ │ │ ├── 090-hyperv.sh │ │ │ ├── 100-cleanup.sh │ │ │ └── 110-minimize.sh │ │ ├── source.esxi-vmware-iso.pkr.hcl │ │ ├── source.parallels-iso.pkr.hcl │ │ ├── source.qemu.pkr.hcl │ │ ├── source.virtualbox-iso.pkr.hcl │ │ ├── source.vmware-iso.pkr.hcl │ │ ├── source.vmware-vmx.pkr.hcl │ │ ├── source.vsphere-iso.pkr.hcl │ │ ├── variables.16.04.pkr.hcl │ │ ├── variables.18.04.pkr.hcl │ │ ├── variables.alpine.pkr.hcl │ │ └── variables.common.pkr.hcl └── preseeds │ └── ubuntu_preseed.cfg ├── fix ├── fixer.go ├── fixer_amazon_enhanced_networking.go ├── fixer_amazon_enhanced_networking_test.go ├── fixer_amazon_private_ip.go ├── fixer_amazon_private_ip_test.go ├── fixer_amazon_shutdown_behavior.go ├── fixer_amazon_shutdown_behavior_test.go ├── fixer_amazon_spot_price_product.go ├── fixer_amazon_temporary_security_group_cidrs.go ├── fixer_amazon_temporary_security_group_cidrs_test.go ├── fixer_azure_exclude_from_latest.go ├── fixer_azure_exclude_from_latest_test.go ├── fixer_clean_image_name.go ├── fixer_clean_image_name_test.go ├── fixer_comm_config.go ├── fixer_comm_config_test.go ├── fixer_createtime.go ├── fixer_createtime_test.go ├── fixer_docker_email.go ├── fixer_galaxy_command.go ├── fixer_galaxy_command_test.go ├── fixer_hyperv_cpu_and_ram_naming.go ├── fixer_hyperv_deprecations.go ├── fixer_hyperv_deprecations_test.go ├── fixer_hyperv_vmxc_typo.go ├── fixer_hyperv_vmxc_typo_test.go ├── fixer_iso_checksum_type_and_url.go ├── fixer_iso_checksum_type_and_url_test.go ├── fixer_iso_md5.go ├── fixer_iso_md5_test.go ├── fixer_parallels_deprecations.go ├── fixer_parallels_deprecations_test.go ├── fixer_parallels_headless.go ├── fixer_parallels_headless_test.go ├── fixer_powershell_escapes.go ├── fixer_pp_docker_tag_tags.go ├── fixer_pp_docker_tag_tags_test.go ├── fixer_pp_manifest_filename.go ├── fixer_pp_manifest_filename_test.go ├── fixer_pp_vagrant_override.go ├── fixer_pp_vagrant_override_test.go ├── fixer_proxmox_type.go ├── fixer_proxmox_type_test.go ├── fixer_qemu_disk_size.go ├── fixer_qemu_disk_size_test.go ├── fixer_qemu_host_port.go ├── fixer_qemu_host_port_test.go ├── fixer_scaleway_access_key.go ├── fixer_scaleway_access_key_test.go ├── fixer_ssh_timeout.go ├── fixer_ssh_timeout_test.go ├── fixer_sshdisableagent.go ├── fixer_sshdisableagent_test.go ├── fixer_sshkeypath.go ├── fixer_sshkeypath_test.go ├── fixer_test.go ├── fixer_virtualbox_gaattach.go ├── fixer_virtualbox_gaattach_test.go ├── fixer_virtualbox_rename.go ├── fixer_virtualbox_rename_test.go ├── fixer_vmware_compaction.go ├── fixer_vmware_compaction_test.go ├── fixer_vmware_rename.go ├── fixer_vmware_rename_test.go ├── fixer_vsphere_network_storage.go ├── fixer_vsphere_network_storage_test.go └── helpers.go ├── go ├── go.mod ├── go.sum ├── hcl2template ├── addrs │ ├── doc.go │ ├── input_variable.go │ ├── parse_ref.go │ ├── plugin.go │ ├── plugin_test.go │ └── referenceable.go ├── common_test.go ├── components.go ├── decode.go ├── docs.go ├── fixtures │ ├── malformed_override.pkr.hcl │ ├── malformed_override_innards.pkr.hcl │ └── well_formed_provisioner.pkr.hcl ├── formatter.go ├── formatter_test.go ├── function │ ├── Consul.go │ ├── alltrue.go │ ├── alltrue_test.go │ ├── anytrue.go │ ├── anytrue_test.go │ ├── aws_secretetkey.go │ ├── datetime.go │ ├── datetime_test.go │ ├── encoding.go │ ├── encoding_test.go │ ├── ends_with.go │ ├── ends_with_test.go │ ├── env.go │ ├── filebase64.go │ ├── filebase64_test.go │ ├── index.go │ ├── index_test.go │ ├── length.go │ ├── length_test.go │ ├── refinements.go │ ├── starts_with.go │ ├── starts_with_test.go │ ├── strcontains.go │ ├── strcontains_test.go │ ├── sum.go │ ├── sum_test.go │ ├── templatefile.go │ ├── templatefile_test.go │ ├── testdata │ │ ├── bare.tmpl │ │ ├── func.tmpl │ │ ├── hello.tmpl │ │ ├── hello.txt │ │ ├── icon.png │ │ ├── list.tmpl │ │ └── recursive.tmpl │ └── vault.go ├── functions.go ├── internal │ ├── mock.go │ └── mock.hcl2spec.go ├── parser.go ├── plugin.go ├── repl │ ├── format.go │ └── repl.go ├── shim │ ├── mock.go │ ├── mock.hcl2spec.go │ ├── values.go │ └── values_test.go ├── testdata │ ├── build.pkr.hcl │ │ └── basic.pkr.hcl │ ├── build │ │ ├── basic.pkr.hcl │ │ ├── invalid_build_name_variable.pkr.hcl │ │ ├── invalid_source_reference.pkr.hcl │ │ ├── named.pkr.hcl │ │ ├── post-processor_build_name_interpolation.pkr.hcl │ │ ├── post-processor_nonexistent.pkr.hcl │ │ ├── post-processor_onlyexcept.pkr.hcl │ │ ├── post-processor_untyped.pkr.hcl │ │ ├── provisioner_build_name_interpolation.pkr.hcl │ │ ├── provisioner_nonexistent.pkr.hcl │ │ ├── provisioner_onlyexcept.pkr.hcl │ │ ├── provisioner_packer_version_interpolation.pkr.hcl │ │ ├── provisioner_paused_before_retry.pkr.hcl │ │ ├── provisioner_timeout.pkr.hcl │ │ ├── provisioner_untyped.pkr.hcl │ │ ├── two-error-cleanup-provisioner.pkr.hcl │ │ └── variables.pkr.hcl │ ├── communicator │ │ └── basic.pkr.hcl │ ├── complete │ │ ├── build.pkr.hcl │ │ ├── datasource.pkr.hcl │ │ ├── sources.pkr.hcl │ │ └── variables.pkr.hcl │ ├── datasources │ │ ├── basic.pkr.hcl │ │ ├── dependency_cycle.pkr.hcl │ │ ├── duplicate.pkr.hcl │ │ ├── nonexistent.pkr.hcl │ │ ├── not-allowed.pkr.hcl │ │ ├── recursive.pkr.hcl │ │ ├── unnamed.pkr.hcl │ │ └── untyped.pkr.hcl │ ├── empty │ │ └── .gitkeep │ ├── format │ │ ├── formatted.pkr.hcl │ │ ├── test.json │ │ ├── unformatted.pkr.hcl │ │ └── unformatted.pkrvars.hcl │ ├── hcp_par │ │ ├── build-block-error-multiple-hcp-declaration.pkr.hcl │ │ ├── build-block-ok-bucket.pkr.hcl │ │ ├── build-block-ok-multiple-build-block-second-block.pkr.hcl │ │ ├── build-block-ok-multiple-build-block.pkr.hcl │ │ ├── top-level-and-build-block.pkr.hcl │ │ ├── top-level-empty-bucket.pkr.hcl │ │ ├── top-level-invalid-bucket.pkr.hcl │ │ ├── top-level-invalid.pkr.hcl │ │ ├── top-level-long-bucket.pkr.hcl │ │ ├── top-level-long-description.pkr.hcl │ │ ├── top-level-ok-bucket.pkr.hcl │ │ ├── top-level-short-bucket.pkr.hcl │ │ ├── top-level-variable-for-bucket-name.pkr.hcl │ │ └── top-level-variables-for-labels.pkr.hcl │ ├── init │ │ ├── duplicate_required_plugins │ │ │ └── packer.pkr.hcl │ │ ├── imports │ │ │ ├── build.pkr.hcl │ │ │ ├── sources.pkr.hcl │ │ │ └── variables.pkr.hcl │ │ ├── invalid_inexplicit_source.pkr.hcl │ │ ├── invalid_inexplicit_source_2.pkr.hcl │ │ └── invalid_short_source.pkr.hcl │ ├── sources │ │ ├── basic.pkr.hcl │ │ ├── duplicate.pkr.hcl │ │ ├── nonexistent.pkr.hcl │ │ ├── nonexistent_used.pkr.hcl │ │ ├── unnamed.pkr.hcl │ │ └── untyped.pkr.hcl │ ├── unknown │ │ └── block_type.pkr.hcl │ └── variables │ │ ├── basic.pkr.hcl │ │ ├── complicated │ │ ├── a.pkr.hcl │ │ ├── b.pkr.hcl │ │ ├── c.pkr.hcl │ │ └── d.pkr.hcl │ │ ├── duplicate_locals │ │ ├── one.pkr.hcl │ │ └── one_copy.pkr.hcl │ │ ├── duplicate_variable.pkr.hcl │ │ ├── duplicate_variables.pkr.hcl │ │ ├── empty.pkr.hcl │ │ ├── foo-string.variable.pkr.hcl │ │ ├── invalid_default.pkr.hcl │ │ ├── provisioner_variable_decoding.pkr.hcl │ │ ├── recursive_locals.pkr.hcl │ │ ├── set-foo-too-wee.hcl │ │ ├── unknown_key.pkr.hcl │ │ ├── unset_unused_string_variable.pkr.hcl │ │ ├── unset_used_string_variable.pkr.hcl │ │ └── validation │ │ ├── invalid_default.pkr.hcl │ │ ├── valid.pkr.hcl │ │ └── valid_map │ │ ├── definition.pkr.hcl │ │ └── invalid_value.auto.pkrvars.hcl ├── types.build.from.go ├── types.build.go ├── types.build.hcp_packer_registry.go ├── types.build.hcp_packer_registry_test.go ├── types.build.post-processor.go ├── types.build.provisioners.go ├── types.build.provisioners_test.go ├── types.build_test.go ├── types.datasource.go ├── types.datasource_test.go ├── types.hcl_post-processor.go ├── types.hcl_provisioner.go ├── types.hcl_ref.go ├── types.packer_config.go ├── types.packer_config_test.go ├── types.refstring.go ├── types.required_plugins.go ├── types.required_plugins_test.go ├── types.source.go ├── types.source_test.go ├── types.variables.go ├── types.variables_test.go ├── utils.go ├── version.go └── version_required.go ├── helper ├── wrappedreadline │ ├── wrappedreadline.go │ ├── wrappedreadline_solaris.go │ ├── wrappedreadline_unix.go │ └── wrappedreadline_windows.go └── wrappedstreams │ ├── streams.go │ ├── streams_other.go │ └── streams_windows.go ├── internal ├── dag │ ├── dag.go │ ├── dag_test.go │ ├── edge.go │ ├── edge_test.go │ ├── graph.go │ ├── graph_test.go │ ├── set.go │ ├── set_test.go │ ├── tarjan.go │ └── tarjan_test.go └── hcp │ ├── api │ ├── client.go │ ├── client_test.go │ ├── deprecated_client.go │ ├── deprecated_service.go │ ├── errors.go │ ├── errors_test.go │ ├── mock_service.go │ ├── service_bucket.go │ ├── service_build.go │ ├── service_channel.go │ └── service_version.go │ ├── env │ ├── env.go │ ├── env_test.go │ └── variables.go │ └── registry │ ├── artifact.go │ ├── deprecated_ds_config.go │ ├── ds_config.go │ ├── errors.go │ ├── hcl.go │ ├── hcl_test.go │ ├── hcp.go │ ├── json.go │ ├── metadata │ ├── cicd.go │ ├── os.go │ ├── os_test.go │ └── vcs.go │ ├── null_registry.go │ ├── registry.go │ ├── types.bucket.go │ ├── types.bucket_service_test.go │ ├── types.bucket_test.go │ ├── types.builds.go │ ├── types.metadata_store.go │ ├── types.version.go │ └── types.version_test.go ├── log.go ├── main.go ├── main_test.go ├── packer ├── build.go ├── build_test.go ├── builder_test.go ├── client_test.go ├── cmd_builder.go ├── cmd_builder_test.go ├── cmd_datasource.go ├── cmd_datasource_test.go ├── cmd_hook.go ├── cmd_hook_test.go ├── cmd_post_processor.go ├── cmd_post_processor_test.go ├── cmd_provisioner.go ├── cmd_provisioner_test.go ├── core.go ├── core_test.go ├── fixconfigmode_enumer.go ├── maps.go ├── packer_test.go ├── plugin-getter │ ├── checksum.go │ ├── docs.go │ ├── github │ │ ├── docs.go │ │ └── getter.go │ ├── plugins.go │ ├── plugins_test.go │ └── testdata │ │ ├── plugins │ │ └── github.com │ │ │ └── hashicorp │ │ │ ├── amazon │ │ │ ├── packer-plugin-amazon_v1.2.3_x5.0_darwin_amd64 │ │ │ ├── packer-plugin-amazon_v1.2.3_x5.0_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-amazon_v1.2.3_x5.0_windows_amd64.exe │ │ │ ├── packer-plugin-amazon_v1.2.3_x5.0_windows_amd64.exe_SHA256SUM │ │ │ ├── packer-plugin-amazon_v1.2.3_x5.1_darwin_amd64 │ │ │ ├── packer-plugin-amazon_v1.2.3_x5.1_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-amazon_v1.2.4_x5.0_darwin_amd64 │ │ │ ├── packer-plugin-amazon_v1.2.4_x5.0_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-amazon_v1.2.4_x5.0_windows_amd64.exe │ │ │ ├── packer-plugin-amazon_v1.2.4_x5.0_windows_amd64.exe_SHA256SUM │ │ │ ├── packer-plugin-amazon_v1.2.5_x5.0_darwin_amd64 │ │ │ ├── packer-plugin-amazon_v1.2.5_x5.0_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-amazon_v1.2.5_x5.0_windows_amd64.exe │ │ │ ├── packer-plugin-amazon_v1.2.5_x5.0_windows_amd64.exe_SHA256SUM │ │ │ ├── packer-plugin-amazon_v2.0.0_x6.0_darwin_amd64 │ │ │ └── packer-plugin-amazon_v2.0.0_x6.0_darwin_amd64_SHA256SUM │ │ │ └── google │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_darwin_amd64 │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe_SHA256SUM │ │ │ ├── packer-plugin-google_v4.5.7_x5.0_darwin_amd64 │ │ │ ├── packer-plugin-google_v4.5.7_x5.0_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-google_v4.5.7_x5.0_windows_amd64.exe │ │ │ ├── packer-plugin-google_v4.5.7_x5.0_windows_amd64.exe_SHA256SUM │ │ │ ├── packer-plugin-google_v4.5.8_x5.0_darwin_amd64 │ │ │ ├── packer-plugin-google_v4.5.8_x5.0_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-google_v4.5.8_x5.0_windows_amd64.exe │ │ │ └── packer-plugin-google_v4.5.8_x5.0_windows_amd64.exe_SHA256SUM │ │ ├── plugins_2 │ │ └── github.com │ │ │ ├── hashicorp copy │ │ │ ├── amazon │ │ │ │ ├── packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64 │ │ │ │ └── packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64_SHA256SUM │ │ │ └── google │ │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_darwin_amd64 │ │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_darwin_amd64_SHA256SUM │ │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe │ │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe_SHA256SUM │ │ │ │ ├── packer-plugin-google_v4.5.9_x5.0_darwin_amd64 │ │ │ │ ├── packer-plugin-google_v4.5.9_x5.0_darwin_amd64_SHA256SUM │ │ │ │ ├── packer-plugin-google_v4.5.9_x5.0_windows_amd64.exe │ │ │ │ └── packer-plugin-google_v4.5.9_x5.0_windows_amd64.exe_SHA256SUM │ │ │ └── hashicorp │ │ │ ├── amazon │ │ │ ├── packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64 │ │ │ └── packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64_SHA256SUM │ │ │ └── google │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_darwin_amd64 │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe │ │ │ ├── packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe_SHA256SUM │ │ │ ├── packer-plugin-google_v4.5.9_x5.0_darwin_amd64 │ │ │ ├── packer-plugin-google_v4.5.9_x5.0_darwin_amd64_SHA256SUM │ │ │ ├── packer-plugin-google_v4.5.9_x5.0_windows_amd64.exe │ │ │ └── packer-plugin-google_v4.5.9_x5.0_windows_amd64.exe_SHA256SUM │ │ ├── plugins_3 │ │ └── github.com │ │ │ └── hashicorp │ │ │ ├── alazon │ │ │ ├── packer-plugin-alazon_v1.2.5_x5.0_linux_amd64 │ │ │ └── packer-plugin-alazon_v1.2.5_x5.0_linux_amd64_SHA256SUM │ │ │ └── amazon │ │ │ ├── packer-plugin-amazon_v1.2.5_x5.0_linux_amd64 │ │ │ └── packer-plugin-amazon_v1.2.5_x5.0_linux_amd64_SHA256SUM │ │ └── wrong_checksums │ │ └── github.com │ │ └── hashicorp │ │ └── amazon │ │ ├── packer-plugin-amazon_v1.2.3_x5.0_darwin_amd64 │ │ ├── packer-plugin-amazon_v1.2.3_x5.0_darwin_amd64_SHA256SUM │ │ └── packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64 ├── plugin.go ├── plugin_client.go ├── plugin_discover_test.go ├── plugin_folders.go ├── plugin_test.go ├── post_processor_mock.go ├── post_processor_mock.hcl2spec.go ├── progressbar.go ├── progressbar_solaris.go ├── progressbar_test.go ├── provisioner.go ├── provisioner_test.go ├── provisioner_timeout.go ├── run_interfaces.go ├── telemetry.go ├── telemetry_test.go ├── test-fixtures │ ├── build-basic-interpolated-required.json │ ├── build-basic-interpolated.json │ ├── build-basic.json │ ├── build-env.json │ ├── build-ignore-template-variable.json │ ├── build-interpolated-name.json │ ├── build-names-basic.json │ ├── build-names-func.json │ ├── build-pp.json │ ├── build-prov-override.json │ ├── build-prov-retry.json │ ├── build-prov-skip-include.json │ ├── build-prov-skip.json │ ├── build-prov.json │ ├── build-split-func.json │ ├── build-template-path.json │ ├── build-var-build-name.json │ ├── build-var-build-type.json │ ├── build-var-file-interpolate.json │ ├── build-var-file-interpolate2.json │ ├── build-var-packer-version.json │ ├── build-variables-interpolate.json │ ├── build-variables-interpolate2.json │ ├── complex-recursed-env-user-var-file.json │ ├── push-vars.json │ ├── sensitive-variables.json │ ├── validate-dup-builder.json │ ├── validate-min-version-high.json │ ├── validate-min-version.json │ └── validate-req-variable.json ├── testing.go ├── ui.go └── ui_test.go ├── packer_test ├── common │ ├── base.go │ ├── check │ │ ├── file_gadgets.go │ │ ├── gadgets.go │ │ └── pipe_checker.go │ ├── commands.go │ ├── fs.go │ ├── plugin.go │ ├── plugin_tester │ │ ├── LICENSE │ │ ├── README.md │ │ ├── builder │ │ │ └── dynamic │ │ │ │ ├── artifact.go │ │ │ │ ├── builder.go │ │ │ │ ├── builder.hcl2spec.go │ │ │ │ ├── builder_acc_test.go │ │ │ │ ├── step_say_config.go │ │ │ │ └── test-fixtures │ │ │ │ └── template.pkr.hcl │ │ ├── datasource │ │ │ ├── dynamic │ │ │ │ ├── data.go │ │ │ │ ├── data.hcl2spec.go │ │ │ │ ├── data_acc_test.go │ │ │ │ └── test-fixtures │ │ │ │ │ └── template.pkr.hcl │ │ │ ├── parrot │ │ │ │ ├── data.go │ │ │ │ └── data.hcl2spec.go │ │ │ └── sleeper │ │ │ │ ├── data.go │ │ │ │ └── data.hcl2spec.go │ │ ├── docs │ │ │ ├── README.md │ │ │ ├── builders │ │ │ │ └── builder-name.mdx │ │ │ ├── datasources │ │ │ │ └── datasource-name.mdx │ │ │ ├── post-processors │ │ │ │ └── postprocessor-name.mdx │ │ │ └── provisioners │ │ │ │ └── provisioner-name.mdx │ │ ├── example │ │ │ ├── README.md │ │ │ ├── build.pkr.hcl │ │ │ ├── data.pkr.hcl │ │ │ └── variables.pkr.hcl │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ ├── post-processor │ │ │ └── dynamic │ │ │ │ ├── post-processor.go │ │ │ │ ├── post-processor.hcl2spec.go │ │ │ │ ├── post-processor_acc_test.go │ │ │ │ └── test-fixtures │ │ │ │ └── template.pkr.hcl │ │ ├── provisioner │ │ │ └── dynamic │ │ │ │ ├── provisioner.go │ │ │ │ ├── provisioner.hcl2spec.go │ │ │ │ ├── provisioner_acc_test.go │ │ │ │ └── test-fixtures │ │ │ │ └── template.pkr.hcl │ │ └── version │ │ │ └── version.go │ └── suite.go ├── core_tests │ ├── local_eval_test.go │ ├── suite_test.go │ └── templates │ │ ├── locals_duplicate.pkr.hcl │ │ └── locals_no_order.pkr.hcl ├── dag_tests │ ├── mix_data_locals_test.go │ ├── suite_test.go │ └── templates │ │ └── mixed_data_local.pkr.hcl ├── plugin_tests │ ├── gob_pb_test.go │ ├── gob_test_suite.go │ ├── init_test.go │ ├── install_test.go │ ├── loading_test.go │ ├── plugins_remove_test.go │ ├── sample_config.json │ ├── suite_test.go │ └── templates │ │ ├── init │ │ ├── hashicups.pkr.hcl │ │ ├── mixed_versions.pkr.hcl │ │ └── non_gh.pkr.hcl │ │ ├── internal_only.pkr.hcl │ │ ├── pin_1.0.9.pkr.hcl │ │ ├── pre-release_constraint.pkr.hcl │ │ ├── simple.json │ │ ├── simple.pkr.hcl │ │ ├── test_both_plugins.pkr.hcl │ │ ├── test_one_pinned_plugin.pkr.hcl │ │ └── test_one_plugin.pkr.hcl └── provisioner_tests │ ├── hcp-sbom │ ├── provisioner_test.go │ ├── suite_test.go │ └── templates │ │ ├── dest_is_dir.pkr.hcl │ │ ├── dest_is_dir_with_trailing_slash.pkr.hcl │ │ ├── dest_is_file_no_interm_dirs.pkr.hcl │ │ ├── dest_is_file_with_interm_dirs.pkr.hcl │ │ ├── source_is_dir.pkr.hcl │ │ └── source_not_existing.pkr.hcl │ └── shell │ ├── provisioner_test.go │ ├── suite_test.go │ └── templates │ ├── empty_inline_list.pkr.hcl │ ├── no_shebang_in_script.pkr.hcl │ ├── no_shebang_inline_but_as_option.pkr.hcl │ ├── shebang_as_option.pkr.hcl │ ├── shebang_as_option_invalid.pkr.hcl │ └── shebang_in_inline.pkr.hcl ├── panic.go ├── post-processor ├── artifice │ ├── artifact.go │ ├── post-processor.go │ ├── post-processor.hcl2spec.go │ └── version │ │ └── version.go ├── checksum │ ├── LICENSE │ ├── artifact.go │ ├── post-processor.go │ ├── post-processor.hcl2spec.go │ ├── post-processor_test.go │ └── version │ │ └── version.go ├── compress │ ├── LICENSE │ ├── artifact.go │ ├── artifact_test.go │ ├── benchmark.go │ ├── notes.txt │ ├── post-processor.go │ ├── post-processor.hcl2spec.go │ ├── post-processor_test.go │ ├── tar_fix.go │ ├── tar_fix_go110.go │ └── version │ │ └── version.go ├── manifest │ ├── artifact.go │ ├── post-processor.go │ ├── post-processor.hcl2spec.go │ └── version │ │ └── version.go └── shell-local │ ├── post-processor.go │ ├── post-processor_test.go │ └── version │ └── version.go ├── provisioner ├── breakpoint │ ├── provisioner.go │ ├── provisioner.hcl2spec.go │ └── version │ │ └── version.go ├── file │ ├── provisioner.go │ ├── provisioner.hcl2spec.go │ ├── provisioner_test.go │ └── version │ │ └── version.go ├── hcp-sbom │ ├── provisioner.go │ ├── provisioner.hcl2spec.go │ ├── provisioner_test.go │ ├── validate.go │ └── version │ │ └── version.go ├── powershell │ ├── execution_policy.go │ ├── execution_policy_test.go │ ├── executionpolicy_enumer.go │ ├── provisioner.go │ ├── provisioner.hcl2spec.go │ ├── provisioner_acc_test.go │ ├── provisioner_test.go │ ├── test-fixtures │ │ ├── powershell-exit_codes-provisioner.txt │ │ ├── powershell-inline-provisioner.txt │ │ ├── powershell-provisioner-cleanup.txt │ │ ├── powershell-script-provisioner.txt │ │ └── scripts │ │ │ ├── bootstrap_win.txt │ │ │ ├── sample_script.ps1 │ │ │ └── set_version_latest.ps1 │ └── version │ │ └── version.go ├── shell-local │ ├── provisioner.go │ ├── provisioner_acc_test.go │ ├── provisioner_test.go │ ├── test-fixtures │ │ ├── script.sh │ │ └── shell-local-provisioner.txt │ └── version │ │ └── version.go ├── shell │ ├── provisioner.go │ ├── provisioner.hcl2spec.go │ ├── provisioner_acc_test.go │ ├── provisioner_test.go │ ├── test-fixtures │ │ └── shell-provisioner.txt │ ├── unix_reader.go │ ├── unix_reader_test.go │ └── version │ │ └── version.go ├── sleep │ ├── provisioner.go │ ├── provisioner.hcl2spec.go │ ├── provisioner_test.go │ └── version │ │ └── version.go ├── windows-restart │ ├── provisioner.go │ ├── provisioner.hcl2spec.go │ ├── provisioner_test.go │ └── version │ │ └── version.go └── windows-shell │ ├── provisioner.go │ ├── provisioner.hcl2spec.go │ ├── provisioner_test.go │ └── version │ └── version.go ├── scripts ├── build.ps1 ├── build.sh ├── codesign_example.sh ├── dist.sh ├── generate-plugins.go ├── off_gopath.sh ├── prepare_changelog.sh ├── sign.sh ├── sort-md-list.py ├── vagrant-freebsd-priv-config.sh ├── vagrant-freebsd-unpriv-bootstrap.sh ├── vagrant-linux-priv-config.sh ├── vagrant-linux-priv-go.sh └── vagrant-linux-unpriv-bootstrap.sh ├── tty.go ├── tty_solaris.go ├── version ├── VERSION └── version.go └── website ├── .editorconfig ├── .env ├── .env.production ├── .eslintrc.js ├── .gitignore ├── .husky └── pre-commit ├── .nvmrc ├── .stylelintrc.js ├── Dockerfile ├── LICENSE.md ├── Makefile ├── README.md ├── content ├── community-plugins.mdx ├── docs │ ├── builders │ │ ├── community-supported.mdx │ │ ├── file.mdx │ │ ├── index.mdx │ │ └── null.mdx │ ├── commands │ │ ├── build.mdx │ │ ├── console.mdx │ │ ├── fix.mdx │ │ ├── fmt.mdx │ │ ├── hcl2_upgrade.mdx │ │ ├── index.mdx │ │ ├── init.mdx │ │ ├── inspect.mdx │ │ ├── plugins │ │ │ ├── index.mdx │ │ │ ├── install.mdx │ │ │ ├── installed.mdx │ │ │ ├── remove.mdx │ │ │ └── required.mdx │ │ └── validate.mdx │ ├── communicators │ │ ├── index.mdx │ │ ├── ssh.mdx │ │ └── winrm.mdx │ ├── community-tools.mdx │ ├── configure.mdx │ ├── datasources │ │ ├── hcp │ │ │ ├── hcp-packer-artifact.mdx │ │ │ ├── hcp-packer-image.mdx │ │ │ ├── hcp-packer-iteration.mdx │ │ │ ├── hcp-packer-version.mdx │ │ │ └── index.mdx │ │ ├── http.mdx │ │ └── index.mdx │ ├── debugging.mdx │ ├── hcp │ │ └── index.mdx │ ├── index.mdx │ ├── intro │ │ ├── index.mdx │ │ ├── use-cases.mdx │ │ └── why.mdx │ ├── partnerships.mdx │ ├── plugins │ │ ├── creation │ │ │ ├── custom-builders.mdx │ │ │ ├── custom-datasources.mdx │ │ │ ├── custom-post-processors.mdx │ │ │ ├── custom-provisioners.mdx │ │ │ ├── hcp-support.mdx │ │ │ ├── index.mdx │ │ │ └── plugin-load-spec.mdx │ │ ├── index.mdx │ │ └── install.mdx │ ├── post-processors │ │ ├── artifice.mdx │ │ ├── checksum.mdx │ │ ├── community-supported.mdx │ │ ├── compress.mdx │ │ ├── index.mdx │ │ ├── manifest.mdx │ │ └── shell-local.mdx │ ├── provisioners │ │ ├── breakpoint.mdx │ │ ├── community-supported.mdx │ │ ├── file.mdx │ │ ├── hcp-sbom.mdx │ │ ├── index.mdx │ │ ├── powershell.mdx │ │ ├── shell-local.mdx │ │ ├── shell.mdx │ │ ├── windows-restart.mdx │ │ └── windows-shell.mdx │ ├── release-notes │ │ ├── v1_11.mdx │ │ ├── v1_12.mdx │ │ └── v1_13.mdx │ ├── templates │ │ ├── hcl_templates │ │ │ ├── blocks │ │ │ │ ├── build │ │ │ │ │ ├── hcp_packer_registry.mdx │ │ │ │ │ ├── index.mdx │ │ │ │ │ ├── post-processor.mdx │ │ │ │ │ ├── post-processors.mdx │ │ │ │ │ ├── provisioner.mdx │ │ │ │ │ └── source.mdx │ │ │ │ ├── data.mdx │ │ │ │ ├── index.mdx │ │ │ │ ├── locals.mdx │ │ │ │ ├── packer.mdx │ │ │ │ ├── source.mdx │ │ │ │ └── variable.mdx │ │ │ ├── contextual-variables.mdx │ │ │ ├── datasources.mdx │ │ │ ├── expressions.mdx │ │ │ ├── functions │ │ │ │ ├── collection │ │ │ │ │ ├── alltrue.mdx │ │ │ │ │ ├── anytrue.mdx │ │ │ │ │ ├── chunklist.mdx │ │ │ │ │ ├── coalesce.mdx │ │ │ │ │ ├── coalescelist.mdx │ │ │ │ │ ├── compact.mdx │ │ │ │ │ ├── concat.mdx │ │ │ │ │ ├── contains.mdx │ │ │ │ │ ├── distinct.mdx │ │ │ │ │ ├── element.mdx │ │ │ │ │ ├── flatten.mdx │ │ │ │ │ ├── index-fn.mdx │ │ │ │ │ ├── keys.mdx │ │ │ │ │ ├── length.mdx │ │ │ │ │ ├── lookup.mdx │ │ │ │ │ ├── merge.mdx │ │ │ │ │ ├── range.mdx │ │ │ │ │ ├── reverse.mdx │ │ │ │ │ ├── setintersection.mdx │ │ │ │ │ ├── setproduct.mdx │ │ │ │ │ ├── setunion.mdx │ │ │ │ │ ├── slice.mdx │ │ │ │ │ ├── sort.mdx │ │ │ │ │ ├── values.mdx │ │ │ │ │ └── zipmap.mdx │ │ │ │ ├── contextual │ │ │ │ │ ├── aws_secretsmanager.mdx │ │ │ │ │ ├── consul.mdx │ │ │ │ │ ├── env.mdx │ │ │ │ │ └── vault.mdx │ │ │ │ ├── conversion │ │ │ │ │ ├── can.mdx │ │ │ │ │ ├── convert.mdx │ │ │ │ │ └── try.mdx │ │ │ │ ├── crypto │ │ │ │ │ ├── bcrypt.mdx │ │ │ │ │ ├── md5.mdx │ │ │ │ │ ├── rsadecrypt.mdx │ │ │ │ │ ├── sha1.mdx │ │ │ │ │ ├── sha256.mdx │ │ │ │ │ └── sha512.mdx │ │ │ │ ├── datetime │ │ │ │ │ ├── formatdate.mdx │ │ │ │ │ ├── legacy_isotime.mdx │ │ │ │ │ ├── legacy_strftime.mdx │ │ │ │ │ ├── timeadd.mdx │ │ │ │ │ └── timestamp.mdx │ │ │ │ ├── encoding │ │ │ │ │ ├── base64decode.mdx │ │ │ │ │ ├── base64encode.mdx │ │ │ │ │ ├── base64gzip.mdx │ │ │ │ │ ├── csvdecode.mdx │ │ │ │ │ ├── jsondecode.mdx │ │ │ │ │ ├── jsonencode.mdx │ │ │ │ │ ├── textdecodebase64.mdx │ │ │ │ │ ├── textencodebase64.mdx │ │ │ │ │ ├── urlencode.mdx │ │ │ │ │ ├── yamldecode.mdx │ │ │ │ │ └── yamlencode.mdx │ │ │ │ ├── file │ │ │ │ │ ├── abspath.mdx │ │ │ │ │ ├── basename.mdx │ │ │ │ │ ├── dirname.mdx │ │ │ │ │ ├── file.mdx │ │ │ │ │ ├── filebase64.mdx │ │ │ │ │ ├── fileexists.mdx │ │ │ │ │ ├── fileset.mdx │ │ │ │ │ ├── pathexpand.mdx │ │ │ │ │ └── templatefile.mdx │ │ │ │ ├── index.mdx │ │ │ │ ├── ipnet │ │ │ │ │ ├── cidrhost.mdx │ │ │ │ │ ├── cidrnetmask.mdx │ │ │ │ │ ├── cidrsubnet.mdx │ │ │ │ │ └── cidrsubnets.mdx │ │ │ │ ├── numeric │ │ │ │ │ ├── abs.mdx │ │ │ │ │ ├── ceil.mdx │ │ │ │ │ ├── floor.mdx │ │ │ │ │ ├── log.mdx │ │ │ │ │ ├── max.mdx │ │ │ │ │ ├── min.mdx │ │ │ │ │ ├── parseint.mdx │ │ │ │ │ ├── pow.mdx │ │ │ │ │ ├── signum.mdx │ │ │ │ │ └── sum.mdx │ │ │ │ ├── string │ │ │ │ │ ├── chomp.mdx │ │ │ │ │ ├── endswith.mdx │ │ │ │ │ ├── format.mdx │ │ │ │ │ ├── formatlist.mdx │ │ │ │ │ ├── indent.mdx │ │ │ │ │ ├── join.mdx │ │ │ │ │ ├── lower.mdx │ │ │ │ │ ├── regex.mdx │ │ │ │ │ ├── regex_replace.mdx │ │ │ │ │ ├── regexall.mdx │ │ │ │ │ ├── replace.mdx │ │ │ │ │ ├── split.mdx │ │ │ │ │ ├── startswith.mdx │ │ │ │ │ ├── strcontains.mdx │ │ │ │ │ ├── strrev.mdx │ │ │ │ │ ├── substr.mdx │ │ │ │ │ ├── title.mdx │ │ │ │ │ ├── trim.mdx │ │ │ │ │ ├── trimprefix.mdx │ │ │ │ │ ├── trimspace.mdx │ │ │ │ │ ├── trimsuffix.mdx │ │ │ │ │ └── upper.mdx │ │ │ │ └── uuid │ │ │ │ │ ├── uuidv4.mdx │ │ │ │ │ └── uuidv5.mdx │ │ │ ├── index.mdx │ │ │ ├── locals.mdx │ │ │ ├── onlyexcept.mdx │ │ │ ├── path-variables.mdx │ │ │ ├── syntax-json.mdx │ │ │ ├── syntax.mdx │ │ │ └── variables.mdx │ │ ├── index.mdx │ │ ├── json_to_hcl.mdx │ │ └── legacy_json_templates │ │ │ ├── builders.mdx │ │ │ ├── communicator.mdx │ │ │ ├── engine.mdx │ │ │ ├── index.mdx │ │ │ ├── post-processors.mdx │ │ │ ├── provisioners.mdx │ │ │ └── user-variables.mdx │ ├── terminology.mdx │ └── upgrade │ │ ├── v1_11.mdx │ │ ├── v1_12.mdx │ │ └── v1_13.mdx ├── guides │ ├── 1.7-plugin-upgrade.mdx │ ├── 1.7-template-upgrade.mdx │ ├── automatic-operating-system-installs │ │ ├── autounattend_windows.mdx │ │ ├── index.mdx │ │ └── preseed_ubuntu.mdx │ ├── hcl │ │ ├── component-object-spec.mdx │ │ ├── index.mdx │ │ └── variables.mdx │ ├── index.mdx │ └── packer-on-cicd │ │ ├── build-image-in-cicd.mdx │ │ ├── build-virtualbox-image.mdx │ │ ├── index.mdx │ │ ├── pipelineing-builds.mdx │ │ ├── trigger-tfe.mdx │ │ └── upload-images-to-artifact.mdx ├── partials │ ├── commands │ │ ├── except.mdx │ │ └── only.mdx │ ├── datasource │ │ ├── hcp-packer-artifact │ │ │ ├── Config-not-required.mdx │ │ │ ├── Config-required.mdx │ │ │ └── DatasourceOutput.mdx │ │ ├── hcp-packer-image │ │ │ ├── Config-not-required.mdx │ │ │ ├── Config-required.mdx │ │ │ └── DatasourceOutput.mdx │ │ ├── hcp-packer-iteration │ │ │ ├── Config-required.mdx │ │ │ └── DatasourceOutput.mdx │ │ ├── hcp-packer-version │ │ │ ├── Config-required.mdx │ │ │ └── DatasourceOutput.mdx │ │ ├── http │ │ │ ├── Config-not-required.mdx │ │ │ ├── Config-required.mdx │ │ │ └── DatasourceOutput.mdx │ │ └── null │ │ │ ├── Config-required.mdx │ │ │ ├── Config.mdx │ │ │ └── DatasourceOutput.mdx │ ├── datasources │ │ └── local-dependency-limitation.mdx │ ├── from-1.5 │ │ ├── beta-hcl2-note.mdx │ │ ├── builds │ │ │ └── example-block.mdx │ │ ├── contextual-source-variables.mdx │ │ ├── datasources │ │ │ └── example-block.mdx │ │ ├── legacy-json-warning.mdx │ │ ├── locals │ │ │ └── example-block.mdx │ │ ├── sources │ │ │ └── example-block.mdx │ │ └── variables │ │ │ ├── assignment.mdx │ │ │ ├── custom-validation.mdx │ │ │ ├── foo-block.mdx │ │ │ ├── foo-pkrvar.mdx │ │ │ ├── must-be-set.mdx │ │ │ └── sensitive.mdx │ ├── guides │ │ └── hcl2-beta-note.mdx │ ├── helper │ │ └── communicator │ │ │ ├── SSH-Agent-Auth-not-required.mdx │ │ │ ├── SSH-Key-Pair-Name-not-required.mdx │ │ │ ├── SSH-Private-Key-File-not-required.mdx │ │ │ └── SSH-Temporary-Key-Pair-not-required.mdx │ ├── packer-plugin-sdk │ │ ├── bootcommand │ │ │ ├── BootConfig-not-required.mdx │ │ │ ├── BootConfig.mdx │ │ │ ├── VNCConfig-not-required.mdx │ │ │ └── VNCConfig.mdx │ │ ├── communicator │ │ │ ├── Config-not-required.mdx │ │ │ ├── Config.mdx │ │ │ ├── SSH-Agent-Auth-not-required.mdx │ │ │ ├── SSH-Key-Pair-Name-not-required.mdx │ │ │ ├── SSH-Private-Key-File-not-required.mdx │ │ │ ├── SSH-Temporary-Key-Pair-not-required.mdx │ │ │ ├── SSH-not-required.mdx │ │ │ ├── SSH.mdx │ │ │ ├── SSHInterface-not-required.mdx │ │ │ ├── SSHInterface.mdx │ │ │ ├── SSHTemporaryKeyPair-not-required.mdx │ │ │ ├── SSHTemporaryKeyPair.mdx │ │ │ ├── WinRM-not-required.mdx │ │ │ └── WinRM.mdx │ │ ├── multistep │ │ │ └── commonsteps │ │ │ │ ├── CDConfig-not-required.mdx │ │ │ │ ├── CDConfig.mdx │ │ │ │ ├── FloppyConfig-not-required.mdx │ │ │ │ ├── FloppyConfig.mdx │ │ │ │ ├── HTTPConfig-not-required.mdx │ │ │ │ ├── HTTPConfig.mdx │ │ │ │ ├── ISOConfig-not-required.mdx │ │ │ │ ├── ISOConfig-required.mdx │ │ │ │ └── ISOConfig.mdx │ │ ├── provisioners │ │ │ ├── common-config.mdx │ │ │ ├── shell-config.mdx │ │ │ └── unmaintained-plugin.mdx │ │ └── shutdowncommand │ │ │ ├── ShutdownConfig-not-required.mdx │ │ │ └── ShutdownConfig.mdx │ ├── path │ │ └── separator-note.mdx │ ├── plugins │ │ ├── plugin-location.mdx │ │ └── plugin-tiers-and-namespaces.mdx │ ├── post-processor │ │ └── manifest │ │ │ └── Config-not-required.mdx │ ├── post-processors │ │ └── community_post-processors.mdx │ ├── provisioner │ │ ├── file │ │ │ ├── Config-not-required.mdx │ │ │ └── Config-required.mdx │ │ └── hcp-sbom │ │ │ ├── Config-not-required.mdx │ │ │ └── Config-required.mdx │ └── provisioners │ │ ├── common-config.mdx │ │ ├── shell-config.mdx │ │ └── unmaintained-plugin.mdx ├── plugins │ └── index.mdx └── security.mdx ├── data ├── docs-nav-data.json ├── guides-nav-data.json ├── plugins-manifest.json └── plugins-nav-data.json ├── package-lock.json ├── package.json ├── prettier.config.js ├── public ├── favicon.ico ├── files │ └── press-kit.zip ├── ie-warning.js ├── img │ ├── branded-cta │ │ └── cta-right.svg │ ├── docs │ │ ├── atlas-workflow.png │ │ ├── packer-ecosystem-diagram.png │ │ └── packer-integration-steps-diagram.png │ ├── favicons │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── mstile-150x150.png │ │ └── safari-pinned-tab.svg │ ├── guides │ │ ├── teamcity_build_configuration.png │ │ ├── teamcity_build_log.png │ │ ├── teamcity_build_log_complete.png │ │ ├── teamcity_create_project_from_url-1.png │ │ └── teamcity_create_project_from_url-2.png │ ├── hcp-callout.svg │ ├── homepage-hero │ │ └── hero-right.svg │ ├── integrations-text-split │ │ └── integrations.png │ ├── integrations │ │ ├── aws.svg │ │ ├── azure.svg │ │ ├── digitalocean.svg │ │ ├── docker.svg │ │ ├── google-cloud.svg │ │ └── vmware.svg │ ├── logo-hashicorp.svg │ ├── logo-packer-padded.svg │ ├── logo-text.svg │ ├── og-image.png │ ├── packer-signed-urls.png │ └── product-features-list │ │ ├── continuous-delivery.svg │ │ ├── demo-creation.svg │ │ ├── deployment.svg │ │ ├── portability.svg │ │ ├── prod-parity.svg │ │ └── stability.svg └── robots.txt ├── redirects.js ├── scripts ├── should-build.sh ├── tsconfig.json ├── website-build.sh └── website-start.sh └── vercel.json /.copywrite.hcl: -------------------------------------------------------------------------------- 1 | project { 2 | license = "BUSL-1.1" 3 | copyright_year = 2024 4 | header_ignore = [ 5 | "*.hcl2spec.go", # generated code specs, since they'll be wiped out until we support adding the headers at generation-time 6 | "hcl2template/testdata/**", 7 | "test/**", 8 | "**/test-fixtures/**", 9 | "examples/**", 10 | "hcl2template/fixtures/**", 11 | "command/plugin.go", 12 | "website/**" # candidates for copyright are coming from external sources, so we should not handle those in Packer 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.go text eol=lf 3 | *.sh text eol=lf 4 | *.json text eol=lf 5 | *.md text eol=lf 6 | *.mdx text eol=lf 7 | *.ps1 text eol=lf 8 | *.hcl text eol=lf 9 | *.tmpl text eol=lf 10 | *.txt text eol=lf 11 | go.mod text eol=lf 12 | go.sum text eol=lf 13 | common/test-fixtures/root/* eol=lf 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: BUSL-1.1 3 | 4 | blank_issues_enabled: false 5 | contact_links: 6 | - name: Packer Community Support 7 | url: https://discuss.hashicorp.com/c/packer/23 8 | about: If you have a question, or are looking for advice, please post on our Discuss forum! The community loves to chime in to help. Happy Coding! 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: If you have a question, please check out our other community resources instead of opening an issue. 4 | labels: question 5 | --- 6 | 7 | Issues on GitHub are intended to be related to bugs or feature requests, so we 8 | recommend using our other community resources instead of asking here if you 9 | have a question. 10 | 11 | - Packer Guides: https://www.packer.io/guides 12 | - Discussion List: https://groups.google.com/group/packer-tool 13 | - Any other questions can be sent to the packer section of the HashiCorp 14 | forum: https://discuss.hashicorp.com/c/packer 15 | - Packer community links: https://www.packer.io/community 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gomod 4 | directory: / 5 | schedule: 6 | interval: daily 7 | allow: 8 | - dependency-name: "github.com/hashicorp/packer-plugin-sdk" 9 | - dependency-name: "github.com/hashicorp/hcp-sdk-go" 10 | -------------------------------------------------------------------------------- /.github/labeler-issue-triage.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: BUSL-1.1 3 | 4 | bug: 5 | - 'panic:' 6 | crash: 7 | - 'panic:' 8 | 9 | -------------------------------------------------------------------------------- /.github/workflows/create-release-branch.yml: -------------------------------------------------------------------------------- 1 | name: Create a release branch 2 | on: [workflow_dispatch] 3 | jobs: 4 | create-branch: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 8 | - uses: hashicorp/actions-create-release-branch@v1 9 | with: 10 | token: ${{ secrets.ELEVATED_GITHUB_TOKEN }} 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | /local 3 | /pkg 4 | /src 5 | /website/.sass-cache 6 | /website/build 7 | /website/tmp 8 | .DS_Store 9 | .vagrant 10 | .idea 11 | test/.env 12 | *~ 13 | *.received.* 14 | *.swp 15 | 16 | vendor/ 17 | 18 | website/.bundle 19 | website/vendor 20 | 21 | packer-test*.log 22 | 23 | *.received.txt 24 | *.received.json 25 | 26 | .idea/ 27 | *.iml 28 | Thumbs.db 29 | /packer.exe 30 | .project 31 | cache 32 | /.vscode/ 33 | -------------------------------------------------------------------------------- /.go-version: -------------------------------------------------------------------------------- 1 | 1.23.2 2 | -------------------------------------------------------------------------------- /.release/release-metadata.hcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: BUSL-1.1 3 | 4 | url_docker_registry_dockerhub = "https://hub.docker.com/r/hashicorp/packer" 5 | url_docker_registry_ecr = "https://gallery.ecr.aws/hashicorp/packer" 6 | url_license = "https://github.com/hashicorp/packer/blob/main/LICENSE" 7 | url_project_website = "https://www.packer.io/" 8 | url_source_repository = "https://github.com/hashicorp/packer" 9 | -------------------------------------------------------------------------------- /acctest/plugin/test-fixtures/basic-amazon-ebs.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | amazon = { 4 | version = "~> 1" 5 | source = "github.com/hashicorp/amazon" 6 | } 7 | } 8 | } 9 | 10 | source "amazon-ebs" "basic-test" { 11 | region = "us-east-1" 12 | instance_type = "m3.medium" 13 | source_ami = "ami-76b2a71e" 14 | ssh_username = "ubuntu" 15 | ami_name = "packer-plugin-amazon-ebs-test" 16 | skip_create_ami = true 17 | } 18 | 19 | build { 20 | sources = ["source.amazon-ebs.basic-test"] 21 | } 22 | -------------------------------------------------------------------------------- /background_check.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | //go:build !openbsd 5 | // +build !openbsd 6 | 7 | package main 8 | 9 | import ( 10 | "fmt" 11 | 12 | "github.com/shirou/gopsutil/v3/process" 13 | ) 14 | 15 | func checkProcess(currentPID int) (bool, error) { 16 | myProc, err := process.NewProcess(int32(currentPID)) 17 | if err != nil { 18 | return false, fmt.Errorf("Process check error: %s", err) 19 | } 20 | bg, err := myProc.Background() 21 | if err != nil { 22 | return bg, fmt.Errorf("Process background check error: %s", err) 23 | } 24 | 25 | return bg, nil 26 | } 27 | -------------------------------------------------------------------------------- /background_check_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package main 5 | 6 | import ( 7 | "fmt" 8 | ) 9 | 10 | func checkProcess(currentPID int) (bool, error) { 11 | return false, fmt.Errorf("cannot determine if process is backgrounded in " + 12 | "openbsd") 13 | } 14 | -------------------------------------------------------------------------------- /builder/file/artifact_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package file 5 | 6 | import ( 7 | "testing" 8 | 9 | packersdk "github.com/hashicorp/packer-plugin-sdk/packer" 10 | ) 11 | 12 | func TestNullArtifact(t *testing.T) { 13 | var _ packersdk.Artifact = new(FileArtifact) 14 | } 15 | -------------------------------------------------------------------------------- /builder/file/test-fixtures/artifact.txt: -------------------------------------------------------------------------------- 1 | Hello world. 2 | -------------------------------------------------------------------------------- /builder/file/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var FilePluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | FilePluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /builder/null/artifact_export_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package null 5 | 6 | import ( 7 | "testing" 8 | 9 | packersdk "github.com/hashicorp/packer-plugin-sdk/packer" 10 | ) 11 | 12 | func TestNullArtifact(t *testing.T) { 13 | var _ packersdk.Artifact = new(NullArtifact) 14 | } 15 | -------------------------------------------------------------------------------- /builder/null/builder_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package null 5 | 6 | import ( 7 | "testing" 8 | 9 | packersdk "github.com/hashicorp/packer-plugin-sdk/packer" 10 | ) 11 | 12 | func TestBuilder_implBuilder(t *testing.T) { 13 | var _ packersdk.Builder = new(Builder) 14 | } 15 | -------------------------------------------------------------------------------- /builder/null/ssh.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package null 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/multistep" 8 | ) 9 | 10 | func CommHost(host string) func(multistep.StateBag) (string, error) { 11 | return func(state multistep.StateBag) (string, error) { 12 | return host, nil 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /builder/null/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var NullPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | NullPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /builder/test-fixtures/floppies/bar.bat: -------------------------------------------------------------------------------- 1 | Echo I am a floppy with a batch file -------------------------------------------------------------------------------- /builder/test-fixtures/floppies/foo.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "I am a floppy with some Powershell" -------------------------------------------------------------------------------- /command/build_windows_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package command 5 | 6 | import "strings" 7 | 8 | func init() { 9 | spaghettiCarbonara = fixWindowsLineEndings(spaghettiCarbonara) 10 | lasagna = fixWindowsLineEndings(lasagna) 11 | tiramisu = fixWindowsLineEndings(tiramisu) 12 | one = fixWindowsLineEndings(one) 13 | two = fixWindowsLineEndings(two) 14 | } 15 | 16 | func fixWindowsLineEndings(s string) string { 17 | return strings.ReplaceAll(s, "\n", " \r\n") 18 | } 19 | -------------------------------------------------------------------------------- /command/flag-kv/flag_strings.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package kvflag 5 | 6 | import ( 7 | "strings" 8 | ) 9 | 10 | type StringSlice []string 11 | 12 | func (s *StringSlice) String() string { 13 | return strings.Join(*s, ", ") 14 | } 15 | 16 | func (s *StringSlice) Set(value string) error { 17 | *s = append(*s, value) 18 | return nil 19 | } 20 | -------------------------------------------------------------------------------- /command/flag-kv/test-fixtures/basic.json: -------------------------------------------------------------------------------- 1 | { 2 | "key": "value" 3 | } 4 | -------------------------------------------------------------------------------- /command/flag-slice/flag.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package sliceflag 5 | 6 | import "strings" 7 | 8 | // StringFlag implements the flag.Value interface and allows multiple 9 | // calls to the same variable to append a list. 10 | type StringFlag []string 11 | 12 | func (s *StringFlag) String() string { 13 | return strings.Join(*s, ",") 14 | } 15 | 16 | func (s *StringFlag) Set(value string) error { 17 | *s = append(*s, strings.Split(value, ",")...) 18 | return nil 19 | } 20 | -------------------------------------------------------------------------------- /command/test-fixtures/build-name-and-type/all.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "name": "test", 5 | "communicator": "none", 6 | "type": "null" 7 | }, 8 | { 9 | "name": "potato", 10 | "communicator": "none", 11 | "type": "null" 12 | } 13 | ], 14 | "post-processors": [ 15 | { 16 | "type": "manifest", 17 | "output": "manifest.json", 18 | "strip_time": true 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /command/test-fixtures/build-name-and-type/all.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | source "null" "potato" { 6 | communicator = "none" 7 | } 8 | 9 | build { 10 | sources = [ 11 | "sources.null.test", 12 | "sources.null.potato", 13 | ] 14 | 15 | provisioner "shell-local" { 16 | inline = [ 17 | "echo '' > ${source.type}.${source.name}.txt" 18 | ] 19 | } 20 | 21 | post-processor "manifest" { 22 | output = "manifest.json" 23 | strip_time = true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /command/test-fixtures/build-name-and-type/buildname.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "pizza" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | name = "pineapple" 7 | sources = [ 8 | "sources.null.pizza", 9 | ] 10 | 11 | provisioner "shell-local" { 12 | inline = [ 13 | "echo '' > ${build.name}.${source.name}.txt" 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /command/test-fixtures/build-variable-sharing/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "name": "chocolate", 5 | "type": "null", 6 | "communicator": "none" 7 | } 8 | ], 9 | "provisioners": [ 10 | { 11 | "type": "shell-local", 12 | "inline": [ 13 | "echo hi > provisioner.{{ build `ID`}}.txt" 14 | ] 15 | } 16 | ], 17 | "post-processors": [ 18 | { 19 | "type": "shell-local", 20 | "inline": [ 21 | "echo hi > post-processor.{{ build `ID`}}.txt" 22 | ] 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /command/test-fixtures/cleanup-script/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "null", 5 | "communicator": "none" 6 | } 7 | ], 8 | "provisioners": [ 9 | { 10 | "type": "shell-local", 11 | "inline": ["exit 2"] 12 | } 13 | ], 14 | "error-cleanup-provisioner": { 15 | "type": "shell-local", 16 | "inline": ["echo 'rubber ducky'> ducky.txt"] 17 | } 18 | } -------------------------------------------------------------------------------- /command/test-fixtures/fix-invalid/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "hello": "world" 3 | } 4 | -------------------------------------------------------------------------------- /command/test-fixtures/fix/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{"type": "dummy"}], 3 | 4 | "push": { 5 | "name": "foo/bar" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /command/test-fixtures/fmt/formatted.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | sources = ["source.null.example"] 7 | } 8 | -------------------------------------------------------------------------------- /command/test-fixtures/fmt/unformatted.auto.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | region ="us-west-2" 2 | -------------------------------------------------------------------------------- /command/test-fixtures/fmt/unformatted.pkr.hcl: -------------------------------------------------------------------------------- 1 | variable "region" { 2 | type =string 3 | } 4 | 5 | source "amazon-ebs" "example" { 6 | region = var.region 7 | } 8 | 9 | build { 10 | sources = ["source.amazon-ebs.example"] 11 | } 12 | -------------------------------------------------------------------------------- /command/test-fixtures/fmt/unformatted.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | ami_filter_name ="amzn2-ami-hvm-*-x86_64-gp2" 2 | ami_filter_owners =[ "137112412989" ] 3 | 4 | -------------------------------------------------------------------------------- /command/test-fixtures/fmt_errs/malformed.pkr.hcl: -------------------------------------------------------------------------------- 1 | variable "region" { 2 | type =string 3 | } 4 | 5 | invalid 6 | 7 | source "amazon-ebs" "example" { 8 | region = var.region 9 | } 10 | 11 | build { 12 | sources = ["source.amazon-ebs.example"] 13 | } 14 | 15 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl-inspect-with-sensitive-vars/expected-output.txt: -------------------------------------------------------------------------------- 1 | Packer Inspect: HCL2 mode 2 | 3 | > input-variables: 4 | 5 | var.not_sensitive: "I am soooo not sensitive" 6 | var.not_sensitive_unknown: "" 7 | var.sensitive: "" 8 | var.sensitive_array: "[\n \"\",\n \"\",\n]" 9 | var.sensitive_tags: "{\n \"first_key\" = \"\"\n \"second_key\" = \"\"\n}" 10 | var.sensitive_unknown: "" 11 | 12 | > local-variables: 13 | 14 | 15 | > builds: 16 | 17 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl-inspect-with-sensitive-vars/vars.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "not_sensitive" { 3 | default = "I am soooo not sensitive" 4 | } 5 | 6 | variable "not_sensitive_unknown" { 7 | } 8 | 9 | variable "sensitive" { 10 | default = "I am soooo sensitive" 11 | sensitive = true 12 | } 13 | 14 | variable "sensitive_array" { 15 | default = ["Im supersensitive", "me too !!!!"] 16 | sensitive = true 17 | } 18 | 19 | variable "sensitive_tags" { 20 | default = { 21 | first_key = "this-is-mega-sensitive" 22 | second_key = "this-is-also-sensitive" 23 | } 24 | sensitive = true 25 | } 26 | 27 | variable "sensitive_unknown" { 28 | sensitive = true 29 | } 30 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl-only-except/build.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "file" "chocolate" { 2 | content = "chocolate" 3 | target = "chocolate.txt" 4 | } 5 | 6 | source "file" "vanilla" { 7 | content = "vanilla" 8 | target = "vanilla.txt" 9 | } 10 | 11 | source "file" "cherry" { 12 | content = "cherry" 13 | target = "cherry.txt" 14 | } 15 | 16 | build { 17 | source "file.cherry" { 18 | 19 | } 20 | } 21 | 22 | build { 23 | name = "my_build" 24 | sources = [ 25 | "file.chocolate", 26 | "file.vanilla", 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/build-var-in-pp.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | name = "example" 7 | sources = ["source.null.example"] 8 | 9 | post-processor "shell-local" { 10 | inline = ["echo 2 > ${build.name}.2.txt"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/build_no_source.pkr.hcl: -------------------------------------------------------------------------------- 1 | build{} 2 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/datasource.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "mock" "content" { 2 | foo = "chocolate" 3 | } 4 | 5 | source "file" "chocolate" { 6 | content = data.mock.content.foo 7 | target = "chocolate.txt" 8 | } 9 | 10 | build { 11 | sources = [ 12 | "sources.file.chocolate", 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/empty_object/setting.auto.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | foo = ["yo"] 2 | bar = { 3 | "baz": "foo", 4 | } 5 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/empty_object/var.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "foo" { 3 | default = [] 4 | } 5 | 6 | variable "bar" { 7 | default = {} 8 | } 9 | 10 | source "file" "base" { 11 | } 12 | 13 | build { 14 | source "sources.file.base" { 15 | target = "${var.bar.baz}.txt" 16 | content = var.foo[0] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/force.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "potato" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | sources = ["sources.null.potato"] 7 | 8 | post-processor "manifest" { 9 | output = "manifest.json" 10 | strip_time = true 11 | } 12 | } -------------------------------------------------------------------------------- /command/test-fixtures/hcl/inspect/fruit_string.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "fruit" { 3 | type = string 4 | default = "banana" 5 | } 6 | 7 | variable "unknown_string" { 8 | type = string 9 | } 10 | 11 | 12 | variable "unknown_list_of_string" { 13 | type = list(string) 14 | } 15 | 16 | variable "unknown_unknown" { 17 | } 18 | 19 | variable "default_from_env" { 20 | default = env("DEFAULT_FROM_ENV") 21 | } 22 | 23 | variable "other_default_from_env" { 24 | default = env("OTHER_DEFAULT_FROM_ENV") 25 | } 26 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/inspect/virtualbox-builds.pkr.hcl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/command/test-fixtures/hcl/inspect/virtualbox-builds.pkr.hcl -------------------------------------------------------------------------------- /command/test-fixtures/hcl/local-ds-validate.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "null" "dep" { 2 | input = "upload" 3 | } 4 | 5 | source "null" "test" { 6 | communicator = "none" 7 | } 8 | 9 | build { 10 | sources = ["sources.null.test"] 11 | 12 | provisioner "file" { 13 | source = "test-fixtures/hcl/force.pkr.hcl" 14 | destination = "dest" 15 | direction = "${data.null.dep.output}" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/nil-component-crash.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "basic-example" { 2 | } 3 | 4 | build { 5 | sources = ["sources.null.basic-example"] 6 | 7 | provisioner "foo" { 8 | timeout = "10" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/no_build.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "papaya" { 2 | communicator = "none" 3 | } 4 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/provisioner-override.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example1" { 2 | communicator = "none" 3 | } 4 | 5 | source "null" "example2" { 6 | communicator = "none" 7 | } 8 | 9 | build { 10 | sources = ["source.null.example1", "source.null.example2"] 11 | provisioner "shell-local" { 12 | inline = ["echo not overridden"] 13 | override = { 14 | example1 = { 15 | inline = ["echo yes overridden"] 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /command/test-fixtures/hcl/recipes/sources.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "base" { 2 | communicator = "none" 3 | } 4 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/recursive_local_with_input/locals.pkr.hcl: -------------------------------------------------------------------------------- 1 | variable "vms_to_build" { 2 | default = { 3 | "amgroup": "hey" 4 | } 5 | } 6 | 7 | locals { 8 | vms_to_build = var.vms_to_build 9 | dynamic_slice = { 10 | for vm, val in var.vms_to_build : 11 | vm => lookup(local.vms_to_build, vm, "VM NAME NOT FOUND") 12 | } 13 | } 14 | 15 | 16 | source "file" "chocolate" { 17 | content = "hello" 18 | target = "${local.dynamic_slice.amgroup}.txt" 19 | } 20 | 21 | build { 22 | sources = [ 23 | "sources.file.chocolate", 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/recursive_local_with_unset_input/file.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "vms_to_build" { 3 | } 4 | 5 | locals { 6 | vms_to_build = var.vms_to_build 7 | dynamic_map = { 8 | for vm in local.vms_to_build : 9 | vm => lookup(local, vm, "VM NAME NOT FOUND") 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/reprepare/hello.sh: -------------------------------------------------------------------------------- 1 | echo hello from the ${BUILDER} builder ${USER} -------------------------------------------------------------------------------- /command/test-fixtures/hcl/reprepare/shell-local-windows.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | sources = [ 7 | "source.null.example" 8 | ] 9 | provisioner "shell-local" { 10 | script = "./${path.root}/test_cmd.cmd" 11 | environment_vars = ["USER=packeruser", "BUILDER=${upper(build.ID)}"] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/reprepare/shell-local.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | sources = [ 7 | "source.null.example" 8 | ] 9 | provisioner "shell-local" { 10 | script = "./${path.root}/hello.sh" 11 | environment_vars = ["USER=packeruser", "BUILDER=${upper(build.ID)}"] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/reprepare/test_cmd.cmd: -------------------------------------------------------------------------------- 1 | echo hello from the %BUILDER% builder %USER% -------------------------------------------------------------------------------- /command/test-fixtures/hcl/test_except_manifest.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | sources = ["null.test"] 7 | 8 | post-processor "manifest" {} 9 | } 10 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/validation/map/definition.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "image_metadata" { 3 | default = { 4 | key: "value", 5 | something: { 6 | foo: "bar", 7 | } 8 | } 9 | validation { 10 | condition = length(var.image_metadata.key) > 4 11 | error_message = "The image_metadata.key field must be more than 4 runes." 12 | } 13 | validation { 14 | condition = substr(var.image_metadata.something.foo, 0, 3) == "bar" 15 | error_message = "The image_metadata.something.foo field must start with \"bar\"." 16 | } 17 | } 18 | 19 | source "null" "test" { 20 | communicator = "none" 21 | } 22 | 23 | build { 24 | sources = ["source.null.test"] 25 | } 26 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/validation/map/invalid_value.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | 2 | image_metadata = { 3 | key: "value", 4 | something: { 5 | foo: "woo", 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/validation/map/valid_value.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | 2 | image_metadata = { 3 | key: "value", 4 | something: { 5 | foo: "barwoo", 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/validation/wrong_pause_before.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example1" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | sources = ["source.null.example1"] 7 | 8 | provisioner "shell-local" { 9 | pause_before = "5" 10 | inline = ["echo Did I wait a bit?"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/variables/list_of_string/var.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "list_of_string" { 3 | type = list(string) 4 | } 5 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/variables/ref_non_existing/ref_non_existing_var.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | sources = ["null.test"] 7 | } 8 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/variables/ref_non_existing/variables.auto.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | testvar = "auto" 2 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/variables/untyped_var/settings.auto.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | 2 | untyped = ["slice", "of", "strings"] 3 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/variables/untyped_var/var.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "untyped" { 3 | } 4 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl/vars-in-build-block.pkr.hcl: -------------------------------------------------------------------------------- 1 | variable "name" { 2 | type = string 3 | default = "example" 4 | } 5 | 6 | variable "description" { 7 | type = string 8 | default = "blah blah blah" 9 | } 10 | 11 | source "null" "example" { 12 | communicator = "none" 13 | } 14 | 15 | build { 16 | name = var.name 17 | description = var.description 18 | 19 | sources = ["source.null.example"] 20 | 21 | post-processor "shell-local" { 22 | inline = ["echo 2 > ${build.name}.2.txt"] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/azure_shg/expected.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | azure = { 4 | source = "github.com/hashicorp/azure" 5 | version = "~> 1" 6 | } 7 | } 8 | } 9 | 10 | source "azure-arm" "autogenerated_1" { 11 | shared_image_gallery { 12 | gallery_name = "web_app" 13 | } 14 | } 15 | 16 | build { 17 | sources = ["source.azure-arm.autogenerated_1"] 18 | 19 | } 20 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/azure_shg/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "azure-arm", 4 | "shared_image_gallery": { 5 | "gallery_name": "web_app" 6 | } 7 | }] 8 | } 9 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/bundled-plugin-used/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "amazon-ebs" 4 | }], 5 | "provisioners": [{ 6 | "type": "ansible-local" 7 | }], 8 | "post-processors": [{ 9 | "type": "googlecompute-import" 10 | }] 11 | } 12 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/error-cleanup-provisioner/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "null", 5 | "communicator": "none" 6 | } 7 | ], 8 | "provisioners": [ 9 | { 10 | "type": "shell-local", 11 | "inline": ["exit 2"] 12 | } 13 | ], 14 | "error-cleanup-provisioner": { 15 | "type": "shell-local", 16 | "inline": ["echo 'rubber ducky'> ducky.txt"] 17 | } 18 | } -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/escaping/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "conf": "{{ env \"ONE\" }}-{{env \"ANOTHER\"}}-{{ env `BACKTICKED` }}", 4 | "nospaces": "{{env \"SOMETHING\"}}", 5 | "manyspaces": "{{ env \"ASDFASDF\"}}" 6 | }, 7 | "builders": [ 8 | { 9 | "type": "null", 10 | "communicator": "none" 11 | } 12 | ], 13 | "provisioners": [ 14 | { 15 | "type": "shell-local", 16 | "inline": [ 17 | "echo {{user \"conf\"}}-{{timestamp}}-{{isotime \"01-02-2006\"}}" 18 | ] 19 | }, 20 | { 21 | "type": "shell-local", 22 | "inline": [ 23 | "echo {{ split \"some-string\" \"-\" 0 }}" 24 | ] 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/placeholders/expected.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "envtest" { 3 | type = string 4 | default = "${env("Something")}" 5 | } 6 | 7 | variable "test" { 8 | type = string 9 | default = "{{ .Something }}" 10 | } 11 | 12 | source "null" "autogenerated_1" { 13 | communicator = "none" 14 | other_prop = "{{ .Else }}" 15 | } 16 | 17 | build { 18 | sources = ["source.null.autogenerated_1"] 19 | 20 | } 21 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/placeholders/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "test": "{{ .Something }}", 4 | "envtest": "{{ env \"Something\"}}" 5 | }, 6 | "builders": [ 7 | { 8 | "type": "null", 9 | "communicator": "none", 10 | "other_prop": "{{ .Else }}" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/undeclared-variables/expected.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "communicator_type" { 3 | type = string 4 | } 5 | 6 | variable "foo" { 7 | type = string 8 | default = "bar" 9 | } 10 | 11 | variable "scriptpath" { 12 | type = string 13 | } 14 | 15 | source "null" "autogenerated_1" { 16 | communicator = "${var.communicator_type}" 17 | } 18 | 19 | build { 20 | sources = ["source.null.autogenerated_1"] 21 | 22 | provisioner "shell" { 23 | script = "${var.scriptpath}" 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/undeclared-variables/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "foo": "bar" 4 | }, 5 | "builders": [ 6 | { 7 | "type": "null", 8 | "communicator": "{{ user `communicator_type` }}" 9 | } 10 | ], 11 | "provisioners": [ 12 | { 13 | "type": "shell", 14 | "script": "{{user `scriptpath`}}" 15 | } 16 | ] 17 | } 18 | 19 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/varfile-with-no-variables-block/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "null", 5 | "communicator": "ssh", 6 | "ssh_host": "{{ user `ssh_host` }}", 7 | "ssh_password": "{{ user `ssh_password` }}", 8 | "ssh_username": "{{ user `ssh_username` }}" 9 | } 10 | ], 11 | "provisioners": [ 12 | { 13 | "pause_before": "20s", 14 | "type": "shell-local", 15 | "inline": [ "echo {{ user `version_tag` }} > provision.txt" ] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/varfile-with-no-variables-block/variables.json: -------------------------------------------------------------------------------- 1 | { 2 | "version_tag": "1.0.0", 3 | "ssh_host": "localhost", 4 | "ssh_username": "packer", 5 | "ssh_password": "packer" 6 | } 7 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/variables-with-variables/expected.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "aws_access_key" { 3 | type = string 4 | default = "" 5 | sensitive = true 6 | } 7 | 8 | variable "aws_region" { 9 | type = string 10 | } 11 | 12 | variable "aws_secret_key" { 13 | type = string 14 | default = "" 15 | sensitive = true 16 | } 17 | 18 | local "password" { 19 | sensitive = true 20 | expression = "${var.aws_secret_key}-${var.aws_access_key}" 21 | } 22 | 23 | locals { 24 | aws_secondary_region = "${var.aws_region}" 25 | } 26 | -------------------------------------------------------------------------------- /command/test-fixtures/hcl2_upgrade/variables-with-variables/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "aws_region": null, 4 | "aws_secondary_region": "{{ user `aws_region` }}", 5 | "aws_secret_key": "", 6 | "aws_access_key": "", 7 | "password": "{{ user `aws_secret_key` }}-{{ user `aws_access_key` }}" 8 | }, 9 | "sensitive-variables": [ 10 | "aws_secret_key", 11 | "aws_access_key", 12 | "password" 13 | ] 14 | } -------------------------------------------------------------------------------- /command/test-fixtures/hcp/build-description.pkr.hcl: -------------------------------------------------------------------------------- 1 | source file "test" { 2 | content = " " 3 | target = "output" 4 | } 5 | 6 | build { 7 | name = "bucket-slug" 8 | 9 | description = "Some build description" 10 | 11 | hcp_packer_registry {} 12 | 13 | sources = [ 14 | "sources.file.test", 15 | ] 16 | } 17 | 18 | -------------------------------------------------------------------------------- /command/test-fixtures/hcp/deprecated_labels.pkr.hcl: -------------------------------------------------------------------------------- 1 | source file "test" { 2 | content = " " 3 | target = "output" 4 | } 5 | 6 | build { 7 | description = "Some build description" 8 | 9 | hcp_packer_registry { 10 | bucket_name = "bucket-slug" 11 | labels = { 12 | "foo" = "bar" 13 | } 14 | } 15 | 16 | sources = [ 17 | "sources.file.test", 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /command/test-fixtures/hcp/dup_build_blocks.pkr.hcl: -------------------------------------------------------------------------------- 1 | source file "test" { 2 | content = " " 3 | target = "output" 4 | } 5 | 6 | build { 7 | description = "Some build description" 8 | 9 | hcp_packer_registry { 10 | bucket_name = "bucket-slug" 11 | description = "Some override description" 12 | } 13 | 14 | sources = [ 15 | "sources.file.test", 16 | ] 17 | } 18 | 19 | build { 20 | description = "Some other build" 21 | 22 | hcp_packer_registry { 23 | bucket_name = "bucket-bis" 24 | } 25 | 26 | sources = [ 27 | "sources.file.test", 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /command/test-fixtures/hcp/duplicate.pkr.hcl: -------------------------------------------------------------------------------- 1 | source file "test" { 2 | content = " " 3 | target = "output" 4 | } 5 | 6 | build { 7 | description = "Some build description" 8 | 9 | hcp_packer_registry { 10 | bucket_name = "bucket-slug" 11 | description = "Some override description" 12 | } 13 | 14 | hcp_packer_registry { 15 | bucket_name = "bucket-slug" 16 | description = "Some override description" 17 | } 18 | 19 | sources = [ 20 | "sources.file.test", 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /command/test-fixtures/hcp/hcp_build.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Some legacy JSON build", 3 | "builders": [ 4 | { 5 | "type": "file", 6 | "content": " ", 7 | "target": "output" 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /command/test-fixtures/hcp/hcp_normal.pkr.json: -------------------------------------------------------------------------------- 1 | { 2 | "source": { 3 | "file": { 4 | "test": { 5 | "content": " ", 6 | "target": "output" 7 | } 8 | } 9 | }, 10 | "build": { 11 | "name": "test-file", 12 | "description": "Some build description", 13 | "sources": ["sources.file.test"] 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /command/test-fixtures/hcp/multiple_sources.pkr.hcl: -------------------------------------------------------------------------------- 1 | source file "test" { 2 | content = " " 3 | target = "output" 4 | } 5 | 6 | source file "other" { 7 | content = "b" 8 | target = "output 2" 9 | } 10 | 11 | build { 12 | name = "bucket-slug" 13 | 14 | hcp_packer_registry { 15 | description = < {{ user `fruit` }}.txt" ] 17 | } 18 | ] 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /command/test-fixtures/var-arg/fruit_builder.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "fruit" { 3 | type = string 4 | } 5 | 6 | locals { 7 | fruit = var.fruit 8 | } 9 | 10 | source "null" "builder" { 11 | communicator = "none" 12 | } 13 | 14 | build { 15 | sources = [ 16 | "source.null.builder", 17 | ] 18 | 19 | provisioner "shell-local" { 20 | inline = ["echo ${local.fruit} > ${local.fruit}.txt"] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /command/test-fixtures/var-arg/map.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "images" { 3 | type = map(string) 4 | default = { 5 | key = "value" 6 | } 7 | } -------------------------------------------------------------------------------- /command/test-fixtures/var-arg/var-arg-test-autovar-json/fruit_builder.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "fruit" { 3 | type = string 4 | } 5 | 6 | locals { 7 | fruit = var.fruit 8 | } 9 | 10 | source "null" "builder" { 11 | communicator = "none" 12 | } 13 | 14 | build { 15 | sources = [ 16 | "source.null.builder", 17 | ] 18 | 19 | provisioner "shell-local" { 20 | inline = ["echo ${local.fruit} > ${local.fruit}.txt"] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /command/test-fixtures/var-arg/var-arg-test-autovar-json/peanut.auto.pkrvars.json: -------------------------------------------------------------------------------- 1 | { 2 | "fruit": "peanut" 3 | } -------------------------------------------------------------------------------- /command/test-fixtures/var-arg/var-arg-tests/fruit_builder.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "fruit" { 3 | type = string 4 | } 5 | 6 | locals { 7 | fruit = var.fruit 8 | } 9 | 10 | source "null" "builder" { 11 | communicator = "none" 12 | } 13 | 14 | build { 15 | sources = [ 16 | "source.null.builder", 17 | ] 18 | 19 | provisioner "shell-local" { 20 | inline = ["echo ${local.fruit} > ${local.fruit}.txt"] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /command/test-fixtures/var-arg/var-arg-tests/icecream.auto.pkrvrs.hcl: -------------------------------------------------------------------------------- 1 | fruit = "icecream" -------------------------------------------------------------------------------- /command/test-fixtures/var-arg/var-arg-tests/peanut.auto.pkrvars.json: -------------------------------------------------------------------------------- 1 | { 2 | "fruit": "peanut" 3 | } -------------------------------------------------------------------------------- /command/test-fixtures/version_req/base_failure/version.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_version = ">= 700000.0.0" 3 | } 4 | 5 | block_from_the_future { 6 | the_answer_to_life_the_universe_and_everything = 42 7 | } 8 | 9 | build {} 10 | -------------------------------------------------------------------------------- /command/test-fixtures/version_req/base_success/version.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_version = ">= 1.0.0" 3 | } 4 | 5 | source "null" "test" { 6 | communicator = "none" 7 | } 8 | 9 | build { 10 | sources = ["null.test"] 11 | } 12 | -------------------------------------------------------------------------------- /command/test-fixtures/version_req/wrong_field_name/version.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | version = ">= 700000.0.0" 3 | } 4 | -------------------------------------------------------------------------------- /command/utils.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package command 5 | 6 | import ( 7 | "os" 8 | "strings" 9 | ) 10 | 11 | func isDir(name string) (bool, error) { 12 | s, err := os.Stat(name) 13 | if err != nil { 14 | return false, err 15 | } 16 | return s.IsDir(), nil 17 | } 18 | 19 | func isHCLLoaded(name string) (bool, error) { 20 | if strings.HasSuffix(name, ".pkr.hcl") || 21 | strings.HasSuffix(name, ".pkr.json") { 22 | return true, nil 23 | } 24 | return isDir(name) 25 | } 26 | -------------------------------------------------------------------------------- /command/version_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package command 5 | 6 | import ( 7 | "testing" 8 | 9 | "github.com/mitchellh/cli" 10 | ) 11 | 12 | func TestVersionCommand_implements(t *testing.T) { 13 | var _ cli.Command = &VersionCommand{} 14 | } 15 | -------------------------------------------------------------------------------- /datasource/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/datasource/.gitkeep -------------------------------------------------------------------------------- /datasource/hcp-packer-iteration/test-fixtures/hcp-setup-build.pkr.hcl: -------------------------------------------------------------------------------- 1 | variable "target" { 2 | type = string 3 | default = %q 4 | } 5 | 6 | source "file" "test" { 7 | content = "Lorem ipsum dolor sit amet" 8 | target = var.target 9 | } 10 | 11 | build { 12 | hcp_packer_registry { 13 | bucket_name = "simple-deprecated" 14 | } 15 | sources = ["source.file.test"] 16 | } 17 | -------------------------------------------------------------------------------- /datasource/hcp-packer-version/test-fixtures/hcp-setup-build.pkr.hcl: -------------------------------------------------------------------------------- 1 | variable "target" { 2 | type = string 3 | default = %q 4 | } 5 | 6 | source "file" "test" { 7 | content = "Lorem ipsum dolor sit amet" 8 | target = var.target 9 | } 10 | 11 | build { 12 | hcp_packer_registry { 13 | bucket_name = "simple" 14 | } 15 | sources = ["source.file.test"] 16 | } 17 | -------------------------------------------------------------------------------- /datasource/http/test-fixtures/404_url.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | source "null" "example" { 3 | communicator = "none" 4 | } 5 | 6 | data "http" "basic" { 7 | url = "https://developer.hashicorp.com/packer/thisWillFail" 8 | } 9 | 10 | locals { 11 | url = "${data.http.basic.url}" 12 | } 13 | 14 | build { 15 | name = "mybuild" 16 | sources = [ 17 | "source.null.example" 18 | ] 19 | provisioner "shell-local" { 20 | inline = [ 21 | "echo data is ${local.url}", 22 | ] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /datasource/http/test-fixtures/basic.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example" { 2 | communicator = "none" 3 | } 4 | 5 | data "http" "basic" { 6 | url = "https://www.packer.io/" 7 | } 8 | 9 | locals { 10 | url = "${data.http.basic.url}" 11 | body = "${data.http.basic.body}" != "" 12 | } 13 | 14 | build { 15 | name = "mybuild" 16 | sources = [ 17 | "source.null.example" 18 | ] 19 | provisioner "shell-local" { 20 | inline = [ 21 | "echo url is ${local.url}", 22 | "echo body is ${local.body}" 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /datasource/http/test-fixtures/empty_url.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example" { 2 | communicator = "none" 3 | } 4 | 5 | data "http" "basic" { 6 | url = "" 7 | } 8 | 9 | locals { 10 | url = "${data.http.basic.url}" 11 | } 12 | 13 | build { 14 | name = "mybuild" 15 | sources = [ 16 | "source.null.example" 17 | ] 18 | provisioner "shell-local" { 19 | inline = [ 20 | "echo data is ${local.url}", 21 | ] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /datasource/http/test-fixtures/invalid_method.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "example" { 2 | communicator = "none" 3 | } 4 | 5 | data "http" "basic" { 6 | url = "https://www.packer.io/" 7 | method = "NONEEXISTING" 8 | } 9 | 10 | locals { 11 | url = "${data.http.basic.url}" 12 | body = "${data.http.basic.body}" != "" 13 | } 14 | 15 | build { 16 | name = "mybuild" 17 | sources = [ 18 | "source.null.example" 19 | ] 20 | provisioner "shell-local" { 21 | inline = [ 22 | "echo url is ${local.url}", 23 | "echo body is ${local.body}" 24 | ] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/_common/sshd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | SSHD_CONFIG="/etc/ssh/sshd_config" 4 | 5 | # ensure that there is a trailing newline before attempting to concatenate 6 | sed -i -e '$a\' "$SSHD_CONFIG" 7 | 8 | USEDNS="UseDNS no" 9 | if grep -q -E "^[[:space:]]*UseDNS" "$SSHD_CONFIG"; then 10 | sed -i "s/^\s*UseDNS.*/${USEDNS}/" "$SSHD_CONFIG" 11 | else 12 | echo "$USEDNS" >>"$SSHD_CONFIG" 13 | fi 14 | 15 | GSSAPI="GSSAPIAuthentication no" 16 | if grep -q -E "^[[:space:]]*GSSAPIAuthentication" "$SSHD_CONFIG"; then 17 | sed -i "s/^\s*GSSAPIAuthentication.*/${GSSAPI}/" "$SSHD_CONFIG" 18 | else 19 | echo "$GSSAPI" >>"$SSHD_CONFIG" 20 | fi 21 | -------------------------------------------------------------------------------- /examples/_common/virtualbox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | # set a default HOME_DIR environment variable if not set 4 | HOME_DIR="${HOME_DIR:-/home/vagrant}"; 5 | 6 | case "$PACKER_BUILDER_TYPE" in 7 | virtualbox-iso|virtualbox-ovf) 8 | VER="`cat $HOME_DIR/.vbox_version`"; 9 | ISO="VBoxGuestAdditions_$VER.iso"; 10 | mkdir -p /tmp/vbox; 11 | mount -o loop $HOME_DIR/$ISO /tmp/vbox; 12 | sh /tmp/vbox/VBoxLinuxAdditions.run \ 13 | || echo "VBoxLinuxAdditions.run exited $? and is suppressed." \ 14 | "For more read https://www.virtualbox.org/ticket/12479"; 15 | umount /tmp/vbox; 16 | rm -rf /tmp/vbox; 17 | rm -f $HOME_DIR/*.iso; 18 | ;; 19 | esac 20 | -------------------------------------------------------------------------------- /examples/hcl/linux/README.md: -------------------------------------------------------------------------------- 1 | # Basic HCL2 Ubuntu builders 2 | 3 | Taking the [chef/bento](https://github.com/chef/bento) repo as an example. 4 | 5 | I recommend you start by reading the build.pkr.hcl file and the 6 | comments/description there. 7 | -------------------------------------------------------------------------------- /examples/hcl/linux/etc/http/alpine-answers: -------------------------------------------------------------------------------- 1 | KEYMAPOPTS="us us" 2 | HOSTNAMEOPTS="-n alpine" 3 | INTERFACESOPTS="auto lo 4 | iface lo inet loopback 5 | 6 | auto eth0 7 | iface eth0 inet dhcp 8 | hostname alpine 9 | " 10 | TIMEZONEOPTS="-z UTC" 11 | PROXYOPTS="none" 12 | APKREPOSOPTS="http://mirrors.dotsrc.org/alpine/v3.8/main" 13 | SSHDOPTS="-c openssh" 14 | NTPOPTS="-c none" 15 | DISKOPTS="-m sys /dev/sda" 16 | -------------------------------------------------------------------------------- /examples/hcl/linux/etc/http/alpine-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | apk add libressl 6 | apk add open-vm-tools 7 | rc-update add open-vm-tools 8 | /etc/init.d/open-vm-tools start 9 | 10 | cat >/usr/local/bin/shutdown </etc/sudoers.d/99_vagrant; 7 | chmod 440 /etc/sudoers.d/99_vagrant; 8 | -------------------------------------------------------------------------------- /examples/hcl/linux/etc/scripts/050-vagrant.sh: -------------------------------------------------------------------------------- 1 | ../../../../_common/vagrant.sh -------------------------------------------------------------------------------- /examples/hcl/linux/etc/scripts/060-virtualbox.sh: -------------------------------------------------------------------------------- 1 | ../../../../_common/virtualbox.sh -------------------------------------------------------------------------------- /examples/hcl/linux/etc/scripts/070-vmware.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | 3 | case "$PACKER_BUILDER_TYPE" in 4 | vmware-iso|vmware-vmx) 5 | apt-get install -y open-vm-tools; 6 | mkdir /mnt/hgfs; 7 | systemctl enable open-vm-tools 8 | systemctl start open-vm-tools 9 | echo "platform specific vmware.sh executed"; 10 | esac 11 | -------------------------------------------------------------------------------- /examples/hcl/linux/etc/scripts/080-parallels.sh: -------------------------------------------------------------------------------- 1 | ../../../../_common/parallels.sh -------------------------------------------------------------------------------- /examples/hcl/linux/etc/scripts/090-hyperv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eux 2 | ubuntu_version="`lsb_release -r | awk '{print $2}'`"; 3 | major_version="`echo $ubuntu_version | awk -F. '{print $1}'`"; 4 | 5 | case "$PACKER_BUILDER_TYPE" in 6 | hyperv-iso) 7 | if [ "$major_version" -eq "16" ]; then 8 | apt-get install -y linux-tools-virtual-lts-xenial linux-cloud-tools-virtual-lts-xenial; 9 | else 10 | apt-get -y install linux-image-virtual linux-tools-virtual linux-cloud-tools-virtual; 11 | fi 12 | esac 13 | -------------------------------------------------------------------------------- /examples/hcl/linux/etc/scripts/110-minimize.sh: -------------------------------------------------------------------------------- 1 | ../../../../_common/minimize.sh -------------------------------------------------------------------------------- /examples/hcl/linux/source.parallels-iso.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | source "parallels-iso" "base-ubuntu-amd64" { 3 | boot_wait = "10s" 4 | guest_os_type = "ubuntu" 5 | http_content = local.http_directory_content 6 | parallels_tools_flavor = "lin" 7 | prlctl_version_file = ".prlctl_version" 8 | shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now" 9 | ssh_password = "vagrant" 10 | ssh_port = 22 11 | ssh_timeout = "10000s" 12 | ssh_username = "vagrant" 13 | } 14 | -------------------------------------------------------------------------------- /examples/hcl/linux/source.qemu.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "qemu" "base-ubuntu-amd64" { 2 | headless = var.headless 3 | floppy_files = [ 4 | "${local.http_directory}/preseed.cfg", 5 | ] 6 | http_directory = local.http_directory 7 | shutdown_command = "echo 'vagrant'|sudo -S shutdown -P now" 8 | ssh_password = "vagrant" 9 | ssh_username = "vagrant" 10 | ssh_wait_timeout = "50m" 11 | disk_size = 5000 12 | disk_interface = "virtio-scsi" 13 | memory = 512 * 4 14 | cpus = 4 15 | boot_wait = "5s" 16 | } 17 | -------------------------------------------------------------------------------- /examples/hcl/linux/source.vmware-vmx.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "vmware-vmx" "base-ubuntu-amd64" { 2 | headless = var.headless 3 | boot_wait = "10s" 4 | http_directory = local.http_directory 5 | shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now" 6 | ssh_password = "vagrant" 7 | ssh_port = 22 8 | ssh_timeout = "10000s" 9 | ssh_username = "vagrant" 10 | tools_upload_flavor = "linux" 11 | vmx_data = { 12 | "cpuid.coresPerSocket" = "1" 13 | "ethernet0.pciSlotNumber" = "32" 14 | } 15 | vmx_remove_ethernet_interfaces = true 16 | } 17 | -------------------------------------------------------------------------------- /fix/fixer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package fix 5 | 6 | import ( 7 | "testing" 8 | ) 9 | 10 | func TestFix_allFixersEnabled(t *testing.T) { 11 | f := Fixers 12 | o := FixerOrder 13 | 14 | if len(f) != len(o) { 15 | t.Fatalf("Fixers length (%d) does not match FixerOrder length (%d)", len(f), len(o)) 16 | } 17 | 18 | for fixer := range f { 19 | found := false 20 | 21 | for _, orderedFixer := range o { 22 | if orderedFixer == fixer { 23 | found = true 24 | break 25 | } 26 | } 27 | 28 | if !found { 29 | t.Fatalf("Did not find Fixer %s in FixerOrder", fixer) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /go: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/go -------------------------------------------------------------------------------- /hcl2template/addrs/input_variable.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package addrs 5 | 6 | // InputVariable is the address of an input variable. 7 | type InputVariable struct { 8 | referenceable 9 | Name string 10 | } 11 | 12 | func (v InputVariable) String() string { 13 | return "var." + v.Name 14 | } 15 | -------------------------------------------------------------------------------- /hcl2template/components.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package hcl2template 5 | 6 | // ComponentKind helps enumerate what kind of components exist in this Package. 7 | type ComponentKind int 8 | 9 | const ( 10 | Builder ComponentKind = iota 11 | Provisioner 12 | PostProcessor 13 | Datasource 14 | ) 15 | -------------------------------------------------------------------------------- /hcl2template/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | // Package hcl2template defines code to parse hcl2 template files. 5 | // 6 | // In order to configure a packer builder,provisioner, and post processor. 7 | // 8 | // Checkout the files in testdata/complete/ to see what a packer config could 9 | // look like. 10 | package hcl2template 11 | -------------------------------------------------------------------------------- /hcl2template/fixtures/malformed_override.pkr.hcl: -------------------------------------------------------------------------------- 1 | provisioner "shell-local" { 2 | inline = ["echo 'hi'"] 3 | override = "hello" 4 | } 5 | -------------------------------------------------------------------------------- /hcl2template/fixtures/malformed_override_innards.pkr.hcl: -------------------------------------------------------------------------------- 1 | provisioner "shell-local" { 2 | inline = ["echo 'hi'"] 3 | override = { 4 | test = "hello" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /hcl2template/fixtures/well_formed_provisioner.pkr.hcl: -------------------------------------------------------------------------------- 1 | provisioner "shell-local" { 2 | inline = ["echo 'hi'"] 3 | override = { 4 | test = { 5 | "hello" = "new value" 6 | } 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /hcl2template/function/refinements.go: -------------------------------------------------------------------------------- 1 | package function 2 | 3 | import ( 4 | "github.com/zclconf/go-cty/cty" 5 | ) 6 | 7 | func refineNotNull(b *cty.RefinementBuilder) *cty.RefinementBuilder { 8 | return b.NotNull() 9 | } 10 | -------------------------------------------------------------------------------- /hcl2template/function/testdata/bare.tmpl: -------------------------------------------------------------------------------- 1 | ${val} -------------------------------------------------------------------------------- /hcl2template/function/testdata/func.tmpl: -------------------------------------------------------------------------------- 1 | The items are ${join(", ", list)} -------------------------------------------------------------------------------- /hcl2template/function/testdata/hello.tmpl: -------------------------------------------------------------------------------- 1 | Hello, ${name}! -------------------------------------------------------------------------------- /hcl2template/function/testdata/hello.txt: -------------------------------------------------------------------------------- 1 | Hello World -------------------------------------------------------------------------------- /hcl2template/function/testdata/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/hcl2template/function/testdata/icon.png -------------------------------------------------------------------------------- /hcl2template/function/testdata/list.tmpl: -------------------------------------------------------------------------------- 1 | %{ for x in list ~} 2 | - ${x} 3 | %{ endfor ~} 4 | -------------------------------------------------------------------------------- /hcl2template/function/testdata/recursive.tmpl: -------------------------------------------------------------------------------- 1 | ${templatefile("recursive.tmpl", {})} -------------------------------------------------------------------------------- /hcl2template/repl/repl.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | // Package repl provides the structs and functions necessary to run REPL for 5 | // HCL2. The REPL allows experimentation of HCL2 interpolations without having 6 | // to run a HCL2 configuration. 7 | package repl 8 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/invalid_build_name_variable.pkr.hcl: -------------------------------------------------------------------------------- 1 | variable "name" { 2 | type = int 3 | default = 123 4 | } 5 | 6 | build { 7 | name = var.name 8 | } 9 | 10 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/invalid_source_reference.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | build { 3 | sources = ["ami"] 4 | } 5 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/named.pkr.hcl: -------------------------------------------------------------------------------- 1 | build { 2 | name = "somebuild" 3 | 4 | sources = [ 5 | "source.amazon-ebs.ubuntu-1604", 6 | "source.virtualbox-iso.ubuntu-1204", 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/post-processor_build_name_interpolation.pkr.hcl: -------------------------------------------------------------------------------- 1 | build { 2 | name = "test-build" 3 | sources = [ "source.virtualbox-iso.ubuntu-1204" ] 4 | 5 | post-processor "manifest" { 6 | name = build.name 7 | slice_string = ["${packer.version}", "${build.name}"] 8 | } 9 | 10 | } 11 | 12 | source "virtualbox-iso" "ubuntu-1204" { 13 | } 14 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/post-processor_nonexistent.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" {} 2 | 3 | build { 4 | sources = [ "null.test" ] 5 | 6 | post-processor "nonexistent" { 7 | foo = "bar" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/post-processor_untyped.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | build { 3 | post-process { 4 | foo = "bar" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/provisioner_build_name_interpolation.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | // starts resources to provision them. 3 | build { 4 | name = "build-name-test" 5 | sources = [ 6 | "source.virtualbox-iso.ubuntu-1204", 7 | ] 8 | 9 | provisioner "shell" { 10 | name = build.name 11 | slice_string = ["${build.name}"] 12 | } 13 | } 14 | 15 | source "virtualbox-iso" "ubuntu-1204" { 16 | } 17 | 18 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/provisioner_nonexistent.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" {} 2 | 3 | build { 4 | sources = [ "null.test" ] 5 | 6 | provisioner "nonexistent" { 7 | foo = "bar" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/provisioner_packer_version_interpolation.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | // starts resources to provision them. 3 | build { 4 | sources = [ 5 | "source.virtualbox-iso.ubuntu-1204", 6 | ] 7 | 8 | provisioner "shell" { 9 | slice_string = ["{{packer_version}}"] 10 | } 11 | } 12 | 13 | source "virtualbox-iso" "ubuntu-1204" { 14 | } 15 | 16 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/provisioner_paused_before_retry.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | // starts resources to provision them. 3 | build { 4 | sources = [ 5 | "source.virtualbox-iso.ubuntu-1204" 6 | ] 7 | 8 | provisioner "shell" { 9 | pause_before = "10s" 10 | max_retries = 5 11 | } 12 | } 13 | 14 | source "virtualbox-iso" "ubuntu-1204" { 15 | } -------------------------------------------------------------------------------- /hcl2template/testdata/build/provisioner_timeout.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | // starts resources to provision them. 3 | build { 4 | sources = [ 5 | "source.virtualbox-iso.ubuntu-1204" 6 | ] 7 | 8 | provisioner "shell" { 9 | timeout = "10s" 10 | } 11 | } 12 | 13 | source "virtualbox-iso" "ubuntu-1204" { 14 | } -------------------------------------------------------------------------------- /hcl2template/testdata/build/provisioner_untyped.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | build { 3 | provision { 4 | foo = "bar" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/two-error-cleanup-provisioner.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "virtualbox-iso" "ubuntu-1204" { 2 | } 3 | 4 | // starts resources to provision them. 5 | build { 6 | sources = [ 7 | "source.virtualbox-iso.ubuntu-1204" 8 | ] 9 | 10 | error-cleanup-provisioner "shell-local" { 11 | } 12 | 13 | error-cleanup-provisioner "file" { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /hcl2template/testdata/build/variables.pkr.hcl: -------------------------------------------------------------------------------- 1 | variable "name" { 2 | type = string 3 | default = "build-name" 4 | } 5 | 6 | local "description" { 7 | expression = "This is the description for ${var.name}." 8 | } 9 | 10 | build { 11 | name = var.name 12 | description = local.description 13 | 14 | sources = [ 15 | "source.virtualbox-iso.ubuntu-1204" 16 | ] 17 | } 18 | 19 | source "virtualbox-iso" "ubuntu-1204" { 20 | } 21 | 22 | -------------------------------------------------------------------------------- /hcl2template/testdata/complete/datasource.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "amazon-ami" "test" { 2 | string = "string" 3 | } -------------------------------------------------------------------------------- /hcl2template/testdata/datasources/dependency_cycle.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "null" "gummy" { 2 | input = "${data.null.bear.output}" 3 | } 4 | data "null" "bear" { 5 | input = "${data.null.gummy.output}" 6 | } -------------------------------------------------------------------------------- /hcl2template/testdata/datasources/duplicate.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "amazon-ami" "test" {} 2 | data "amazon-ami" "test" {} 3 | -------------------------------------------------------------------------------- /hcl2template/testdata/datasources/nonexistent.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "nonexistent" "test" { 2 | foo = "bar" 3 | } -------------------------------------------------------------------------------- /hcl2template/testdata/datasources/not-allowed.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "amazon-ami" "test_0" { 2 | string = "string" 3 | } 4 | 5 | data "amazon-ami" "test_1" { 6 | string = data.amazon-ami.test_0.string 7 | } -------------------------------------------------------------------------------- /hcl2template/testdata/datasources/recursive.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "null" "foo" { 2 | input = "chocolate" 3 | } 4 | 5 | data "null" "yummy" { 6 | input = "${data.null.bang.output}-and-sprinkles" 7 | } 8 | 9 | data "null" "bar" { 10 | input = "vanilla" 11 | } 12 | 13 | data "null" "baz" { 14 | input = "${data.null.foo.output}-${data.null.bar.output}-swirl" 15 | } 16 | 17 | data "null" "bang" { 18 | input = "${data.null.baz.output}-with-marshmallows" 19 | } 20 | 21 | source "null" "test" { 22 | communicator = "none" 23 | } 24 | 25 | build { 26 | sources = ["null.test"] 27 | } 28 | -------------------------------------------------------------------------------- /hcl2template/testdata/datasources/unnamed.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "amazon-ami" { 2 | foo = "bar" 3 | } -------------------------------------------------------------------------------- /hcl2template/testdata/datasources/untyped.pkr.hcl: -------------------------------------------------------------------------------- 1 | data { 2 | foo = "bar" 3 | } -------------------------------------------------------------------------------- /hcl2template/testdata/empty/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/hcl2template/testdata/empty/.gitkeep -------------------------------------------------------------------------------- /hcl2template/testdata/format/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "type": "amazon-ebs", 5 | "access_key": "YOUR_AWS_ACCESS_KEY", 6 | "secret_key": "YOUR_AWS_SECRET_KEY", 7 | "region": "us-east-1" 8 | } 9 | ], 10 | "provisioners": [ 11 | { 12 | "type": "shell", 13 | "inline": [ 14 | "sudo apt-get update", 15 | "sudo apt-get install -y nginx" 16 | ] 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /hcl2template/testdata/format/unformatted.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | ami_filter_name ="amzn2-ami-hvm-*-x86_64-gp2" 2 | ami_filter_owners =[ "137112412989" ] 3 | 4 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/build-block-error-multiple-hcp-declaration.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | name = "build1" 7 | hcp_packer_registry { 8 | bucket_name = "ok-Bucket-name-1" 9 | } 10 | 11 | sources = ["null.test"] 12 | } 13 | 14 | build { 15 | name = "build2" 16 | hcp_packer_registry { 17 | bucket_name = "ok-Bucket-name-1" 18 | } 19 | 20 | sources = ["null.test"] 21 | } 22 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/build-block-ok-bucket.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | name = "bucket-slug" 7 | hcp_packer_registry { 8 | bucket_name = "ok-Bucket-name-1" 9 | } 10 | 11 | sources = ["null.test"] 12 | } 13 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/build-block-ok-multiple-build-block-second-block.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | name = "build1" 7 | 8 | sources = ["null.test"] 9 | } 10 | 11 | build { 12 | name = "build2" 13 | hcp_packer_registry { 14 | bucket_name = "ok-Bucket-name-1" 15 | } 16 | 17 | sources = ["null.test"] 18 | } 19 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/build-block-ok-multiple-build-block.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | name = "build1" 7 | hcp_packer_registry { 8 | bucket_name = "ok-Bucket-name-1" 9 | } 10 | 11 | sources = ["null.test"] 12 | } 13 | 14 | build { 15 | name = "build2" 16 | sources = ["null.test"] 17 | } 18 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/top-level-and-build-block.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | hcp_packer_registry { 6 | bucket_name = "ok-Bucket-name-1" 7 | } 8 | 9 | build { 10 | name = "bucket-slug" 11 | hcp_packer_registry { 12 | bucket_name = "ok-Bucket-name-1" 13 | } 14 | 15 | sources = ["null.test"] 16 | } 17 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/top-level-empty-bucket.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | hcp_packer_registry { 6 | } 7 | 8 | build { 9 | name = "bucket-slug" 10 | sources = ["null.test"] 11 | } 12 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/top-level-invalid-bucket.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | hcp_packer_registry { 6 | bucket_name = "invalid_bucket" 7 | } 8 | 9 | build { 10 | name = "bucket-slug" 11 | sources = ["null.test"] 12 | } 13 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/top-level-invalid.pkr.hcl: -------------------------------------------------------------------------------- 1 | hcp_packer_registry { 2 | labels = "" 3 | } 4 | 5 | build { 6 | name = "bucket-slug" 7 | } 8 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/top-level-long-bucket.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | hcp_packer_registry { 5 | bucket_name = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" 6 | } 7 | 8 | build { 9 | name = "bucket-slug" 10 | sources = ["null.test"] 11 | } 12 | -------------------------------------------------------------------------------- /hcl2template/testdata/hcp_par/top-level-long-description.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | hcp_packer_registry { 6 | description = < 4 && substr(var.image_id, 0, 4) == "ami-" 7 | error_message = "The image_id value must be a valid AMI id, starting with \"ami-\"." 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /hcl2template/testdata/variables/validation/valid.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "image_id" { 3 | type = string 4 | default = "ami-something-something" 5 | validation { 6 | condition = length(var.image_id) > 4 && substr(var.image_id, 0, 4) == "ami-" 7 | error_message = "The image_id value must be a valid AMI id, starting with \"ami-\"." 8 | } 9 | } 10 | 11 | source "null" "test" { 12 | communicator = "none" 13 | } 14 | 15 | build { 16 | sources = ["null.test"] 17 | } 18 | -------------------------------------------------------------------------------- /hcl2template/testdata/variables/validation/valid_map/definition.pkr.hcl: -------------------------------------------------------------------------------- 1 | 2 | variable "image_metadata" { 3 | default = { 4 | key: "value", 5 | something: { 6 | foo: "bar", 7 | } 8 | } 9 | validation { 10 | condition = length(var.image_metadata.key) > 4 11 | error_message = "The image_metadata.key field must be more than 4 runes." 12 | } 13 | validation { 14 | condition = substr(var.image_metadata.something.foo, 0, 3) == "bar" 15 | error_message = "The image_metadata.something.foo field must start with \"bar\"." 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /hcl2template/testdata/variables/validation/valid_map/invalid_value.auto.pkrvars.hcl: -------------------------------------------------------------------------------- 1 | 2 | image_metadata = { 3 | key: "value", 4 | something: { 5 | foo: "woo", 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /hcl2template/types.build.from.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package hcl2template 5 | 6 | import ( 7 | "strings" 8 | ) 9 | 10 | func sourceRefFromString(in string) SourceRef { 11 | args := strings.Split(in, ".") 12 | if len(args) < 2 { 13 | return NoSource 14 | } 15 | if len(args) > 2 { 16 | // source.type.name 17 | args = args[1:] 18 | } 19 | return SourceRef{ 20 | Type: args[0], 21 | Name: args[1], 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /helper/wrappedreadline/wrappedreadline_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package wrappedreadline 5 | 6 | // getWidth impl for Solaris 7 | func getWidth() int { 8 | return 80 9 | } 10 | 11 | // get width of the terminal 12 | func getWidthFd(stdoutFd int) int { 13 | return getWidth() 14 | } 15 | -------------------------------------------------------------------------------- /helper/wrappedreadline/wrappedreadline_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | //go:build windows 5 | // +build windows 6 | 7 | package wrappedreadline 8 | 9 | // getWidth impl for other 10 | func getWidth() int { 11 | return 0 12 | } 13 | -------------------------------------------------------------------------------- /helper/wrappedstreams/streams_other.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | //go:build !windows 5 | // +build !windows 6 | 7 | package wrappedstreams 8 | 9 | import ( 10 | "os" 11 | "sync" 12 | ) 13 | 14 | var initOnce sync.Once 15 | 16 | func initPlatform() { 17 | // These must be initialized lazily, once it's been determined that this is 18 | // a wrapped process. 19 | initOnce.Do(func() { 20 | // The standard streams are passed in via extra file descriptors. 21 | wrappedStdin = os.NewFile(uintptr(3), "stdin") 22 | wrappedStdout = os.NewFile(uintptr(4), "stdout") 23 | wrappedStderr = os.NewFile(uintptr(5), "stderr") 24 | }) 25 | } 26 | -------------------------------------------------------------------------------- /internal/dag/edge_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package dag 5 | 6 | import ( 7 | "testing" 8 | ) 9 | 10 | func TestBasicEdgeHashcode(t *testing.T) { 11 | e1 := BasicEdge(1, 2) 12 | e2 := BasicEdge(1, 2) 13 | if e1.Hashcode() != e2.Hashcode() { 14 | t.Fatalf("bad") 15 | } 16 | } 17 | 18 | func TestBasicEdgeHashcode_pointer(t *testing.T) { 19 | type test struct { 20 | Value string 21 | } 22 | 23 | v1, v2 := &test{"foo"}, &test{"bar"} 24 | e1 := BasicEdge(v1, v2) 25 | e2 := BasicEdge(v1, v2) 26 | if e1.Hashcode() != e2.Hashcode() { 27 | t.Fatalf("bad") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /internal/hcp/env/variables.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package env 5 | 6 | const ( 7 | HCPClientID = "HCP_CLIENT_ID" 8 | HCPClientSecret = "HCP_CLIENT_SECRET" 9 | HCPProjectID = "HCP_PROJECT_ID" 10 | HCPOrganizationID = "HCP_ORGANIZATION_ID" 11 | HCPPackerRegistry = "HCP_PACKER_REGISTRY" 12 | HCPPackerBucket = "HCP_PACKER_BUCKET_NAME" 13 | HCPPackerBuildFingerprint = "HCP_PACKER_BUILD_FINGERPRINT" 14 | ) 15 | -------------------------------------------------------------------------------- /internal/hcp/registry/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package registry 5 | 6 | // ErrBuildAlreadyDone is the error returned by an HCP handler when a build cannot be started since it's already 7 | // marked as DONE. 8 | type ErrBuildAlreadyDone struct { 9 | Message string 10 | } 11 | 12 | // Error returns the message for the ErrBuildAlreadyDone type 13 | func (b ErrBuildAlreadyDone) Error() string { 14 | return b.Message 15 | } 16 | -------------------------------------------------------------------------------- /packer/builder_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package packer 5 | -------------------------------------------------------------------------------- /packer/cmd_hook_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package packer 5 | 6 | import ( 7 | "os/exec" 8 | "testing" 9 | ) 10 | 11 | func TestHook_NoExist(t *testing.T) { 12 | c := NewClient(&PluginClientConfig{Cmd: exec.Command("i-should-not-exist")}) 13 | defer c.Kill() 14 | 15 | _, err := c.Hook() 16 | if err == nil { 17 | t.Fatal("should have error") 18 | } 19 | } 20 | 21 | func TestHook_Good(t *testing.T) { 22 | c := NewClient(&PluginClientConfig{Cmd: helperProcess("hook")}) 23 | defer c.Kill() 24 | 25 | _, err := c.Hook() 26 | if err != nil { 27 | t.Fatalf("should not have error: %s", err) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packer/packer_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package packer 5 | 6 | import ( 7 | "path/filepath" 8 | ) 9 | 10 | const FixtureDir = "./test-fixtures" 11 | 12 | func fixtureDir(n string) string { 13 | return filepath.Join(FixtureDir, n) 14 | } 15 | -------------------------------------------------------------------------------- /packer/plugin-getter/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | // Package plugingetter defines means to download and install plugins. 5 | package plugingetter 6 | -------------------------------------------------------------------------------- /packer/plugin-getter/github/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | // Package github defines a Github getter. 5 | 6 | package github 7 | -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.3_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.3_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | 4e07408562bedb8b60ce05c1decfe3ad16b72230967de01f640b7e4729b49fce -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.3_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.3_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | 4e07408562bedb8b60ce05c1decfe3ad16b72230967de01f640b7e4729b49fce -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.3_x5.1_darwin_amd64: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.3_x5.1_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | 4e07408562bedb8b60ce05c1decfe3ad16b72230967de01f640b7e4729b49fce -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.4_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 4 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.4_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | 4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.4_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 4 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.4_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | 4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.5_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.5_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.5_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.5_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v2.0.0_x6.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 6 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v2.0.0_x6.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.6_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 6 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.6_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | 4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 6 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | e7f6c011776e8db7cd330b54174fd76f7d0216b612387a5ffcfb81e6f0919683 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.7_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 7 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.7_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | 4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.7_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 7 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.7_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | 7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.8_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 8 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.8_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | 4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.8_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 8 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins/github.com/hashicorp/google/packer-plugin-google_v4.5.8_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | 2c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a3 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/amazon/packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/amazon/packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/amazon/packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/google/packer-plugin-google_v4.5.6_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 6 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/google/packer-plugin-google_v4.5.6_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/google/packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 6 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/google/packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | e7f6c011776e8db7cd330b54174fd76f7d0216b612387a5ffcfb81e6f0919683 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/google/packer-plugin-google_v4.5.9_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 9 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/google/packer-plugin-google_v4.5.9_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/google/packer-plugin-google_v4.5.9_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 9 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp copy/google/packer-plugin-google_v4.5.9_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | 19581e27de7ced00ff1ce50b2047e7a567c76b1cbaebabe5ef03f7c3017bb5b7 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/google/packer-plugin-google_v4.5.6_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 6 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/google/packer-plugin-google_v4.5.6_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/google/packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 6 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/google/packer-plugin-google_v4.5.6_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | e7f6c011776e8db7cd330b54174fd76f7d0216b612387a5ffcfb81e6f0919683 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/google/packer-plugin-google_v4.5.9_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 9 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/google/packer-plugin-google_v4.5.9_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/google/packer-plugin-google_v4.5.9_x5.0_windows_amd64.exe: -------------------------------------------------------------------------------- 1 | 9 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_2/github.com/hashicorp/google/packer-plugin-google_v4.5.9_x5.0_windows_amd64.exe_SHA256SUM: -------------------------------------------------------------------------------- 1 | 19581e27de7ced00ff1ce50b2047e7a567c76b1cbaebabe5ef03f7c3017bb5b7 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_3/github.com/hashicorp/alazon/packer-plugin-alazon_v1.2.5_x5.0_linux_amd64: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_3/github.com/hashicorp/alazon/packer-plugin-alazon_v1.2.5_x5.0_linux_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_3/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.5_x5.0_linux_amd64: -------------------------------------------------------------------------------- 1 | 5 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/plugins_3/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.5_x5.0_linux_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/wrong_checksums/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.3_x5.0_darwin_amd64: -------------------------------------------------------------------------------- 1 | 3 -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/wrong_checksums/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.3_x5.0_darwin_amd64_SHA256SUM: -------------------------------------------------------------------------------- 1 | 1337408562bedb8b60ce05c1decfe3ad16b72230967de01f640b7e4729b49fce -------------------------------------------------------------------------------- /packer/plugin-getter/testdata/wrong_checksums/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/packer/plugin-getter/testdata/wrong_checksums/github.com/hashicorp/amazon/packer-plugin-amazon_v1.2.6_x5.1_darwin_amd64 -------------------------------------------------------------------------------- /packer/progressbar_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package packer 5 | 6 | import ( 7 | packersdk "github.com/hashicorp/packer-plugin-sdk/packer" 8 | ) 9 | 10 | type UiProgressBar = packersdk.NoopProgressTracker 11 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-basic-interpolated-required.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "name": null 4 | }, 5 | "builders": [{ 6 | "name": "{{upper `name`}}", 7 | "type": "test" 8 | }] 9 | } 10 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-basic-interpolated.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "name": "{{upper `name`}}", 4 | "type": "test" 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-basic.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test" 4 | }] 5 | } 6 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-env.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "var": "{{env `PACKER_TEST_ENV`}}" 4 | }, 5 | 6 | "builders": [{ 7 | "type": "test", 8 | "value": "{{user `var`}}" 9 | }] 10 | } 11 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-ignore-template-variable.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "var": "{{env `PACKER_TEST_ENV`}}_{{ .PACKER_TEST_TEMP }}", 4 | "http_ip": "{{ .HTTPIP }}", 5 | "array_var": "us-west-1,us-west-2" 6 | }, 7 | 8 | "builders": [{ 9 | "type": "test" 10 | }] 11 | } 12 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-interpolated-name.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "builders": [{ 4 | "type": "test", 5 | "name": "{{user `build_name`}}" 6 | }] 7 | } 8 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-names-basic.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | {"type": "something"} 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-names-func.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | {"type": "{{upper `tubes`}}"} 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-pp.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test" 4 | }], 5 | 6 | "post-processors": ["test"] 7 | } 8 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-prov-override.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test" 4 | }], 5 | 6 | "provisioners": [{ 7 | "type": "test", 8 | "override": { 9 | "test": { 10 | "foo": "bar" 11 | } 12 | } 13 | }] 14 | } 15 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-prov-retry.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test" 4 | }], 5 | 6 | "provisioners": [ 7 | { 8 | "type": "test-integer", 9 | "max_retries": 1 10 | }, 11 | { 12 | "type": "test-string", 13 | "max_retries": "1" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-prov-skip-include.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test" 4 | }], 5 | 6 | "provisioners": [{ 7 | "type": "test", 8 | "only": ["test"] 9 | }] 10 | } 11 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-prov-skip.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test" 4 | }, { 5 | "name": "foo", 6 | "type": "test" 7 | }], 8 | 9 | "provisioners": [{ 10 | "type": "test", 11 | "only": ["foo"] 12 | }] 13 | } 14 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-prov.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test" 4 | }], 5 | 6 | "provisioners": [{ 7 | "type": "test" 8 | }] 9 | } 10 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-split-func.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test", 4 | "value": "{{split \"foo-bar\" \"-\" 0}}" 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-template-path.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test", 4 | "value": "{{template_dir}}" 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-var-build-name.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test", 4 | "value": "{{build_name}}" 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-var-build-type.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "test", 4 | "value": "{{build_type}}" 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-var-file-interpolate.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{ user `my_var` }}" 3 | } -------------------------------------------------------------------------------- /packer/test-fixtures/build-var-file-interpolate2.json: -------------------------------------------------------------------------------- 1 | { 2 | "my_var": "interpolate this, yall" 3 | } -------------------------------------------------------------------------------- /packer/test-fixtures/build-var-packer-version.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "CreatedBy": "{{packer_version}}" 4 | }, 5 | "builders": [{ 6 | "type": "test", 7 | "value": "{{user `CreatedBy`}}" 8 | }] 9 | } 10 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-variables-interpolate.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "foo": "bar", 4 | "bar": "{{user `foo`}}", 5 | "baz": "{{user `bar`}}baz", 6 | "bang": "bang{{user `baz`}}" 7 | }, 8 | "builders": [ 9 | {"type": "foo"} 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /packer/test-fixtures/build-variables-interpolate2.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "bar": "{{user `foo`}}", 4 | "baz": "{{user `bar`}}baz", 5 | "bang": "bang{{user `baz`}}" 6 | }, 7 | "builders": [ 8 | {"type": "foo"} 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packer/test-fixtures/complex-recursed-env-user-var-file.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "env_1": "{{ env `INTERPOLATE_TEST_ENV_1` }}", 4 | "env_2": "{{ env `INTERPOLATE_TEST_ENV_2` }}", 5 | "env_3": "{{ env `INTERPOLATE_TEST_ENV_3` }}", 6 | "env_4": "{{ env `INTERPOLATE_TEST_ENV_4` }}" 7 | }, 8 | "builders": [{ 9 | "type": "test" 10 | }] 11 | } -------------------------------------------------------------------------------- /packer/test-fixtures/push-vars.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "foo": null 4 | }, 5 | 6 | "builders": [{"type": "test"}], 7 | 8 | "push": { 9 | "name": "{{user `foo`}}" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packer/test-fixtures/sensitive-variables.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "foo": "bar_extra_sensitive_probably_a_password" 4 | }, 5 | "sensitive-variables": [ 6 | "foo" 7 | ], 8 | "builders": [{ 9 | "type": "test", 10 | "value": "{{build_name}}" 11 | }] 12 | } 13 | -------------------------------------------------------------------------------- /packer/test-fixtures/validate-dup-builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | {"type": "foo"} 4 | ], 5 | 6 | "provisioners": [{ 7 | "type": "foo", 8 | "only": ["bar"] 9 | }] 10 | } 11 | -------------------------------------------------------------------------------- /packer/test-fixtures/validate-min-version-high.json: -------------------------------------------------------------------------------- 1 | { 2 | "min_packer_version": "2.1.0", 3 | 4 | "builders": [ 5 | {"type": "foo"} 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packer/test-fixtures/validate-min-version.json: -------------------------------------------------------------------------------- 1 | { 2 | "min_packer_version": "0.1.0", 3 | 4 | "builders": [ 5 | {"type": "foo"} 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packer/test-fixtures/validate-req-variable.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": { 3 | "foo": null 4 | }, 5 | 6 | "builders": [{ 7 | "type": "foo" 8 | }] 9 | } 10 | -------------------------------------------------------------------------------- /packer_test/common/plugin_tester/README.md: -------------------------------------------------------------------------------- 1 | # Packer Test Plugin 2 | 3 | This directory is meant to be a minimal plugin that we can use for testing Packer. 4 | Any components defined in this plugin are not for use, as they virtually do nothing, and are only here to test Packer's core capabilitities 5 | 6 | -------------------------------------------------------------------------------- /packer_test/common/plugin_tester/builder/dynamic/test-fixtures/template.pkr.hcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: MPL-2.0 3 | 4 | source "scaffolding-my-builder" "basic-example" { 5 | mock = "mock-config" 6 | } 7 | 8 | build { 9 | sources = [ 10 | "source.scaffolding-my-builder.basic-example" 11 | ] 12 | 13 | provisioner "shell-local" { 14 | inline = [ 15 | "echo build generated data: ${build.GeneratedMockData}", 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packer_test/common/plugin_tester/datasource/dynamic/test-fixtures/template.pkr.hcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: MPL-2.0 3 | 4 | data "scaffolding-my-datasource" "test" { 5 | mock = "mock-config" 6 | } 7 | 8 | locals { 9 | foo = data.scaffolding-my-datasource.test.foo 10 | bar = data.scaffolding-my-datasource.test.bar 11 | } 12 | 13 | source "null" "basic-example" { 14 | communicator = "none" 15 | } 16 | 17 | build { 18 | sources = [ 19 | "source.null.basic-example" 20 | ] 21 | 22 | provisioner "shell-local" { 23 | inline = [ 24 | "echo foo: ${local.foo}", 25 | "echo bar: ${local.bar}", 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packer_test/common/plugin_tester/example/data.pkr.hcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: MPL-2.0 3 | 4 | data "scaffolding-my-datasource" "mock-data" { 5 | mock = "mock-config" 6 | } -------------------------------------------------------------------------------- /packer_test/common/plugin_tester/example/variables.pkr.hcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: MPL-2.0 3 | 4 | locals { 5 | foo = data.scaffolding-my-datasource.mock-data.foo 6 | bar = data.scaffolding-my-datasource.mock-data.bar 7 | } -------------------------------------------------------------------------------- /packer_test/common/plugin_tester/post-processor/dynamic/test-fixtures/template.pkr.hcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: MPL-2.0 3 | 4 | source "null" "basic-example" { 5 | communicator = "none" 6 | } 7 | 8 | build { 9 | sources = [ 10 | "source.null.basic-example" 11 | ] 12 | 13 | post-processor "scaffolding-my-post-processor" { 14 | mock = "my-mock-config" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packer_test/common/plugin_tester/provisioner/dynamic/test-fixtures/template.pkr.hcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) HashiCorp, Inc. 2 | # SPDX-License-Identifier: MPL-2.0 3 | 4 | source "null" "basic-example" { 5 | communicator = "none" 6 | } 7 | 8 | build { 9 | sources = [ 10 | "source.null.basic-example" 11 | ] 12 | 13 | provisioner "scaffolding-my-provisioner" { 14 | mock = "my-mock-config" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packer_test/core_tests/suite_test.go: -------------------------------------------------------------------------------- 1 | package core_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/hashicorp/packer/packer_test/common" 7 | "github.com/stretchr/testify/suite" 8 | ) 9 | 10 | type PackerCoreTestSuite struct { 11 | *common.PackerTestSuite 12 | } 13 | 14 | func Test_PackerCoreSuite(t *testing.T) { 15 | baseSuite, cleanup := common.InitBaseSuite(t) 16 | defer cleanup() 17 | 18 | ts := &PackerCoreTestSuite{ 19 | baseSuite, 20 | } 21 | 22 | suite.Run(t, ts) 23 | } 24 | -------------------------------------------------------------------------------- /packer_test/core_tests/templates/locals_duplicate.pkr.hcl: -------------------------------------------------------------------------------- 1 | local "test" { 2 | expression = "two" 3 | sensitive = true 4 | } 5 | 6 | locals { 7 | test = local.test 8 | } 9 | 10 | variable "test" { 11 | type = string 12 | default = "home" 13 | } 14 | source "null" "example" {} 15 | 16 | build { 17 | sources = ["source.null.example"] 18 | } 19 | -------------------------------------------------------------------------------- /packer_test/core_tests/templates/locals_no_order.pkr.hcl: -------------------------------------------------------------------------------- 1 | locals { 2 | test_local = can(local.test_data) ? local.test_data : [] 3 | 4 | test_data = [ 5 | { key = "value" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packer_test/dag_tests/suite_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/hashicorp/packer/packer_test/common" 7 | "github.com/stretchr/testify/suite" 8 | ) 9 | 10 | type PackerDAGTestSuite struct { 11 | *common.PackerTestSuite 12 | } 13 | 14 | func Test_PackerDAGSuite(t *testing.T) { 15 | baseSuite, cleanup := common.InitBaseSuite(t) 16 | defer cleanup() 17 | 18 | ts := &PackerDAGTestSuite{ 19 | baseSuite, 20 | } 21 | 22 | suite.Run(t, ts) 23 | } 24 | -------------------------------------------------------------------------------- /packer_test/dag_tests/templates/mixed_data_local.pkr.hcl: -------------------------------------------------------------------------------- 1 | data "null" "head" { 2 | input = "foo" 3 | } 4 | 5 | locals { 6 | loc = "${data.null.head.output}" 7 | } 8 | 9 | data "null" "tail" { 10 | input = "${local.loc}" 11 | } 12 | 13 | locals { 14 | last = "final - ${data.null.tail.output}" 15 | } 16 | 17 | source "null" "test" { 18 | communicator = "none" 19 | } 20 | 21 | build { 22 | sources = ["null.test"] 23 | } 24 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/sample_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "disable_checkpoint": true, 3 | "disable_checkpoint_signature": true, 4 | "provisioners": { 5 | "super-shell": "packer-provisioner-super-shell" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/init/hashicups.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "github.com/hashicorp/hashicups" 5 | version = ">= 1.0.2" 6 | } 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/init/mixed_versions.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "github.com/mondoohq/cnspec" 5 | version = "= 10.7.3" # plugin describe reports 10.7.x-dev so init must fail 6 | } 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/init/non_gh.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "hubgit.com/hashicorp/tester" 5 | version = ">= 1.0.9" 6 | } 7 | } 8 | } 9 | 10 | source "tester-dynamic" "test" {} 11 | 12 | build { 13 | sources = ["tester-dynamic.test"] 14 | } 15 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/internal_only.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "null" "test" { 2 | communicator = "none" 3 | } 4 | 5 | build { 6 | sources = ["null.test"] 7 | } 8 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/pin_1.0.9.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "github.com/hashicorp/tester" 5 | version = "= 1.0.9" 6 | } 7 | } 8 | } 9 | 10 | source "tester-dynamic" "test" {} 11 | 12 | build { 13 | sources = ["tester-dynamic.test"] 14 | } 15 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/pre-release_constraint.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "github.com/hashicorp/hashicups" 5 | version = "= 1.0.2-dev" 6 | } 7 | } 8 | } 9 | 10 | source "tester-dynamic" "test" {} 11 | 12 | build { 13 | sources = ["tester-dynamic.test"] 14 | } 15 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [{ 3 | "type": "tester-dynamic", 4 | "name": "test" 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/simple.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "github.com/hashicorp/tester" 5 | version = ">= 1.0.0" 6 | } 7 | } 8 | } 9 | 10 | source "tester-dynamic" "test" {} 11 | 12 | build { 13 | sources = ["tester-dynamic.test"] 14 | } 15 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/test_both_plugins.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "github.com/hashicorp/tester", 5 | version = ">= 1.0.0" 6 | } 7 | pbtester = { 8 | source = "github.com/hashicorp/pbtester", 9 | version = ">= 1.0.0" 10 | } 11 | } 12 | } 13 | 14 | source "tester-dynamic" "test" {} 15 | source "pbtester-dynamic" "test" {} 16 | 17 | build { 18 | sources = [ 19 | "tester-dynamic.test", 20 | "pbtester-dynamic.test" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/test_one_pinned_plugin.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "github.com/hashicorp/tester", 5 | version = "= 1.0.0" 6 | } 7 | } 8 | } 9 | 10 | source "tester-dynamic" "test" {} 11 | 12 | build { 13 | sources = [ 14 | "tester-dynamic.test", 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packer_test/plugin_tests/templates/test_one_plugin.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | tester = { 4 | source = "github.com/hashicorp/tester", 5 | version = ">= 1.0.0" 6 | } 7 | } 8 | } 9 | 10 | source "tester-dynamic" "test" {} 11 | 12 | build { 13 | sources = [ 14 | "tester-dynamic.test", 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/hcp-sbom/suite_test.go: -------------------------------------------------------------------------------- 1 | package plugin_tests 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/hashicorp/packer/packer_test/common" 7 | "github.com/stretchr/testify/suite" 8 | ) 9 | 10 | type PackerHCPSbomTestSuite struct { 11 | *common.PackerTestSuite 12 | } 13 | 14 | func Test_PackerPluginSuite(t *testing.T) { 15 | baseSuite, cleanup := common.InitBaseSuite(t) 16 | defer cleanup() 17 | 18 | ts := &PackerHCPSbomTestSuite{ 19 | baseSuite, 20 | } 21 | 22 | suite.Run(t, ts) 23 | } 24 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/hcp-sbom/templates/source_is_dir.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | docker = { 4 | version = ">= 1.0.0" 5 | source = "github.com/hashicorp/docker" 6 | } 7 | } 8 | } 9 | 10 | source "docker" "ubuntu" { 11 | image = "ubuntu:20.04" 12 | commit = true 13 | } 14 | 15 | build { 16 | sources = ["source.docker.ubuntu"] 17 | 18 | provisioner "hcp-sbom" { 19 | source = "/tmp" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/hcp-sbom/templates/source_not_existing.pkr.hcl: -------------------------------------------------------------------------------- 1 | packer { 2 | required_plugins { 3 | docker = { 4 | version = ">= 1.0.0" 5 | source = "github.com/hashicorp/docker" 6 | } 7 | } 8 | } 9 | 10 | source "docker" "ubuntu" { 11 | image = "ubuntu:20.04" 12 | commit = true 13 | } 14 | 15 | build { 16 | sources = ["source.docker.ubuntu"] 17 | 18 | provisioner "hcp-sbom" { 19 | source = "/tmp/sbom_cyclonedx.json" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/shell/suite_test.go: -------------------------------------------------------------------------------- 1 | package plugin_tests 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/hashicorp/packer/packer_test/common" 7 | "github.com/stretchr/testify/suite" 8 | ) 9 | 10 | type PackerShellProvisionerTestSuite struct { 11 | *common.PackerTestSuite 12 | } 13 | 14 | func Test_PackerPluginSuite(t *testing.T) { 15 | baseSuite, cleanup := common.InitBaseSuite(t) 16 | defer cleanup() 17 | 18 | ts := &PackerShellProvisionerTestSuite{ 19 | baseSuite, 20 | } 21 | 22 | suite.Run(t, ts) 23 | } 24 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/shell/templates/empty_inline_list.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "docker" "test" { 2 | image = "debian:bookworm" 3 | discard = true 4 | } 5 | 6 | build { 7 | sources = ["docker.test"] 8 | 9 | provisioner "shell" { 10 | inline = [] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/shell/templates/no_shebang_in_script.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "docker" "test" { 2 | image = "debian:bookworm" 3 | discard = true 4 | } 5 | 6 | build { 7 | sources = ["docker.test"] 8 | 9 | provisioner "shell" { 10 | inline = [ 11 | "cat $0 | head -1 | grep -E '^#!/bin/sh -e'", 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/shell/templates/no_shebang_inline_but_as_option.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "docker" "test" { 2 | image = "debian:bookworm" 3 | discard = true 4 | } 5 | 6 | build { 7 | sources = ["docker.test"] 8 | 9 | provisioner "shell" { 10 | inline_shebang = "/bin/bash -ex" 11 | inline = [ 12 | "head -1 <\"$0\" | grep -qE '^#!/bin/bash'", 13 | "if grep -qE \"^#!/bin/sh\" <\"$0\"; then exit 1; fi", 14 | "cat \"$0\"" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/shell/templates/shebang_as_option.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "docker" "test" { 2 | image = "debian:bookworm" 3 | discard = true 4 | } 5 | 6 | build { 7 | sources = ["docker.test"] 8 | 9 | provisioner "shell" { 10 | inline_shebang = "/bin/bash -ex" 11 | inline = [ 12 | "#!/bin/sh", 13 | "cat \"$0\" | head -1 | grep -qE '^#!/bin/bash'", 14 | "cat \"$0\"" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/shell/templates/shebang_as_option_invalid.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "docker" "test" { 2 | image = "debian:bookworm" 3 | discard = true 4 | } 5 | 6 | build { 7 | sources = ["docker.test"] 8 | 9 | provisioner "shell" { 10 | inline_shebang = "#!/bin/bash -ex" 11 | inline = [ 12 | "head -1 <\"$0\" | grep -qE '^#!/bin/bash'", 13 | "if grep -qE \"^#!/bin/sh\" <\"$0\"; then exit 1; fi", 14 | "cat \"$0\"" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packer_test/provisioner_tests/shell/templates/shebang_in_inline.pkr.hcl: -------------------------------------------------------------------------------- 1 | source "docker" "test" { 2 | image = "debian:bookworm" 3 | discard = true 4 | } 5 | 6 | build { 7 | sources = ["docker.test"] 8 | 9 | provisioner "shell" { 10 | inline = [ 11 | "#!/bin/bash -e", 12 | "cat $0 | head -1 | grep -E '#!/bin/bash -e'" 13 | ] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /post-processor/artifice/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var ArtificePluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | ArtificePluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /post-processor/checksum/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var ChecksumPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | ChecksumPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /post-processor/compress/artifact_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package compress 5 | 6 | import ( 7 | "testing" 8 | 9 | packersdk "github.com/hashicorp/packer-plugin-sdk/packer" 10 | ) 11 | 12 | func TestArtifact_ImplementsArtifact(t *testing.T) { 13 | var raw interface{} 14 | raw = &Artifact{} 15 | if _, ok := raw.(packersdk.Artifact); !ok { 16 | t.Fatalf("Artifact should be a Artifact!") 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /post-processor/compress/notes.txt: -------------------------------------------------------------------------------- 1 | * 1.9.6 => GNU tar format 2 | * 1.10.3 w/ patch => GNU tar format 3 | * 1.10.3 w/o patch => Posix tar format 4 | -------------------------------------------------------------------------------- /post-processor/compress/tar_fix.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | //go:build !go1.10 5 | // +build !go1.10 6 | 7 | package compress 8 | 9 | import "archive/tar" 10 | 11 | func setHeaderFormat(header *tar.Header) { 12 | // no-op 13 | } 14 | -------------------------------------------------------------------------------- /post-processor/compress/tar_fix_go110.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | //go:build go1.10 5 | // +build go1.10 6 | 7 | package compress 8 | 9 | import ( 10 | "archive/tar" 11 | "time" 12 | ) 13 | 14 | func setHeaderFormat(header *tar.Header) { 15 | // We have to set the Format explicitly for the googlecompute-import 16 | // post-processor. Google Cloud only allows importing GNU tar format. 17 | header.Format = tar.FormatGNU 18 | header.AccessTime = time.Time{} 19 | header.ModTime = time.Time{} 20 | header.ChangeTime = time.Time{} 21 | } 22 | -------------------------------------------------------------------------------- /post-processor/compress/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var CompressPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | CompressPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /post-processor/manifest/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var ManifestPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | ManifestPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /post-processor/shell-local/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var ShellLocalPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | ShellLocalPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/breakpoint/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var BreakpointPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | BreakpointPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/file/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var FileProvisionerVersion *version.PluginVersion 12 | 13 | func init() { 14 | FileProvisionerVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/hcp-sbom/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var HCPSBOMPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | HCPSBOMPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/powershell/execution_policy_test.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package powershell 5 | 6 | import ( 7 | "testing" 8 | ) 9 | 10 | func TestExecutionPolicy_Decode(t *testing.T) { 11 | config := map[string]interface{}{ 12 | "inline": []interface{}{"foo", "bar"}, 13 | "execution_policy": "allsigned", 14 | } 15 | p := new(Provisioner) 16 | err := p.Prepare(config) 17 | if err != nil { 18 | t.Fatal(err) 19 | } 20 | 21 | if p.config.ExecutionPolicy != ExecutionPolicyAllsigned { 22 | t.Fatalf("Expected AllSigned execution policy; got: %s", p.config.ExecutionPolicy) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /provisioner/powershell/test-fixtures/powershell-inline-provisioner.txt: -------------------------------------------------------------------------------- 1 | { 2 | "type": "powershell", 3 | "environment_vars": "PackerRunUUID={{build `PackerRunUUID`}},ID={{build `ID`}},TEST_ENV_VAR=TestValue", 4 | "inline": [ 5 | "Write-Host \"$env:ID for provisioner.$env:PackerRunUUID build_name: $env:packer_build_name, test_env_var: $env:test_env_var\"", 6 | "setx BUILD_AMI_VERSION \"1.0.0\"", 7 | "setx BUILD_AMI_NAME custom_ami_name", 8 | "setx BUILD_AMI_DESCRIPTION \"This is a custom AMI created for testing purposes\"" 9 | ] 10 | } -------------------------------------------------------------------------------- /provisioner/powershell/test-fixtures/powershell-provisioner-cleanup.txt: -------------------------------------------------------------------------------- 1 | { 2 | "type": "powershell", 3 | "remote_path": "c:/Windows/Temp/packer-acc-test-script-test.ps1", 4 | "remote_env_var_path": "C:/Windows/Temp/packer-acc-test-vars.ps1", 5 | "inline": [ 6 | "Write-Host \"Total files found in Temp directory\" ( dir C:/Windows/Temp/packer-*.ps1 | measure).Count;" 7 | ] 8 | }, 9 | { 10 | "type": "windows-shell", 11 | "inline": ["dir C:\\Windows\\Temp\\packer-*.ps1"], 12 | "valid_exit_codes": ["1"] 13 | } 14 | -------------------------------------------------------------------------------- /provisioner/powershell/test-fixtures/powershell-script-provisioner.txt: -------------------------------------------------------------------------------- 1 | { 2 | "type": "powershell", 3 | "script": "../../provisioner/powershell/test-fixtures/scripts/sample_script.ps1", 4 | "environment_vars": [ 5 | "VAR1=A$Dollar", 6 | "VAR2=A`Backtick", 7 | "VAR3=A'SingleQuote", 8 | "VAR4=A\"DoubleQuote" 9 | ] 10 | } 11 | 12 | -------------------------------------------------------------------------------- /provisioner/powershell/test-fixtures/scripts/sample_script.ps1: -------------------------------------------------------------------------------- 1 | write-output("packer_build_name is automatically set for you, or you can set it in your builder variables; the default for this builder is: " + $env:packer_build_name ) 2 | write-output("remember that escaping variables in powershell requires backticks; for example var1 from our config is " + $env:var1 ) 3 | write-output("likewise, var2 is " + $env:var2 ) 4 | write-output("and var3 is " + $env:var3 ) 5 | 6 | -------------------------------------------------------------------------------- /provisioner/powershell/test-fixtures/scripts/set_version_latest.ps1: -------------------------------------------------------------------------------- 1 | # Test fixture is a modified version of the example found at 2 | # https://www.powershellmagazine.com/2012/10/23/pstip-set-strictmode-why-should-you-care/ 3 | 4 | Set-StrictMode -Version Latest 5 | $ErrorActionPreference = "Stop" 6 | 7 | $myNumbersCollection = 1..5 8 | if($myNumbersCollection -contains 3) { 9 | "collection contains 3" 10 | } 11 | else { 12 | "collection doesn't contain 3" 13 | } -------------------------------------------------------------------------------- /provisioner/powershell/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var PowershellPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | PowershellPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/shell-local/test-fixtures/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # On first try, exits 1; on second try, passes. 4 | if [[ ! -f test-fixtures/file.txt ]] ; then 5 | echo 'hello' > test-fixtures/file.txt 6 | exit 1 7 | fi -------------------------------------------------------------------------------- /provisioner/shell-local/test-fixtures/shell-local-provisioner.txt: -------------------------------------------------------------------------------- 1 | { 2 | "type": "shell-local", 3 | "script": "test-fixtures/script.sh", 4 | "max_retries" : 5 5 | } -------------------------------------------------------------------------------- /provisioner/shell-local/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var ShellLocalProvisionerVersion *version.PluginVersion 12 | 13 | func init() { 14 | ShellLocalProvisionerVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/shell/test-fixtures/shell-provisioner.txt: -------------------------------------------------------------------------------- 1 | { 2 | "type": "shell", 3 | "inline": [ 4 | "echo build ID is {{ build `ID`}} and build UUID is {{ build `PackerRunUUID` }}> provisioner.{{ build `PackerRunUUID`}}.txt" 5 | ] 6 | }, 7 | { 8 | "type": "file", 9 | "source": "provisioner.{{ build `PackerRunUUID`}}.txt", 10 | "destination": "./test-fixtures/provisioner.shell.txt", 11 | "direction": "download" 12 | } -------------------------------------------------------------------------------- /provisioner/shell/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var ShellPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | ShellPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/sleep/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var SleepProvisionerVersion *version.PluginVersion 12 | 13 | func init() { 14 | SleepProvisionerVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/windows-restart/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var WindowsRestartPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | WindowsRestartPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /provisioner/windows-shell/version/version.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package version 5 | 6 | import ( 7 | "github.com/hashicorp/packer-plugin-sdk/version" 8 | packerVersion "github.com/hashicorp/packer/version" 9 | ) 10 | 11 | var WindowsShellPluginVersion *version.PluginVersion 12 | 13 | func init() { 14 | WindowsShellPluginVersion = version.NewPluginVersion( 15 | packerVersion.Version, packerVersion.VersionPrerelease, packerVersion.VersionMetadata) 16 | } 17 | -------------------------------------------------------------------------------- /scripts/off_gopath.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | # Copyright (c) HashiCorp, Inc. 3 | # SPDX-License-Identifier: BUSL-1.1 4 | 5 | 6 | set -eu -o pipefail 7 | 8 | gpath=${GOPATH:-} 9 | if [ -z "$gpath" ]; then 10 | gpath=$HOME/go 11 | fi 12 | 13 | reldir=`dirname $0` 14 | curdir=`pwd` 15 | cd $reldir 16 | CUR_GO_DIR=`pwd` 17 | cd $curdir 18 | 19 | if [[ $CUR_GO_DIR == *"$gpath"* ]]; then 20 | # echo "You're on the gopath" 21 | exit 1 22 | else 23 | # echo "You're not on the gopath" 24 | exit 0 25 | fi -------------------------------------------------------------------------------- /scripts/vagrant-freebsd-unpriv-bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) HashiCorp, Inc. 3 | # SPDX-License-Identifier: BUSL-1.1 4 | 5 | 6 | export GOPATH=/opt/gopath 7 | 8 | PATH=$GOPATH/bin:$PATH 9 | export PATH 10 | 11 | cd /opt/gopath/src/github.com/hashicorp/packer && gmake deps 12 | -------------------------------------------------------------------------------- /scripts/vagrant-linux-priv-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) HashiCorp, Inc. 3 | # SPDX-License-Identifier: BUSL-1.1 4 | 5 | 6 | export DEBIAN_FRONTEND=noninteractive 7 | 8 | # Update and ensure we have apt-add-repository 9 | apt-get update 10 | apt-get install -y software-properties-common 11 | 12 | apt-get install -y bzr \ 13 | curl \ 14 | gcc \ 15 | git \ 16 | make \ 17 | mercurial \ 18 | zip 19 | 20 | # Ensure we cd into the working directory on login 21 | if ! grep "cd /opt/gopath/src/github.com/hashicorp/packer" /home/vagrant/.profile ; then 22 | echo 'cd /opt/gopath/src/github.com/hashicorp/packer' >> /home/vagrant/.profile 23 | fi 24 | -------------------------------------------------------------------------------- /scripts/vagrant-linux-unpriv-bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) HashiCorp, Inc. 3 | # SPDX-License-Identifier: BUSL-1.1 4 | 5 | 6 | cd /opt/gopath/src/github.com/hashicorp/packer && make dev 7 | -------------------------------------------------------------------------------- /tty.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | //go:build !solaris 5 | // +build !solaris 6 | 7 | package main 8 | 9 | import ( 10 | "github.com/mattn/go-tty" 11 | ) 12 | 13 | var openTTY = tty.Open 14 | -------------------------------------------------------------------------------- /tty_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) HashiCorp, Inc. 2 | // SPDX-License-Identifier: BUSL-1.1 3 | 4 | package main 5 | 6 | import ( 7 | "fmt" 8 | 9 | packersdk "github.com/hashicorp/packer-plugin-sdk/packer" 10 | ) 11 | 12 | func openTTY() (packersdk.TTY, error) { 13 | return nil, fmt.Errorf("no TTY available on solaris") 14 | } 15 | -------------------------------------------------------------------------------- /version/VERSION: -------------------------------------------------------------------------------- 1 | 1.13.2-dev 2 | -------------------------------------------------------------------------------- /website/.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [Makefile] 15 | indent_style = tab 16 | 17 | [{*.md,*.json}] 18 | max_line_length = null 19 | -------------------------------------------------------------------------------- /website/.env: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_ALGOLIA_APP_ID=YY0FFNI7MF 2 | NEXT_PUBLIC_ALGOLIA_INDEX=product_PACKER 3 | NEXT_PUBLIC_ALGOLIA_SEARCH_ONLY_API_KEY=4e1ea7f4bf4335ac43d9f28463e42148 4 | -------------------------------------------------------------------------------- /website/.env.production: -------------------------------------------------------------------------------- 1 | HASHI_ENV=production 2 | -------------------------------------------------------------------------------- /website/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('@hashicorp/platform-cli/config/.eslintrc'), 3 | ignorePatterns: ['public/'] 4 | } 5 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | .next 4 | out 5 | .mdx-data 6 | 7 | # As per Next.js conventions (https://nextjs.org/docs/basic-features/environment-variables#default-environment-variables) 8 | !.env 9 | .env*.local 10 | 11 | website-preview 12 | -------------------------------------------------------------------------------- /website/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | cd website 2 | 3 | npx next-hashicorp precommit -------------------------------------------------------------------------------- /website/.nvmrc: -------------------------------------------------------------------------------- 1 | v18 2 | -------------------------------------------------------------------------------- /website/.stylelintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('@hashicorp/platform-cli/config/stylelint.config'), 3 | /* Specify overrides here */ 4 | } 5 | -------------------------------------------------------------------------------- /website/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.mirror.hashicorp.services/node:18.18.2-alpine 2 | RUN apk add --update --no-cache git make g++ automake autoconf libtool nasm libpng-dev 3 | 4 | COPY ./package.json /website/package.json 5 | COPY ./package-lock.json /website/package-lock.json 6 | WORKDIR /website 7 | RUN npm install -g npm@latest 8 | RUN npm install 9 | -------------------------------------------------------------------------------- /website/LICENSE.md: -------------------------------------------------------------------------------- 1 | # Proprietary License 2 | 3 | This license is temporary while a more official one is drafted. However, 4 | this should make it clear: 5 | 6 | The text contents of this website are MPL 2.0 licensed. 7 | 8 | The design contents of this website are proprietary and may not be reproduced 9 | or reused in any way other than to run the website locally. The license for 10 | the design is owned solely by HashiCorp, Inc. 11 | -------------------------------------------------------------------------------- /website/content/docs/post-processors/community-supported.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | description: > 3 | Community-maintained post-processors are not part of the core Packer binary. You can run community post-processors with Packer post-processors. 4 | page_title: Community post-processors overview 5 | --- 6 | 7 | # Community Post-processors Overview 8 | 9 | The following post-processors are developed and maintained by various members of the 10 | Packer community, not by HashiCorp. For more information on how to use community 11 | post-processors, refer to our documentation on [extending Packer](/packer/docs/plugins/creation). 12 | 13 | @include 'post-processors/community_post-processors.mdx' 14 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/blocks/data.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | description: > 3 | The `data` block defines data sources within your Packer configuration. Learn how to configure `data` blocks. 4 | page_title: data block referenece 5 | --- 6 | 7 | # `data` block 8 | 9 | The `data` block defines data sources within your Packer configuration. The following example instructs Packer to query the `amazon-ami` data source for information to use in the template. 10 | 11 | `@include 'from-1.5/datasources/example-block.mdx'` 12 | 13 | Refer to [Data Sources](/packer/docs/templates/hcl_templates/datasources) for instructions about using the `data` block in your configuration. 14 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/collection/compact.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: compact function reference 3 | description: The `compact` function removes empty string elements from a list. Learn how to use the `compact` function in Packer templates. 4 | --- 5 | 6 | # `compact` Function 7 | 8 | `compact` takes a list of strings and returns a new list with any empty string 9 | elements removed. 10 | 11 | ## Examples 12 | 13 | ```shell-session 14 | > compact(["a", "", "b", "c"]) 15 | [ 16 | "a", 17 | "b", 18 | "c", 19 | ] 20 | ``` 21 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/collection/concat.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: concat function reference 3 | description: The `concat` function combines two or more lists into a single list. Learn how to use the `concat` function in Packer templates. 4 | --- 5 | 6 | # `concat` Function 7 | 8 | `concat` takes two or more lists and combines them into a single list. 9 | 10 | ## Examples 11 | 12 | ```shell-session 13 | > concat(["a", ""], ["b", "c"]) 14 | [ 15 | "a", 16 | "", 17 | "b", 18 | "c", 19 | ] 20 | ``` 21 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/collection/contains.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: contains function reference 3 | description: The `contains` function determines whether a list or set contains a given value. Learn how to use the `contains` function in Packer templates. 4 | --- 5 | 6 | # `contains` Function 7 | 8 | `contains` determines whether a given list or set contains a given single value 9 | as one of its elements. 10 | 11 | ```hcl 12 | contains(list, value) 13 | ``` 14 | 15 | ## Examples 16 | 17 | ```shell-session 18 | > contains(["a", "b", "c"], "a") 19 | true 20 | > contains(["a", "b", "c"], "d") 21 | false 22 | ``` 23 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/collection/distinct.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: distinct function reference 3 | description: The `distinct` function removes duplicate elements from a list. Learn how to use the `distince` function in Packer templates. 4 | --- 5 | 6 | # `distinct` Function 7 | 8 | `distinct` takes a list and returns a new list with any duplicate elements 9 | removed. 10 | 11 | The first occurrence of each value is retained and the relative ordering of 12 | these elements is preserved. 13 | 14 | ## Examples 15 | 16 | ```shell-session 17 | > distinct(["a", "b", "a", "c", "d", "b"]) 18 | [ 19 | "a", 20 | "b", 21 | "c", 22 | "d", 23 | ] 24 | ``` 25 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/numeric/abs.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: abs function reference 3 | description: The `abs` function returns the absolute value of the given number. 4 | --- 5 | 6 | # `abs` Function 7 | 8 | `abs` returns the absolute value of the given number. In other words, if the 9 | number is zero or positive then it is returned as-is, but if it is negative 10 | then it is multiplied by -1 to make it positive before returning it. 11 | 12 | ## Examples 13 | 14 | ```shell-session 15 | > abs(23) 16 | 23 17 | > abs(0) 18 | 0 19 | > abs(-12.4) 20 | 12.4 21 | ``` 22 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/numeric/ceil.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: ceil function reference 3 | description: |- 4 | The `ceil` function returns the closest whole number greater than or equal to 5 | the given value. 6 | --- 7 | 8 | # `ceil` Function 9 | 10 | `ceil` returns the closest whole number that is greater than or equal to the 11 | given value, which may be a fraction. 12 | 13 | ## Examples 14 | 15 | ```shell-session 16 | > ceil(5) 17 | 5 18 | > ceil(5.1) 19 | 6 20 | ``` 21 | 22 | ## Related Functions 23 | 24 | - [`floor`](/packer/docs/templates/hcl_templates/functions/numeric/floor), which rounds to the nearest whole number _less than_ 25 | or equal. 26 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/numeric/floor.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: floor function reference 3 | description: |- 4 | The `floor` function returns the closest whole number less than or equal to 5 | the given value. 6 | --- 7 | 8 | # `floor` Function 9 | 10 | `floor` returns the closest whole number that is less than or equal to the 11 | given value, which may be a fraction. 12 | 13 | ## Examples 14 | 15 | ```shell-session 16 | > floor(5) 17 | 5 18 | > floor(4.9) 19 | 4 20 | ``` 21 | 22 | ## Related Functions 23 | 24 | - [`ceil`](/packer/docs/templates/hcl_templates/functions/numeric/ceil), which rounds to the nearest whole number _greater than_ 25 | or equal. 26 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/numeric/pow.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: pow function reference 3 | description: The `pow` function raises a number to a power. 4 | --- 5 | 6 | # `pow` Function 7 | 8 | `pow` calculates an exponent, by raising its first argument to the power of the second argument. 9 | 10 | ## Examples 11 | 12 | ```shell-session 13 | > pow(3, 2) 14 | 9 15 | > pow(4, 0) 16 | 1 17 | ``` 18 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/numeric/signum.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: signum function reference 3 | description: The `signum` function determines the sign of a number. 4 | --- 5 | 6 | # `signum` Function 7 | 8 | `signum` determines the sign of a number, returning a number between -1 and 9 | 1 to represent the sign. 10 | 11 | ## Examples 12 | 13 | ```shell-session 14 | > signum(-13) 15 | -1 16 | > signum(0) 17 | 0 18 | > signum(344) 19 | 1 20 | ``` 21 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/numeric/sum.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: sum - Functions - Configuration Language 3 | description: The sum function takes a list or set of numbers and returns the sum of those numbers. 4 | --- 5 | 6 | # `sum` Function 7 | 8 | `sum` takes a list or set of numbers and returns the sum of those numbers. 9 | 10 | `sum` fails when given an empty list or set. 11 | 12 | ## Examples 13 | 14 | ``` 15 | > sum([10, 13, 6, 4.5]) 16 | 33.5 17 | ``` 18 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/string/strcontains.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: strcontains function reference 3 | description: |- 4 | The `strcontains` function searches for a substring within a string. 5 | --- 6 | 7 | # `strcontains` Function 8 | 9 | The `strcontains` function searches for a substring within a string. 10 | 11 | ```hcl 12 | strcontains(string, substr) 13 | ``` 14 | 15 | ## Examples 16 | 17 | ``` 18 | > strcontains("hello world", "wor") 19 | true 20 | ``` 21 | 22 | ``` 23 | > strcontains("hello world", "wod") 24 | false 25 | ``` 26 | -------------------------------------------------------------------------------- /website/content/docs/templates/hcl_templates/functions/string/substr.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: substr function reference 3 | description: |- 4 | The `substr` function extracts a substring from a given string using an offset and 5 | length. 6 | --- 7 | 8 | # `substr` Function 9 | 10 | `substr` extracts a substring from a given string by offset and length. 11 | 12 | ```hcl 13 | substr(string, offset, length) 14 | ``` 15 | 16 | ## Examples 17 | 18 | ```shell-session 19 | > substr("hello world", 1, 4) 20 | ello 21 | ``` 22 | 23 | The offset and length are both counted in _unicode characters_ rather than 24 | bytes: 25 | 26 | ```shell-session 27 | > substr("🤔🤷", 0, 1) 28 | 🤔 29 | ``` 30 | -------------------------------------------------------------------------------- /website/content/guides/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | page_title: Guides 3 | description: |- 4 | Welcome to the Packer guides. If you are just getting started with Packer, 5 | please see the Packer introduction instead and then continue on to the guides. 6 | These guides provide examples for common Packer workflows and actions for 7 | users of Packer. 8 | --- 9 | 10 | # Packer 11 | 12 | Welcome to the Packer guides. If you are just getting started with Packer, 13 | please see the [Packer introduction][intro] instead and then continue on to the 14 | guides. These guides provide examples for common Packer workflows and actions 15 | for users of Packer. 16 | 17 | [intro]: /packer/docs/intro 18 | -------------------------------------------------------------------------------- /website/content/partials/commands/only.mdx: -------------------------------------------------------------------------------- 1 | - `-only=foo,bar,baz` - Only run the builds with the given comma-separated 2 | names. In legacy JSON templates, build names default to the 3 | types of their builders (e.g. `docker` or 4 | `amazon-ebs` or `virtualbox-iso`), unless a specific `name` attribute is 5 | specified within the configuration. In HCL2 templates, the "name" is the 6 | source block's "name" label, unless an in-build source definition adds the 7 | "name" configuration option. 8 | -------------------------------------------------------------------------------- /website/content/partials/datasource/hcp-packer-artifact/Config-not-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `component_type` (string) - The specific Packer builder used to create the artifact. 4 | For example, "amazon-ebs.example" 5 | 6 | 7 | -------------------------------------------------------------------------------- /website/content/partials/datasource/hcp-packer-image/Config-not-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `component_type` (string) - The specific Packer builder used to create the image. 4 | For example, "amazon-ebs.example" 5 | 6 | 7 | -------------------------------------------------------------------------------- /website/content/partials/datasource/hcp-packer-iteration/Config-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `bucket_name` (string) - The name of the bucket your image is in. 4 | 5 | - `channel` (string) - The name of the channel to use when retrieving your image 6 | 7 | 8 | -------------------------------------------------------------------------------- /website/content/partials/datasource/hcp-packer-version/Config-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `bucket_name` (string) - The bucket name in the HCP Packer Registry. 4 | 5 | - `channel_name` (string) - The channel name in the given bucket to use for retrieving the version. 6 | 7 | 8 | -------------------------------------------------------------------------------- /website/content/partials/datasource/http/Config-not-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `method` (string) - HTTP method used for the request. Supported methods are `HEAD`, `GET`, `POST`, `PUT`, `DELETE`, `OPTIONS`, `PATCH`. Default is `GET`. 4 | 5 | - `request_headers` (map[string]string) - A map of strings representing additional HTTP headers to include in the request. 6 | 7 | - `request_body` (string) - HTTP request payload send with the request. Default is empty. 8 | 9 | 10 | -------------------------------------------------------------------------------- /website/content/partials/datasource/http/Config-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `url` (string) - The URL to request data from. This URL must respond with a `2xx` range response code and a `text/*` or `application/json` Content-Type. 4 | 5 | 6 | -------------------------------------------------------------------------------- /website/content/partials/datasource/http/DatasourceOutput.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `url` (string) - The URL the data was requested from. 4 | 5 | - `body` (string) - The raw body of the HTTP response. 6 | 7 | - `request_headers` (map[string]string) - A map of strings representing the response HTTP headers. 8 | Duplicate headers are concatenated with, according to [RFC2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2). 9 | 10 | 11 | -------------------------------------------------------------------------------- /website/content/partials/datasource/null/Config-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `input` (string) - This variable will get stored as "output" in the output spec. 4 | 5 | 6 | -------------------------------------------------------------------------------- /website/content/partials/datasource/null/Config.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | The Null data source is designed to demonstrate how data sources work, and 4 | to provide a test plugin. It does not do anything useful; you assign an 5 | input string and it gets returned as an output string. 6 | 7 | 8 | -------------------------------------------------------------------------------- /website/content/partials/datasource/null/DatasourceOutput.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `output` (string) - Output will return the input variable, as output. 4 | 5 | 6 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/beta-hcl2-note.mdx: -------------------------------------------------------------------------------- 1 | -> **Note:** This page is about HCL2 Packer templates. HCL2 templates 2 | were first introduced as a beta feature into Packer version 1.5. As of v1.7, 3 | HCL2 support is no longer in beta, and is the preferred way to write Packer 4 | configuration. For the old-style stable configuration language see 5 | [template docs](/packer/docs/templates/legacy_json_templates). As of v1.6.2, you can 6 | convert your legacy JSON template into an HCL2 config file using the 7 | [hcl2_upgrade command](/packer/docs/commands/hcl2_upgrade). 8 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/datasources/example-block.mdx: -------------------------------------------------------------------------------- 1 | ```hcl 2 | # datasource.pkr.hcl 3 | data "amazon-ami" "basic-example" { 4 | // ... 5 | } 6 | ``` 7 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/legacy-json-warning.mdx: -------------------------------------------------------------------------------- 1 | -> **Note:** This page is about older-style JSON Packer templates. JSON 2 | templates are still supported by the Packer core, but new features added to the 3 | Packer core may not be implemented for JSON templates. We recommend you 4 | transition to HCL templates as soon as is convenient for you, in order to have 5 | the best possible experience with Packer. To help you upgrade your templates, 6 | we have written an [hcl2_upgrade command](/packer/docs/commands/hcl2_upgrade). 7 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/locals/example-block.mdx: -------------------------------------------------------------------------------- 1 | ```hcl 2 | # locals.pkr.hcl 3 | locals { 4 | # locals can be bare values like: 5 | wee = local.baz 6 | # locals can also be set with other variables : 7 | baz = "Foo is '${var.foo}' but not '${local.wee}'" 8 | } 9 | 10 | # Use the singular local block if you need to mark a local as sensitive 11 | local "mylocal" { 12 | expression = "${var.secret_api_key}" 13 | sensitive = true 14 | } 15 | ``` 16 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/sources/example-block.mdx: -------------------------------------------------------------------------------- 1 | ```hcl 2 | # sources.pkr.hcl 3 | source "happycloud" "foo" { 4 | // ... 5 | } 6 | ``` 7 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/variables/assignment.mdx: -------------------------------------------------------------------------------- 1 | ## Assigning Values to input Variables 2 | 3 | Once a variable is declared in your configuration, you can set it: 4 | 5 | - Individually, with the `-var foo=bar` command line option. 6 | - In variable definitions files, either specified on the command line with the `-var-files values.pkrvars.hcl` or automatically loaded (`*.auto.pkrvars.hcl`). 7 | - As environment variables, for example: `PKR_VAR_foo=bar` 8 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/variables/foo-block.mdx: -------------------------------------------------------------------------------- 1 | ```hcl 2 | # variables.pkr.hcl 3 | variable "foo" { 4 | type = string 5 | default = "the default value of the `foo` variable" 6 | description = "description of the `foo` variable" 7 | sensitive = false 8 | # When a variable is sensitive all string-values from that variable will be 9 | # obfuscated from Packer's output. 10 | } 11 | ``` 12 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/variables/foo-pkrvar.mdx: -------------------------------------------------------------------------------- 1 | ```hcl 2 | # foo.pkrvars.hcl 3 | foo = "value" 4 | ``` 5 | -------------------------------------------------------------------------------- /website/content/partials/from-1.5/variables/sensitive.mdx: -------------------------------------------------------------------------------- 1 | ### Suppressing Sensitive Variables 2 | 3 | [inpage-sensitive]: #suppressing-sensitive-variables 4 | 5 | 6 | When a variable is sensitive all string-values from that variable will be 7 | obfuscated from Packer's output : 8 | 9 | ```hcl 10 | # var-foo.pkr.hcl 11 | variable "foo" { 12 | sensitive = true 13 | default = { 14 | key = "SECR3TP4SSW0RD" 15 | } 16 | } 17 | ``` 18 | 19 | ```shell-session 20 | $ packer inspect var-foo.pkr.hcl 21 | Packer Inspect: HCL2 mode 22 | 23 | > input-variables: 24 | var.foo: "{\n \"key\" = \"\"\n }" 25 | ... 26 | ``` 27 | -------------------------------------------------------------------------------- /website/content/partials/guides/hcl2-beta-note.mdx: -------------------------------------------------------------------------------- 1 | -> **Note:** Packer version **1.5.0** introduced support for HCL2 templates as a beta feature. As of version **1.7.0**, HCL2 support is no longer in beta and is the preferred way to write Packer configuration(s). 2 | -------------------------------------------------------------------------------- /website/content/partials/helper/communicator/SSH-Agent-Auth-not-required.mdx: -------------------------------------------------------------------------------- 1 | - `ssh_agent_auth` (bool) - If true, the local SSH agent will be used to authenticate connections to 2 | the source instance. No temporary keypair will be created, and the 3 | values of [`ssh_password`](#ssh_password) and 4 | [`ssh_private_key_file`](#ssh_private_key_file) will be ignored. The 5 | environment variable `SSH_AUTH_SOCK` must be set for this option to work 6 | properly. 7 | -------------------------------------------------------------------------------- /website/content/partials/helper/communicator/SSH-Key-Pair-Name-not-required.mdx: -------------------------------------------------------------------------------- 1 | - `ssh_keypair_name` (string) - If specified, this is the key that will be used for SSH with the 2 | machine. The key must match a key pair name loaded up into the remote. 3 | By default, this is blank, and Packer will generate a temporary keypair 4 | unless [`ssh_password`](#ssh_password) is used. 5 | [`ssh_private_key_file`](#ssh_private_key_file) or 6 | [`ssh_agent_auth`](#ssh_agent_auth) must be specified when 7 | [`ssh_keypair_name`](#ssh_keypair_name) is utilized. 8 | -------------------------------------------------------------------------------- /website/content/partials/helper/communicator/SSH-Private-Key-File-not-required.mdx: -------------------------------------------------------------------------------- 1 | - `ssh_private_key_file` (string) - Path to a PEM encoded private key file to use to authenticate with SSH. 2 | The `~` can be used in path and will be expanded to the home directory 3 | of current user. 4 | -------------------------------------------------------------------------------- /website/content/partials/helper/communicator/SSH-Temporary-Key-Pair-not-required.mdx: -------------------------------------------------------------------------------- 1 | - `temporary_key_pair_name` (string) - The name of the temporary key pair to generate. By default, Packer 2 | generates a name that looks like `packer_`, where <UUID> is 3 | a 36 character unique identifier. 4 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/bootcommand/VNCConfig-not-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `disable_vnc` (bool) - Whether to create a VNC connection or not. A boot_command cannot be used 4 | when this is true. Defaults to false. 5 | 6 | - `boot_key_interval` (duration string | ex: "1h5m2s") - Time in ms to wait between each key press 7 | 8 | 9 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/Config.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | Config is the common configuration a builder uses to define and configure a Packer 4 | communicator. Embed this struct in your builder config to implement 5 | communicator support. 6 | 7 | 8 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/SSH-Agent-Auth-not-required.mdx: -------------------------------------------------------------------------------- 1 | - `ssh_agent_auth` (bool) - If true, the local SSH agent will be used to authenticate connections to 2 | the source instance. No temporary keypair will be created, and the 3 | values of [`ssh_password`](#ssh_password) and 4 | [`ssh_private_key_file`](#ssh_private_key_file) will be ignored. The 5 | environment variable `SSH_AUTH_SOCK` must be set for this option to work 6 | properly. 7 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/SSH-Key-Pair-Name-not-required.mdx: -------------------------------------------------------------------------------- 1 | - `ssh_keypair_name` (string) - If specified, this is the key that will be used for SSH with the 2 | machine. The key must match a key pair name loaded up into the remote. 3 | By default, this is blank, and Packer will generate a temporary keypair 4 | unless [`ssh_password`](#ssh_password) is used. 5 | [`ssh_private_key_file`](#ssh_private_key_file) or 6 | [`ssh_agent_auth`](#ssh_agent_auth) must be specified when 7 | [`ssh_keypair_name`](#ssh_keypair_name) is utilized. 8 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/SSH-Private-Key-File-not-required.mdx: -------------------------------------------------------------------------------- 1 | - `ssh_private_key_file` (string) - Path to a PEM encoded private key file to use to authenticate with SSH. 2 | The `~` can be used in path and will be expanded to the home directory 3 | of current user. 4 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/SSH-Temporary-Key-Pair-not-required.mdx: -------------------------------------------------------------------------------- 1 | - `temporary_key_pair_name` (string) - The name of the temporary key pair to generate. By default, Packer 2 | generates a name that looks like `packer_`, where <UUID> is 3 | a 36 character unique identifier. 4 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/SSH.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | The SSH config defines configuration for the SSH communicator. 4 | 5 | 6 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/SSHInterface.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | SSHInterface defines whether to use public or private, addresses, and whether 4 | to use IPv4 or IPv6. 5 | 6 | 7 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/SSHTemporaryKeyPair.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | When no ssh credentials are specified, Packer will generate a temporary SSH 4 | keypair for the instance. You can change the algorithm type and bits 5 | settings. 6 | 7 | 8 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/communicator/WinRM.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | The WinRM config defines configuration for the WinRM communicator. 4 | 5 | 6 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | Packer will create an http server serving `http_directory` when it is set, a 4 | random free port will be selected and the architecture of the directory 5 | referenced will be available in your builder. 6 | 7 | Example usage from a builder: 8 | 9 | `wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/foo/bar/preseed.cfg` 10 | 11 | 12 | -------------------------------------------------------------------------------- /website/content/partials/packer-plugin-sdk/provisioners/unmaintained-plugin.mdx: -------------------------------------------------------------------------------- 1 | ~> **This community maintained provisioner is currently unmaintained**; if you are interested in contributing or taking ownership of it, please reach out to us at [packer@hashicorp.com](mailto://packer@hashicorp.com). More details can be found in the [README](https://github.com/hashicorp/packer/blob/master/README.md#unmaintained-plugins). 2 | -------------------------------------------------------------------------------- /website/content/partials/path/separator-note.mdx: -------------------------------------------------------------------------------- 1 | Separate paths with a forward slash (`/`), especially when using relative paths in your configuration. 2 | Windows uses backward slashes (`\`) to separate paths, but Packer only recognizes `/` as path 3 | separators when it creates builds from any non-Windows system. Packer also treat backslashes as plain text, which could lead to errors. 4 | -------------------------------------------------------------------------------- /website/content/partials/post-processors/community_post-processors.mdx: -------------------------------------------------------------------------------- 1 | ### Community Post-Processors 2 | 3 | - [Exoscale Import post-processor](https://github.com/exoscale/packer-plugin-exoscale) - A post-processor to import Exoscale custom templates from disk image files. 4 | 5 | -------------------------------------------------------------------------------- /website/content/partials/provisioner/hcp-sbom/Config-required.mdx: -------------------------------------------------------------------------------- 1 | 2 | 3 | - `source` (string) - The file path or URL to the SBOM file in the Packer artifact. 4 | This file must either be in the SPDX or CycloneDX format. 5 | 6 | 7 | -------------------------------------------------------------------------------- /website/content/partials/provisioners/unmaintained-plugin.mdx: -------------------------------------------------------------------------------- 1 | ~> **This community maintained provisioner is currently unmaintained**; if you 2 | are interested in contributing or taking ownership of it, please reach out to us 3 | at [packer@hashicorp.com](mailto://packer@hashicorp.com). More details can be 4 | found in the 5 | [README](https://github.com/hashicorp/packer/blob/main/README.md#unmaintained-plugins). 6 | -------------------------------------------------------------------------------- /website/content/plugins/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | description: | 3 | Plugins are installable components of Packer 4 | page_title: Packer plugins 5 | --- 6 | 7 | # External Packer Plugins 8 | 9 | External Packer plugins are standalone applications that extend Packer functionality without modifying the core source code. Plugins can add new components to Packer, such as builders, provisioners, post-processors, and data sources. Refer to [Packer Plugins](/packer/docs/plugins) for details about installing and developing external plugins. 10 | 11 | This section contains the documentation for available external Packer plugins. 12 | 13 | @include "plugins/plugin-tiers-and-namespaces.mdx" 14 | -------------------------------------------------------------------------------- /website/data/plugins-manifest.json: -------------------------------------------------------------------------------- 1 | [ 2 | ] 3 | -------------------------------------------------------------------------------- /website/data/plugins-nav-data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "heading": "External Plugins" }, 3 | { 4 | "title": "Overview", 5 | "path": "" 6 | }, 7 | { 8 | "divider": true 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /website/prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ...require('@hashicorp/platform-cli/config/prettier.config'), 3 | } 4 | -------------------------------------------------------------------------------- /website/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/favicon.ico -------------------------------------------------------------------------------- /website/public/files/press-kit.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/files/press-kit.zip -------------------------------------------------------------------------------- /website/public/img/docs/atlas-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/docs/atlas-workflow.png -------------------------------------------------------------------------------- /website/public/img/docs/packer-ecosystem-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/docs/packer-ecosystem-diagram.png -------------------------------------------------------------------------------- /website/public/img/docs/packer-integration-steps-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/docs/packer-integration-steps-diagram.png -------------------------------------------------------------------------------- /website/public/img/favicons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/favicons/android-chrome-192x192.png -------------------------------------------------------------------------------- /website/public/img/favicons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/favicons/android-chrome-512x512.png -------------------------------------------------------------------------------- /website/public/img/favicons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/favicons/apple-touch-icon.png -------------------------------------------------------------------------------- /website/public/img/favicons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/favicons/favicon-16x16.png -------------------------------------------------------------------------------- /website/public/img/favicons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/favicons/favicon-32x32.png -------------------------------------------------------------------------------- /website/public/img/favicons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/favicons/mstile-150x150.png -------------------------------------------------------------------------------- /website/public/img/guides/teamcity_build_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/guides/teamcity_build_configuration.png -------------------------------------------------------------------------------- /website/public/img/guides/teamcity_build_log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/guides/teamcity_build_log.png -------------------------------------------------------------------------------- /website/public/img/guides/teamcity_build_log_complete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/guides/teamcity_build_log_complete.png -------------------------------------------------------------------------------- /website/public/img/guides/teamcity_create_project_from_url-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/guides/teamcity_create_project_from_url-1.png -------------------------------------------------------------------------------- /website/public/img/guides/teamcity_create_project_from_url-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/guides/teamcity_create_project_from_url-2.png -------------------------------------------------------------------------------- /website/public/img/integrations-text-split/integrations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/integrations-text-split/integrations.png -------------------------------------------------------------------------------- /website/public/img/og-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/og-image.png -------------------------------------------------------------------------------- /website/public/img/packer-signed-urls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hashicorp/packer/f829fd966943b60e023c1323696c0a900f04a663/website/public/img/packer-signed-urls.png -------------------------------------------------------------------------------- /website/public/img/product-features-list/demo-creation.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /website/public/img/product-features-list/prod-parity.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /website/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: /404 3 | Disallow: /500 4 | -------------------------------------------------------------------------------- /website/scripts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "esModuleInterop": true, 4 | "module": "CommonJS" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /website/vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "public": true, 4 | "github": { 5 | "silent": true 6 | } 7 | } 8 | --------------------------------------------------------------------------------