Commit Graph

129 Commits

Author SHA1 Message Date
Megan Marsh 7e0cfd8b77 add undocumented tag to struct-markdown generator so that we can leave internal-use-only fields out of docs 2020-05-01 10:31:38 -07:00
Adrien Delorme 73242e8de4 make sure keyvalue and namevalue filters are using the same naming as the service being used 2020-04-16 17:22:13 +02:00
Adrien Delorme 840e67f775
HCL2: when we see a map generate an attribute spec instead of a block spec (#9035)
* mapstructure-to-hcl2: when we see a map generate an attribute spec and not a block spec

this will alow to do

tags = {
 key = "value"
}

instead of

tags {
  key = "value"
}

This will also enable using variables directly for those tags

* generate code

* update tests
2020-04-14 16:05:13 +02:00
Jeff Escalante 2999934326
fix generation script, bugfixes in source comments, update website paths in primary codebase 2020-04-07 17:53:22 -04:00
Jeff Escalante 9165be87da
packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
Jeff Escalante af257c2bb9
fix all local relative links 2020-04-07 17:50:53 -04:00
Jeff Escalante 4afd107eeb
patch source files for extensions changes 2020-04-07 17:50:51 -04:00
Adrien Delorme 4ccf158fbf Update image_config.go 2020-03-17 15:26:18 +01:00
Adrien Delorme 88297c796d Merge branch 'master' into hcl2_singular_blocks 2020-03-17 14:47:17 +01:00
Adrien Delorme b5e8750f5f Change key/value to name/value to remain consistent with Terraform 2020-03-17 11:23:11 +01:00
Adrien Delorme c845436e32 KeyValues.CopyOn: make sure a receiving nil map is set too 2020-03-16 15:46:08 +01:00
Adrien Delorme 87d6b2433f make generate 2020-03-16 15:21:29 +01:00
Adrien Delorme e1c84806cc rewrap 2020-03-16 14:55:03 +01:00
Adrien Delorme dab689ce2e WIP 2020-03-16 12:19:34 +01:00
Megan Marsh 6008f911fd
Merge pull request #8847 from takaishi/support-keyboard-interactive
communicator/ssh: support keyboard-interactive auth to connect bastion
2020-03-13 11:48:12 -07:00
Adrien Delorme 6e6490d688 WIP 2020-03-13 18:04:48 +01:00
r_takaishi f50ff1d270 make generate 2020-03-13 11:29:42 +09:00
Wilken Rivera 66ad6f3483
builders: Fix gosimple S1007 linting issue (#8871)
Results before change
```
⇶  golangci-lint run ./... --disable-all --enable=gosimple | grep 1007
builder/alicloud/ecs/image_config.go:208:9: S1007: should use raw string
post-processor/vsphere-template/step_mark_as_template.go:130:8: S1007: shape twice (gosimple)
builder/azure/arm/config.go:58:27: S1007: should use raw string (`...`)
builder/azure/arm/config.go:59:27: S1007: should use raw string (`...`)
builder/qemu/driver.go:192:15: S1007: should use raw string (`...`)
```

Results after change
```
⇶  golangci-lint run ./... --disable-all --enable=gosimple | grep 1007
```
2020-03-11 10:29:22 +01:00
Megan Marsh eeac289fa5
Merge pull request #8535 from alexyueer/master
fix issue #8534
2020-01-07 12:47:23 -08:00
alexyueer ec4a7b6af0 support aliyun profile 2020-01-03 12:17:34 +08:00
wujin 2e2f197bc3 add SecurityGroupId when DescribeSecurityGroups if user specify SecurityGroupId 2019-12-24 09:47:52 +08:00
Megan Marsh 127905e855 remove time flaky time limited tests (#8522)
* remove flaky test. It isn't very useful anyway given that we're slowly adding retries to the checks for lockfiles

* remove time-component from retry test; in underpowered CI builds, this can flake fairly often.
2019-12-20 08:16:18 +01:00
zhuzhih2017 66445ecd2d
Merge pull request #8425 from haoshuwei/master
add show expired arg when describe image
2019-12-20 13:33:55 +08:00
haoshuwei 37dc411f30 add skip_image_validation arg to use an expired image as the soure image
Signed-off-by: haoshuwei <haoshuwei24@gmail.com>
2019-12-20 11:28:31 +08:00
Adrien Delorme 4b7132c87c Merge remote-tracking branch 'origin/master' into sharing_info 2019-12-17 11:57:09 +01:00
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 0f6d1beccf add an extra string array to the Prepare() return values in the builder interfaces; this sets up the ability for builders to give the provisioners custom user-accessible build-time variables. 2019-12-16 21:23:05 -08:00
Megan Marsh 84063d2132 implement ID and Type values in the provisioner template info sharing 2019-12-13 11:57:01 -08:00
Adrien Delorme 078ba7c8c3 commit old code generation tool
for history
2019-10-15 12:56:42 +02:00
Adrien Delorme 55f1c734d0 fix alicloud docs a little 2019-09-20 15:10:02 +02:00
Adrien Delorme 3fe9d52e3f Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-09-20 11:15:44 +02:00
Adrien Delorme 7d9798f5ee update AlicloudAccessConfig docs for SECURITY_TOKEN
SecurityToken=>SECURITY_TOKEN
2019-08-29 14:39:25 +02:00
Adrien Delorme 2efc94521b use trilean initializers in test where missing 2019-08-23 11:17:45 +02:00
Megan Marsh f7c8321a7e convert alicloud s.IOOptimized into trilean in code 2019-08-22 13:59:38 -07:00
Megan Marsh ecaec1ac58 swap out alicloud encryption *bools for trileans 2019-08-22 13:52:29 -07:00
Megan Marsh 3c3f7f26ce implement custom data type "trilean" (tri-state-boolean) to track booleans which have a "null" or "unset" state. Previously we used *bool for these template options, but it turns out that those won't work because "unset" will evaluate to "false" if a user is using template variables to set the option that maps to a *bool. 2019-08-22 13:18:15 -07:00
Adrien Delorme 4cb7c30987 Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-08-21 16:44:23 +02:00
Christian Muehlhaeuser 216afbaa8b
Fixed various typos
Just a bunch of nit-picky typo fixes.
2019-07-25 06:49:51 +02:00
Adrien Delorme 7a60990825 alicloud: use partials 2019-06-14 15:56:05 +02:00
Adrien Delorme daa9f9d34e Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-06-14 15:17:56 +02:00
Adrien Delorme cfda61b81f
Merge pull request #7747 from chhaj5236/bugfix/refine_io_optimize
let product API determine the default value of io_optimized
2019-06-14 11:58:03 +02:00
bozhi.ch b3277698f6 let product API determine the default value of io_optimized 2019-06-14 11:49:42 +08:00
bozhi.ch 6a5db1e948 cleanup image and snapshot if target image is still not available after timeout 2019-06-13 11:17:39 +08:00
Adrien Delorme 6e3dc1aa9a Merge remote-tracking branch 'origin/master' into scrape_doc_to_builder_struct_config 2019-06-12 14:28:11 +02:00
bozhi.ch 45249fc764 fix describing snapshots issue when image_ignore_data_disks is provided 2019-06-11 15:22:06 +08:00
Adrien Delorme 4bf6a56d71 split communitacor.SSH & communitacor.WinRM to facilitate documentation
put doc for communicator into the struct
2019-06-06 16:55:24 +02:00
Adrien Delorme 4399684372 make fmt autogenerated docs 2019-06-06 16:29:25 +02:00
Adrien Delorme e6cbb013ba add // go:generate struct-markdown to all previously edited files 2019-06-05 16:42:18 +02:00
Adrien Delorme f1917edd34 generate the comments for config struct of builders scraping doc website 2019-06-05 16:42:17 +02:00
wb-ywq399345 0da7b918ce support encryption with default service key 2019-04-26 15:12:07 +08:00