diff --git a/docs/index.html b/docs/index.html index 01deb01..31ac8ff 100644 --- a/docs/index.html +++ b/docs/index.html @@ -244,6 +244,12 @@
  • Override
  • +
  • + SSH Block +
  • +
  • + WinRM Block +
  • @@ -696,9 +702,271 @@

    A Complete Example:

    }
     

    This is an example with both ordering of provisioners and sequence definition of post-processors

    -

    Special Notes

    Named Build

    Ordering in Provisioners

    Sequence Definition

    Override

    Builders

    Alicloud ECS

    +

    Special Notes

    Named Build

    data "packer_json" "default" {
    +    builders {
    +        null {
    +            communicator = "ssh"
    +            name = "test"
    +            ssh {
    +                ssh_username = "test_username"
    +                ssh_password = "test_password"
    +            }
    +        }
    +
    +        null {
    +            communicator = "ssh"
    +            name = "test2"
    +            ssh {
    +                ssh_username = "test_username"
    +                ssh_password = "test_password"
    +            }
    +        }
    +    }
    +}
    +
    {
    +  "builders": [
    +    {
    +      "communicator": "ssh",
    +      "name": "test",
    +      "ssh_password": "test_password",
    +      "ssh_username": "test_username",
    +      "type": "null"
    +    },
    +    {
    +      "communicator": "ssh",
    +      "name": "test2",
    +      "ssh_password": "test_password",
    +      "ssh_username": "test_username",
    +      "type": "null"
    +    }
    +  ],
    +  "post-processors": [],
    +  "provisioners": []
    +}
    +
    +

    To create named builders to use name parameter in the block

    +

    Ordering in Provisioners

    data "packer_json" "default" {
    +    provisioners {
    +        shell {
    +            execute_order = 1
    +            script = "echo 'Hi'"
    +        }
    +
    +        shell {
    +            execute_order = 2
    +            script = "echo 'Hi Again'"
    +        }
    +    }
    +}
    +
    {
    +  "builders": [],
    +  "post-processors": [],
    +  "provisioners": [
    +    {
    +      "script": "echo 'Hi'",
    +      "type": "shell"
    +    },
    +    {
    +      "script": "echo 'Hi Again'",
    +      "type": "shell"
    +    }
    +  ]
    +}
    +
    +

    Because terraform is a declarative language, and provisioners block is execute by the order, a workaround is introduced.

    + +

    execute_order is a require parameter in all provisioner, it denote the order of the current provisioner in the resulting json

    +

    Sequence Definition

    data "packer_json" "default" {
    +    post_processors {
    +        compress {
    +            pipeline {
    +                set = 1 
    +                order = 1
    +            }
    +        }
    +
    +        checksum {
    +            pipeline {
    +                set = 1 
    +                order = 2
    +            }
    +        }
    +
    +        manifest {}
    +    }
    +}
    +
    {
    +  "builders": [],
    +  "post-processors": [
    +    {
    +      "type": "manifest"
    +    },
    +    [
    +      {
    +        "type": "compress"
    +      },
    +      {
    +        "type": "checksum"
    +      }
    +    ]
    +  ],
    +  "provisioners": []
    +}
    +
    +

    Same situation as ordering in provisioners, to create sequence definition in post-processors a workaround was introduced

    + +

    pipeline block consists two require parameter, order and set.

    + +

    set denote the sequence set, in scenario that a person want multiple sequence definition

    + +

    order denote the order of the current post-processor in the sequence

    +

    Override

    data "packer_json" "default" {
    +    provisioners {
    +        shell {
    +            execute_order = 1
    +
    +            execute_command = "Not again"
    +
    +            override =<<EOF
    +            {
    +                "vmware-iso": {
    +                    "execute_command":"Hi"
    +                }
    +            }
    +EOF
    +        }
    +    }
    +}
    +
    {
    +  "builders": [],
    +  "post-processors": [],
    +  "provisioners": [
    +    {
    +      "execute_command": "Not again",
    +      "override": {
    +        "vmware-iso": {
    +          "execute_command": "Hi"
    +        }
    +      },
    +      "type": "shell"
    +    }
    +  ]
    +}
    +
    +

    As of now, terraform has issue dealing multi-depth type with map, so a workaround for override is introduce, the parameter accept string, but is recommended to use heredoc, also the string will be validated to ensure is a valid json string

    +

    SSH Block

    data "packer_json" "default" {
    +    builders {
    +        virtualbox_iso {
    +            iso {
    +                iso_url = "test"
    +                iso_checksum = "test"
    +                iso_checksum_type = "none"
    +            }
    +
    +            ssh {
    +                ssh_username = "test"
    +                ssh_password = "test"
    +            }
    +        }
    +    }
    +}
    +
    {
    +  "builders": [
    +    {
    +      "iso_checksum": "test",
    +      "iso_checksum_type": "none",
    +      "iso_url": "test",
    +      "ssh_password": "test",
    +      "ssh_username": "test",
    +      "type": "virtualbox-iso"
    +    }
    +  ],
    +  "post-processors": [],
    +  "provisioners": []
    +}
    +
    +

    SSH in builders that supported are in its own block

    +

    WinRM Block

    data "packer_json" "default" {
    +    builders {
    +        virtualbox_iso {
    +            iso {
    +                iso_url = "test"
    +                iso_checksum = "test"
    +                iso_checksum_type = "none"
    +            }
    +
    +            winrm {
    +                winrm_username = "test"
    +                winrm_password = "test"
    +            }
    +        }
    +    }
    +}
    +
    {
    +  "builders": [
    +    {
    +      "iso_checksum": "test",
    +      "iso_checksum_type": "none",
    +      "iso_url": "test",
    +      "type": "virtualbox-iso",
    +      "winrm_password": "test",
    +      "winrm_username": "test"
    +    }
    +  ],
    +  "post-processors": [],
    +  "provisioners": []
    +}
    +
    +

    WinRM in builders that supported are in its own block

    +

    Builders

    Alicloud ECS

    Block Name: alicloud_ecs

    -

    Amazon Chroot

    + +

    Special Note:

    +

    image_disk_mappings

    data "packer_json" "default" {
    +    builders {
    +        alicloud_ecs {
    +            access_key = "none"
    +            secret_key = "none"
    +            region = "none"
    +            image_name = "none"
    +            source_image = "none"
    +            instance_type = "none"
    +
    +            image_disk_mapping {
    +                disk_category = "cloud_ssd"
    +            }
    +
    +            image_disk_mapping {
    +                disk_category = "cloud"
    +            }
    +        }
    +    }
    +
    +}
    +
    {
    +  "builders": [
    +    {
    +      "access_key": "none",
    +      "image_disk_mappings": [
    +        {
    +          "disk_category": "cloud_ssd"
    +        },
    +        {
    +          "disk_category": "cloud"
    +        }
    +      ],
    +      "image_name": "none",
    +      "instance_type": "none",
    +      "region": "none",
    +      "secret_key": "none",
    +      "source_image": "none",
    +      "type": "alicloud-ecs"
    +    }
    +  ],
    +  "post-processors": [],
    +  "provisioners": []
    +}
    +

    Amazon Chroot

    Block Name: amazon_chroot

    Amazon EBS

    Block Name: amazon_ebs

    @@ -754,7 +1022,57 @@

    Triton

    Block Name: triton

    Virtualbox ISO

    Block Name: virtualbox_iso

    -

    Virtualbox OVF

    +
    data "packer_json" "default" {
    +    builders {
    +        virtualbox_iso {
    +            communicator = "ssh"
    +            iso {
    +                iso_url = "test"
    +                iso_checksum = "test"
    +                iso_checksum_type = "none"
    +            }
    +
    +            vboxmanage {
    +                values = [ "modifyvm", "{{.Name}}", "--memory", "1024"]
    +            }
    +
    +            vboxmanage {
    +                values = [ "modifyvm", "{{.Name}}", "--cpus", "1" ]
    +            }
    +
    +        }
    +    }
    +}
    +
    {
    +  "builders": [
    +    {
    +      "communicator": "ssh",
    +      "iso_checksum": "test",
    +      "iso_checksum_type": "none",
    +      "iso_url": "test",
    +      "type": "virtualbox-iso",
    +      "vboxmanage": [
    +        [
    +          "modifyvm",
    +          "{{.Name}}",
    +          "--memory",
    +          "1024"
    +        ],
    +        [
    +          "modifyvm",
    +          "{{.Name}}",
    +          "--cpus",
    +          "1"
    +        ]
    +      ]
    +    }
    +  ],
    +  "post-processors": [],
    +  "provisioners": []
    +}
    +
    +

    Special Note:

    +

    vboxmanage and vboxmanage_post

    Virtualbox OVF

    Block Name: virtualbox_ovf

    VMware ISO

    Block Name: vmware_iso