246 Commits

Author SHA1 Message Date
nywilken
1eb55c2ae3 builder/azure: Remove double override of GalleryImageVersionsClient.PollDuration
This change fixes an issues where custom timeouts set for the
GalleryImagesVersionClient was being over written by the default client
poll duration.
2019-12-17 10:47:32 -05: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
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
5614f307fb regerate code
generate flat FlatPolicyDocument
add PolicyDocument to generate command
2019-10-23 10:46:07 -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
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
Adrien Delorme
8b76453e7f make generate 2019-10-16 10:50:45 +02:00
Adrien Delorme
cf1555bf17 Merge remote-tracking branch 'origin/master' into artifact-tree 2019-10-16 10:22:56 +02:00
Paul Meyer
575de8659e
Merge pull request #8226 from larohra/IncreasePollingDuration
[azure] Increase polling duration
2019-10-15 16:25:36 -07:00
Adrien Delorme
078ba7c8c3 commit old code generation tool
for history
2019-10-15 12:56:42 +02:00
Adrien Delorme
f8402f1b91 builder.azure.common: make CloudEnvironment private so it doesn't temper with hcl2 code generation
the struct is not read from file but later set after some computations
2019-10-15 12:56:41 +02:00
larohra
936ae42b00 Added a new parameter in config to override the default Azure Go SDK PollingDuration timeout 2019-10-11 15:29:02 -07:00
Davor Kapsa
29a6938de6
clean and return nil for retry.Config 2019-10-10 20:48:26 +02:00
Sumit Kalra
4bd09f381e
Fixing documentation (#6) 2019-10-10 11:30:28 -07:00
Davor Kapsa
4c615341ef
Ignore retry.Config var
retry.Config is struct.
Call it err is wrong.
2019-10-10 17:33:24 +02:00
Davor Kapsa
fb267dd1dc
Add error check 2019-10-09 21:08:40 +02:00
Sumit Kalra
595b103bbe
Adding NSG to the ARM deployment template when needed (#3)
* Adding NSG to the ARM eployment template when needed

* Adding tests and fixing bugs

* Removing denyall rule

* Fixing logic to determine which port to open

* Fixing config description
2019-10-08 14:56:43 -07:00
larohra
23c320d59e Increased the default polling duration to 60mins 2019-09-30 16:17:22 -07:00
Sumit Kalra
91d19adcd7 Ensuring that specifying allowed inbound IP and VNet are mutually exclusive (#2) 2019-09-26 23:33:18 +00:00
Sumit Kalra
132779c343 Adding config to specify allowed inbound IP addresses and CIDR blocks (#1)
* Adding config to specify allowed inbound IP addresses

* Also allowing CIDR blocks in addition to IP addresses
2019-09-26 23:31:28 +00:00
Paul Meyer
094a8840d8 Improve comments for FillParameters 2019-09-25 20:33:38 +00:00
Paul Meyer
feeae1514e Refactor client config 2019-09-25 20:33:38 +00:00
Adrien Delorme
a841da960d Merge branch 'master' of ssh://github.com/hashicorp/packer into scrape_doc_to_builder_struct_config 2019-08-30 15:10:29 +02:00
Adrien Delorme
f11341c0b4 azure builder: avoid a panic in getObjectIdFromToken 2019-08-29 10:34:59 +02:00
Adrien Delorme
f66ca58a46 Update azure docs for config.go
add missing docs fields

Co-Authored-By: Megan Marsh <swampdragons@users.noreply.github.com>
2019-08-27 09:32:03 +02:00
Adrien Delorme
783b02bd15 Update config.go
add missing doc  fields

Co-Authored-By: Megan Marsh <swampdragons@users.noreply.github.com>
2019-08-27 09:28:36 +02: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
Megan Marsh
6a201211a9 fix polling issues in azure
adds a configurable timeout to the shared image gallery publisher
2019-08-01 11:18:03 -07:00
Christian Muehlhaeuser
216afbaa8b
Fixed various typos
Just a bunch of nit-picky typo fixes.
2019-07-25 06:49:51 +02:00
Amrita Dutta
4c09dfde87 Fix bug while publishing SIG destination id for every managed image 2019-07-04 00:44:05 +00:00
Amrita Dutta
78be7ab4e4 fix typo 2019-06-24 16:57:07 +00:00
Amrita Dutta
ba76d86cab remove comment 2019-06-21 03:51:44 +00:00
Amrita Dutta
85036231c4 Final commit 2019-06-21 02:47:39 +00:00
Amrita Dutta
78f001431e add example config file 2019-06-19 07:18:08 +00:00
Amrita Dutta
994dca5f78 fix bug in step_publish w.r.t managed image RG 2019-06-19 06:53:20 +00:00
Amrita Dutta
963336d421 Remove un-intended import 2019-06-19 06:42:55 +00:00
Amrita Dutta
76dbf4fb3b Remove subscription id from SIG destination input 2019-06-19 06:10:18 +00:00
Amrita Dutta
1d6de7167f Another update to replication logic 2019-06-18 23:51:10 +00:00
Amrita Dutta
de591cff77 Fix append in builder.go 2019-06-18 23:48:38 +00:00
Amrita Dutta
f7e08a097a Replication region changes 2019-06-18 23:41:14 +00:00
Amrita Dutta
c9cdb34589 Update validation logic for missing replication region 2019-06-18 06:39:43 +00:00
Amrita Dutta
f1f93f0665 normalize replication regions 2019-06-18 06:01:22 +00:00
Amrita Dutta
59a0f7f6e6 add validation checks for replication regions + formatting 2019-06-18 05:34:26 +00:00
Amrita Dutta
d13b9574d6 Use user - provided version number instead of generating timestamp on our own 2019-06-17 22:54:37 +00:00
Amrita Dutta
34dac69112 pass subscription id via state bag 2019-06-17 22:08:10 +00:00
Amrita Dutta
540c904fd4 add missing check to not publish to SIG if config.SharedGalleryDestination.SigDestinationGalleryName is null 2019-06-17 19:13:03 +00:00
Ubuntu
6504d3ae5c Changes to ARM builder for publishing to SIG 2019-06-14 21:54:27 +00:00
Ubuntu
fb9fd58dfb Imports for publishing to SIG 2019-06-07 20:47:37 +00:00
Adrien Delorme
d81ca5728d azure-arm: rewrap struct comments for documentation generation 2019-06-06 17:34:17 +02:00
Adrien Delorme
4399684372 make fmt autogenerated docs 2019-06-06 16:29:25 +02:00