Commit Graph

3575 Commits

Author SHA1 Message Date
Adrien Delorme 0785c2f6fc
build using HCL2 (#8423)
This follows #8232 which added the code to generate the code required to parse
HCL files for each packer component.

All old config files of packer will keep on working the same. Packer takes one
argument. When a directory is passed, all files in the folder with a name
ending with  “.pkr.hcl” or “.pkr.json” will be parsed using the HCL2 format.
When a file ending with “.pkr.hcl” or “.pkr.json” is passed it will be parsed
using the HCL2 format. For every other case; the old packer style will be used.

## 1. the hcl2template pkg can create a packer.Build from a set of HCL (v2) files

I had to make the packer.coreBuild (which is our one and only packer.Build ) a public struct with public fields

## 2. Components interfaces get a new ConfigSpec Method to read a file from an HCL file.

  This is a breaking change for packer plugins.

a packer component can be a: builder/provisioner/post-processor

each component interface now gets a `ConfigSpec() hcldec.ObjectSpec`
which allows packer to tell what is the layout of the hcl2 config meant
to configure that specific component.

This ObjectSpec is sent through the wire (RPC) and a cty.Value is now
sent through the already existing configuration entrypoints:

 Provisioner.Prepare(raws ...interface{}) error
 Builder.Prepare(raws ...interface{}) ([]string, error)
 PostProcessor.Configure(raws ...interface{}) error

close #1768


Example hcl files:

```hcl
// file amazon-ebs-kms-key/run.pkr.hcl
build {
    sources = [
        "source.amazon-ebs.first",
    ]

    provisioner "shell" {
        inline = [
            "sleep 5"
        ]
    }

    post-processor "shell-local" {
        inline = [
            "sleep 5"
        ]
    }
}

// amazon-ebs-kms-key/source.pkr.hcl

source "amazon-ebs" "first" {

    ami_name = "hcl2-test"
    region = "us-east-1"
    instance_type = "t2.micro"

    kms_key_id = "c729958f-c6ba-44cd-ab39-35ab68ce0a6c"
    encrypt_boot = true
    source_ami_filter {
        filters {
          virtualization-type = "hvm"
          name =  "amzn-ami-hvm-????.??.?.????????-x86_64-gp2"
          root-device-type = "ebs"
        }
        most_recent = true
        owners = ["amazon"]
    }
    launch_block_device_mappings {
        device_name = "/dev/xvda"
        volume_size = 20
        volume_type = "gp2"
        delete_on_termination = "true"
    }
    launch_block_device_mappings {
        device_name = "/dev/xvdf"
        volume_size = 500
        volume_type = "gp2"
        delete_on_termination = true
        encrypted = true
    }

    ami_regions = ["eu-central-1"]
    run_tags {
        Name = "packer-solr-something"
        stack-name = "DevOps Tools"
    }
    
    communicator = "ssh"
    ssh_pty = true
    ssh_username = "ec2-user"
    associate_public_ip_address = true
}
```
2019-12-17 11:25:56 +01:00
Megan Marsh 6bc5a95c3a tweak docs; change to 2019-12-16 21:35:42 -08:00
Sylvia Moss c57f093efe
Remove unnecessary source_path validation for virtualbox-ovf (#8489) 2019-12-16 16:50:21 +01:00
Megan Marsh 1679d9fb9d docs 2019-12-14 03:53:22 -08:00
Kris Hicks 40357e2534 docs/builder/azure-arm: Remove errant html comment (#8484)
* Remove errant html comment from source

* make generate
2019-12-13 10:35:24 -05:00
Megan Marsh fbd1958ca5
Merge pull request #8462 from mkaczanowski/master
update documentation for arm images builder
2019-12-12 09:21:54 -08:00
Megan Marsh 0ca7c9f397 fix tests 2019-12-11 16:29:35 -08:00
Mateusz Kaczanowski f1765dfd79
Update _community_builders.html.md 2019-12-11 15:25:23 +01:00
Megan Marsh 822aa02500
Merge pull request #8468 from pfuender/master
Add version selection for chef-client provisioner
2019-12-10 12:29:32 -08:00
Mateusz Kaczanowski a645b1d48e
Update _community_builders.html.md 2019-12-10 20:41:00 +01:00
Megan Marsh 2b4a6f0479
Merge pull request #8442 from borgstrom/patch-1
iam:GetInstanceProfile is now required
2019-12-10 10:56:39 -08:00
Oded Priva 5e81c6f44e added the option to skip IAM instance profile validation (#8457) 2019-12-10 09:17:38 +01:00
pfuender ffb9272fb2 adding version-override for chef-client provisioner 2019-12-09 20:58:04 +01:00
Kaczanowski Mateusz 9d3c718c2e update documentation for arm images builder 2019-12-07 10:44:32 +01:00
Sylvia Moss 096cab9b48 Fix floppy doc markdown typo (#8458) 2019-12-06 14:12:11 +01:00
Sylvia Moss 5ff5623433
Add disable_shutdown option to VirtualBox builder (#8449) 2019-12-05 14:34:56 +01:00
Megan Marsh 05b972e550
Merge pull request #8444 from ad-m/hyperone-builder
Fix tags & modernize config for HyperOne builder
2019-12-03 10:30:26 -08:00
Megan Marsh 9fc37f9456
Merge pull request #8438 from hashicorp/fix_qemu_sizes
make sure we continue to default to Megabytes for qemu disk size to p…
2019-12-03 09:58:21 -08:00
Adam Dobrawy 3b091e6046 builder/hyperone: fix & add tests for tags 2019-12-03 14:57:40 +01:00
Megan Marsh fcda07ee6a clarify docs by removing unclear string (#8439)
the docs generator from code PR #7724  mis scrapped it
2019-12-03 10:07:46 +01:00
Borgstrom ♕ 5be5cc146b
iam:GetInstanceProfile is now required 2019-12-03 10:06:01 +08:00
Megan Marsh 5fb2899c3f
Merge pull request #8434 from tacoman/patch-2
Update sidebar + remove cruft for WinRM page
2019-12-02 16:23:24 -08:00
Megan Marsh f5806afda8 update docs 2019-12-02 16:04:29 -08:00
tacoman cf6058b8fb Fixed the formatting for one of the examples. (#8433) 2019-12-02 10:32:57 +01:00
Indy Griffiths 82a1242b58 Fix bad header indentation (#8435)
Caused header to show up on https://www.packer.io/docs/provisioners/puppet-server.html as a code block
2019-12-02 10:29:54 +01:00
tacoman 13c315d03e
Update sidebar + remove cruft for WinRM page 2019-11-30 23:14:41 -05:00
Megan Marsh 29d6c05ef8
Merge pull request #8401 from hashicorp/do_8838
use shell struct in shell-local provisioner and post-processor.
2019-11-25 11:49:08 -08:00
Mike Dziedziela 7c3e032fb7 amazon docs: update block-device-configuration docs (#8395)
So that it works for all builders as some use it with the following field names: launch_block_device_mappings, ami_block_device_mappings or ebs_volumes. the refactored docs weird being to specific.
2019-11-25 11:58:30 +01:00
Megan Marsh e92783f303 add docs about efi mode (#8400)
Document what needs to happen if you're launching an efi vm.

Closes #7081
2019-11-22 11:17:08 +01:00
Megan Marsh 7d4353864f use shell struct in shell-local provisioner and post-processor. 2019-11-21 16:47:29 -08:00
Megan Marsh 59e6e1d4d5
Merge pull request #8393 from hashicorp/fix_8362
Add no_ephemeral template option to nuke ephemeral drives from launch mappings
2019-11-21 16:08:50 -08:00
Megan Marsh 6c1cb2a099 add unique kms case to permissions docs 2019-11-21 13:24:44 -08:00
Megan Marsh 67c3373107 enable no_ephemeral for spot devices, clean up ranging behavior, update docs 2019-11-21 12:46:31 -08:00
Megan Marsh 08e97ba4d8 generate code for no_ephemeral option 2019-11-20 13:49:04 -08:00
Megan Marsh 161be0adcd update docs with note about ssh/winrm 2019-11-08 11:09:16 -08:00
Megan Marsh 6e2456d028 make error messaging around ResourceNotReady better, update docs with other possible issues (#8349) 2019-11-08 11:15:24 +01:00
Megan Marsh 98c94ab8cb
Merge pull request #7676 from ltrager/master
Add display template option for qemu.
2019-11-07 15:41:17 -08:00
Megan Marsh 4a3f5318e2
Merge pull request #8347 from rjspiker/rj.font-smooth
website - add -moz-osx-font-smoothing for smooth firefox osx fonts
2019-11-07 14:14:48 -08:00
RJ Spiker b7561e3915 website - add -moz-osx-font-smoothing for smooth firefox osx fonts 2019-11-07 13:01:05 -07:00
nywilken 821d6d4f54 getting-started/build-image: Remove reference to Redis install
The deleted paragraph seems like a carry over from a previous version of the document as Redis is no longer mentioned as part of the base image template.
2019-11-07 11:48:54 -05:00
Megan Marsh d5ba530b26 make it clear we expect pem format not some other formate (#8344) 2019-11-07 10:30:51 +01:00
Megan Marsh a13b61a07d
Merge pull request #8339 from hashicorp/fix_8323
add kms policies to amazon docs
2019-11-06 14:52:03 -08:00
nywilken 3522e13b1e provisioner/shell: Add `env_var_format` support to shell provisioner
* Move setting of default EnvVarFormat to the Prepare function
* Add generated hcl2 structure for the updated Shell provisioner config
* Move `EnvVarFormat` field to shared common shell type
* Add description for the `env_var_format` parameter
* Update `env_var_format` when used with `use_env_var_file`
2019-11-06 16:28:56 -05:00
Megan Marsh 0cfa471d24
Update website/source/docs/builders/amazon.html.md
Co-Authored-By: Wilken Rivera <dev@wilkenrivera.com>
2019-11-06 12:11:48 -08:00
Megan Marsh b98f6e0db8 add kms policies to amazon docs 2019-11-06 10:37:01 -08:00
Bryan Stenson fdae3f14f7 more typos 2019-11-06 01:15:19 -08:00
Bryan Stenson 8aec4a6665
typo 2019-11-05 10:19:32 -08:00
Adrien Delorme 7108f6d07e
Merge pull request #8295 from rjspiker/rj.fonts
website - font and brand updates
2019-11-05 15:40:03 +01:00
Adrien Delorme 44a7c49334
Merge pull request #8320 from hashicorp/do_8228
re-add backwards incompatible changes to 1.5.0
2019-11-05 14:40:48 +01:00
Adrien Delorme fe2aac6952
Merge pull request #8324 from shawnmssu/fix_docs
fix ucloud-import docs index
2019-11-05 14:20:05 +01:00
mingsheng.su ba90606581 fix docs index 2019-11-05 19:07:09 +08:00
Megan Marsh d010762dbf Revert "Revert "Qemu builder disk size as a string""
This reverts commit 9c782f4d04.
2019-11-04 14:28:48 -08:00
Megan Marsh 517834d528 Revert "Revert "remove clean_ami_name and clean_image_name; complete the deprecation for these functions in favor of clean_resource_name""
This reverts commit 44f91c9afc.
2019-11-04 14:28:40 -08:00
Megan Marsh 4d4e2c39f8 add some docs explaining ansible + docker 2019-11-04 14:19:41 -08:00
RJ Spiker 8ab89b5ed7 feedback updates and some style cleanup 2019-11-04 13:11:13 -07:00
Adrien Delorme bc0325c33f
Merge pull request #8313 from hashicorp/release-1.4.5
Packer 1.4.5 release
2019-11-04 17:59:02 +01:00
Adrien Delorme 14243ce56a
Merge pull request #8305 from hashicorp/fix_8301
allow nvme, since virtualbox 6.0 allows it
2019-11-04 17:58:18 +01:00
Kévin Rauscher a39fef5178
Fix incorrect variable name galaxy_command 2019-11-04 14:42:39 +00:00
Adrien Delorme a23801d4a9 builder.virtualbox.iso: document that EFI mode needs to be enabled for pcie/nvme to work too 2019-11-04 14:30:59 +01:00
Adrien Delorme b467027972 Update config.rb
for 1.4.5
2019-11-04 11:50:52 +01:00
Megan Marsh 974eba443a update docs to include warning about extension pack 2019-11-01 09:48:35 -07:00
Megan Marsh 65ad3105b3 udpdate generated code 2019-10-31 15:28:36 -07:00
Adrien Delorme 819329228a Change back to make sure all durations are a time.Duration
It is simply the best/simplest solution and trying to prevent users from passing and integer here would be like opening a can of worms. Because:

* we cannot make mapstructure validate our duration string ( with an UnmarshalJSON func etc.)
* we cannot make mapstructure spit a string instead of a duration and packer will decode-encode-decode config.
* the hcl2 generated code asks for a string, so this will be enforced by default.
2019-10-31 16:12:07 +01:00
Adrien Delorme bf3d9841c6 Force durations to be passed a strings
Before this commit it was possible to set a duration using an integer or a float. Go's time.Duration is an int64 internally an mapstructure will take advantage of this and load the number as a int64 but `1` means one ns which is unexpected/confusing. To avoid confusion and enforce readability this forces users to pass a string with a unit for a duration; ex "56s".
2019-10-31 11:47:19 +01:00
Adrien Delorme ada9821897
Merge pull request #8294 from hashicorp/do_7974
add insert_key option for toggling whether to add Vagrant's insecure key
2019-10-31 10:27:27 +01:00
RJ Spiker 4e873649ed website - font and brand updates 2019-10-30 16:04:27 -06:00
Megan Marsh 8f996cd4de update docs 2019-10-30 13:36:56 -07:00
Megan Marsh 3b3aa562ed add insert_key option for toggling whether to add Vagrant's insecure key 2019-10-30 13:27:34 -07:00
mingsheng.su 4f140d0071 fix docs of ucloud-uhost 2019-10-30 15:05:54 +08:00
mingsheng.su 545575b879 optimize code about ufile config 2019-10-29 16:11:44 -07:00
mingsheng.su 934698c7d1 Update website/source/docs/post-processors/ucloud-import.html.md
Co-Authored-By: Megan Marsh <megan@hashicorp.com>
2019-10-29 16:11:44 -07:00
mingsheng.su 94fbdd52bc Update website/source/docs/post-processors/ucloud-import.html.md
Co-Authored-By: Megan Marsh <megan@hashicorp.com>
2019-10-29 16:11:44 -07:00
mingsheng.su 313723e03b Update website/source/docs/post-processors/ucloud-import.html.md
Co-Authored-By: Megan Marsh <megan@hashicorp.com>
2019-10-29 16:11:44 -07:00
mingsheng.su 6b29e3a892 Update website/source/docs/post-processors/ucloud-import.html.md
Co-Authored-By: Megan Marsh <megan@hashicorp.com>
2019-10-29 16:11:44 -07:00
mingsheng.su ece6702afb Update website/source/docs/post-processors/ucloud-import.html.md
Co-Authored-By: Megan Marsh <megan@hashicorp.com>
2019-10-29 16:11:44 -07:00
mingsheng.su fb9c624281 update docs 2019-10-29 16:11:43 -07:00
mingsheng.su 1099777978 update bucket about no create 2019-10-29 16:11:43 -07:00
mingsheng.su 083d7896f4 update message of ucloud import 2019-10-29 16:11:43 -07:00
mingsheng.su 2c513fce64 update ucloud packer 2019-10-29 16:11:43 -07:00
mingsheng.su 61f9d3a9fe add ucloud import 2019-10-29 16:11:43 -07:00
Andrey Kaipov 5da5b00e1c [builder/openstack] adds option to discover provisioning network 2019-10-29 13:02:27 -04:00
Michael Bochkaryov da7e72246c Add instance_display_name parameter for Cloudstack builder
This change introduce instance_display_name optional parameter
for Cloudstack builder to set custom VM display name.
By default it is set to "Created by Packer".
2019-10-26 21:13:45 -07:00
Megan Marsh eccdb44e3b
Merge pull request #8246 from hashicorp/fix_8089
Add the additional_disk_size option tho the hyperv vmcx builder.
2019-10-24 11:50:58 -07:00
Megan Marsh 7928b5b045 fix transcription error from when we moved to generated docs 2019-10-24 10:19:03 -07:00
Megan Marsh 8ac97de8b2 remove vnc config options from virtualbox docs; virtualbox does not implement the vncconfig struct 2019-10-22 12:11:27 -07:00
Megan Marsh d15f43e4eb
Merge pull request #8232 from hashicorp/artifact-tree
HCL2 configs - part one
2019-10-22 11:54:34 -07:00
Megan Marsh abcbce0c4f
Merge pull request #8253 from hashicorp/plugin_docs
update website to hopefully make community builders and provisioners …
2019-10-22 11:52:15 -07:00
Megan Marsh ca095ecb28
Merge pull request #8257 from hashicorp/vagrant_pp_docs
update vagrant docs to explain that the builder and postprocessor are…
2019-10-22 11:51:45 -07:00
Megan Marsh 5301f4613d update vagrant docs to explain that the builder and postprocessor are mutually exclusive 2019-10-22 09:54:33 -07:00
Megan Marsh cdc3fdf926
Merge pull request #8247 from b-b3rn4rd/master
New Feature: allow to specify  IAM policy for a temporary instance profile
2019-10-22 09:33:23 -07:00
Bernard Baltrusaitis ec1d70dc44 adding required changes 2019-10-22 21:40:18 +11:00
Megan Marsh de360df259 update website to hopefully make community builders and provisioners easier to find 2019-10-21 16:04:34 -07:00
Megan Marsh 0c2fba089d
Merge pull request #8250 from tencentyun/master
tencentcloud-cvm builder: we added retry on remote api call to improve the user experience
2019-10-21 14:45:37 -07:00
Megan Marsh 7b428f8c68 switch hyperv vmcx docs to use generated partials 2019-10-21 14:31:39 -07:00
Megan Marsh 34f5bfa498 regenerated things 2019-10-21 14:21:15 -07:00
Megan Marsh 9eee63a659 regenerate docs based on new struct format 2019-10-21 14:11:45 -07:00
Megan Marsh 836aaafaa3
Merge pull request #8203 from sumit-kalra/master
Azure-ARM builder: Deploy NSG if list of IP addresses is provided in config
2019-10-21 11:10:58 -07:00
Li Kexian 6fb8988d08
we added retry on remote api call to improve the user experience 2019-10-21 13:21:56 +08:00
Bernard Baltrusaitis 6e2146324f Merge branch 'master' of github.com:b-b3rn4rd/packer 2019-10-19 20:56:49 +11:00
Bernard Baltrusaitis 8b83cca064 adding temporary instance profile document policy 2019-10-19 20:56:18 +11:00