810 Commits

Author SHA1 Message Date
Wilken Rivera
e515aefee3 Add validation checks for session_manager
* Session manager connectivity only supported via SSH
* Session manager requires the use of an iam instance profile with system manager permissions
2020-05-08 09:32:48 -04:00
Wilken Rivera
c1d2477d18 builder/amzon: Update port configuration for WinRM
Connectivity for WinRM works for the initial connection, but fails to upload any provisioning scripts - need to dive in deeper.
For now connectivity over SSH works as expected.
2020-05-08 09:32:48 -04:00
Wilken Rivera
fbffbd1899 docs/builder/amazon: Add short blurb for connecting via the AWS session_manager interface 2020-05-08 09:32:48 -04:00
Wilken Rivera
520061dee6 builder/amazon: Update Session Manger connectivity
* Update security group creation step skip ingress rules if using session manager
* Update create ssm tunnel step to dynamically set a session port
* Add SSHPort function to common to return session-manager tunnel port
* Update SSHHost to return proper host for session-manager
2020-05-08 09:32:48 -04:00
Wilken Rivera
3dd46eb5f4 Add PoC of connectivity using session-manager-plugin
* Add a bunch of hard coded values for testing on port 8081; ssh configs
are set to localhost and 8081
* Add a base drive for communicating with the session manager plugin
* Update step for creating tunnel to actually create SSM session tunnel via driver
2020-05-08 09:32:48 -04:00
Wilken Rivera
16604373ac initial ssm tunnel changes - not working 2020-05-08 09:32:48 -04:00
Megan Marsh
f0d2680426
remove spot_price_auto_product from docs (#9173) 2020-05-05 20:48:27 -04: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
9165be87da
packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
Jeff Escalante
4afd107eeb
patch source files for extensions changes 2020-04-07 17:50:51 -04:00
Megan Marsh
8ae6256c03 add test of NoEphemeral 2020-03-24 09:10:31 -07:00
Megan Marsh
fc36a37db8 only set NoDevice if NoEphemeral is set; otherwise, legit block device mappings get destroyed 2020-03-24 08:51:32 -07:00
Adrien Delorme
fab344a1fc Update ami_config.go
quote string  in err
2020-03-17 15:41:58 +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
3cae1a81ef up tests 2020-03-16 17:54:52 +01:00
Adrien Delorme
d532bb376c wip 2020-03-16 17:47:44 +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
e1c84806cc rewrap 2020-03-16 14:55:03 +01:00
Adrien Delorme
fc837e3698 Update run_config.go 2020-03-16 12:36:20 +01:00
Adrien Delorme
ce8d3d3747 wip 2020-03-16 12:35:25 +01:00
Adrien Delorme
dab689ce2e WIP 2020-03-16 12:19:34 +01:00
Adrien Delorme
dbb4981d66 WIP 2020-03-16 12:13:05 +01:00
Adrien Delorme
6e6490d688 WIP 2020-03-13 18:04:48 +01:00
Adrien Delorme
260dc59500 use the hcl2template.KVFilter where we can 2020-03-13 17:17:46 +01:00
Wilken Rivera
7b705545d9
docs: Various doc clean-ups to fix code block formatting and syntax highlighting (#8868) 2020-03-12 15:05:08 +01:00
Megan Marsh
4133acbdf3 update spot price docs 2020-03-09 08:46:30 -07:00
Wilken Rivera
e1a46ec293
Fix gosimple S1025 linting errors (#8838)
Remove unneeded use of fmt.Sprintf for variables that are already strings.
2020-03-04 15:31:30 -05:00
Megan Marsh
dde74232f2
Clearly document all template-engine-enabled options (#8770) 2020-02-20 11:05:27 +01:00
Wilken Rivera
9ec8b67392
Add golangci-lint to project (#8686)
* Add golangci-lint as linting tool

* Disable failing staticchecks to start; GitHub issue to handle coming soon

* Run `goimports -w` to repair all source files that have improperly
formatted imports

* makefile: Add ci-lint target to run on travis

This change adds a new make target for running golangci-lint on newly
added Go files only. This target is expected to run during Packer ci builds.

* .github/contributing: Add code linting instructions

* travis: Update job configuration to run parallel builds
2020-02-14 11:42:29 -05:00
Adrien Delorme
7d5f0c11af add max_retries option to aws builders 2020-02-07 16:36:14 +01:00
Wilken Rivera
a1d9ba0e32
Merge pull request #8699 from fly1028/fix-instance-running-timeout
Instance Running waiter not aware of global waiter settings
2020-02-06 17:18:59 -05:00
Patrick Ng
e5e5fd1198 Instance Running waiter not aware of global waiter settings 2020-02-05 15:09:09 -08:00
Megan Marsh
d252a24b82 allow user to set winrm_host override like we do ssh_host override 2020-01-30 15:22:22 -08:00
Sylvia Moss
dc31bad539
Sharing info with post-processors via artifact (#8632) 2020-01-30 11:27:58 +01:00
nywilken
d2a9e6b32e Format code with gofmt -s -w 2020-01-28 16:52:50 -05:00
Wilken Rivera
111bab86d9
Merge pull request #8622 from datalot/pre-validate-with-filters
Allow aws builder pre validation to pass when subnet filters are present
2020-01-22 15:00:44 -05:00
Sylvia Moss
0b7251a4bb
Share .Device and .MountPath between builders, provisioners and post-processors (#8621) 2020-01-20 16:29:38 +01:00
Rich Cavanaugh
4fb0de5256 allow validation to pass when subnet filters are present 2020-01-17 11:57:42 -05:00
Sylvia Moss
39c25b2c66
Add retry mechanism to amazon DeleteSnapshot (#8614) 2020-01-16 14:38:46 +01:00
Sylvia Moss
0677b02e18
Share SourceImageName with provisioners and manifest post-processor (#8603) 2020-01-16 12:04:03 +01:00
Sylvia Moss
0e177915f8
Add retry mechanism to DeregisterImage from awsec2 (#8598) 2020-01-15 10:28:14 +01:00
Megan Marsh
b7ee807cf1
Merge pull request #8571 from hashicorp/fix_8565
fix ssh interface docs for amazon builders
2020-01-06 14:34:40 -08:00
Megan Marsh
6655f93b59 fix typo and regenerate code 2020-01-06 14:12:29 -08:00
Megan Marsh
76251e5fd2 fix ssh interface docs for amazon builders 2020-01-06 12:01:30 -08:00
Trevor Pounds
47e48ebc24 Add source AMI owner ID/name to build template. 2019-12-30 14:04:49 -05: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
84063d2132 implement ID and Type values in the provisioner template info sharing 2019-12-13 11:57:01 -08:00
Megan Marsh
6f418d0e54 get data sharing to a working state with the powershell provisioner 2019-12-11 15:43:38 -08:00