more hcl2 basic examples
This commit is contained in:
parent
97848df9e1
commit
01e14e173a
|
@ -49,6 +49,9 @@ builder.
|
|||
|
||||
Here is a basic example for Alicloud.
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"variables": {
|
||||
|
@ -79,6 +82,45 @@ Here is a basic example for Alicloud.
|
|||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
variable "access_key" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "secret_key" {
|
||||
type = string
|
||||
}
|
||||
|
||||
source "alicloud-ecs" "basic-example" {
|
||||
access_key = var.access_key
|
||||
secret_key = var.secret_key
|
||||
region = "cn-beijing"
|
||||
image_name = "packer_test2"
|
||||
source_image = "centos_7_04_64_20G_alibase_201701015.vhd"
|
||||
ssh_username = "root"
|
||||
instance_type = "ecs.n1.tiny"
|
||||
io_optimized = true
|
||||
internet_charge_type = "PayByTraffic"
|
||||
image_force_delete = true
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["sources.alicloud-ecs.basic-example"]
|
||||
|
||||
provisioner "shell" {
|
||||
inline = [
|
||||
"sleep 30", "yum install redis.x86_64 -y",
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
~> Note: Images can become deprecated after a while; run
|
||||
`aliyun ecs DescribeImages` to find one that exists.
|
||||
|
||||
|
|
|
@ -165,6 +165,9 @@ Providing `temp_resource_group_name` or `location` in combination with
|
|||
|
||||
Here is a basic example for Azure.
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "azure-arm",
|
||||
|
@ -193,6 +196,42 @@ Here is a basic example for Azure.
|
|||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
source "azure-arm" "basic-example" {
|
||||
client_id = "fe354398-d7sf-4dc9-87fd-c432cd8a7e09"
|
||||
client_secret = "keepitsecret&#*$"
|
||||
resource_group_name = "packerdemo"
|
||||
storage_account = "virtualmachines"
|
||||
subscription_id = "44cae533-4247-4093-42cf-897ded6e7823"
|
||||
tenant_id = "de39842a-caba-497e-a798-7896aea43218"
|
||||
|
||||
capture_container_name = "images"
|
||||
capture_name_prefix = "packer"
|
||||
|
||||
os_type = "Linux"
|
||||
image_publisher = "Canonical"
|
||||
image_offer = "UbuntuServer"
|
||||
image_sku = "14.04.4-LTS"
|
||||
|
||||
azure_tags = {
|
||||
dept = "engineering"
|
||||
}
|
||||
|
||||
location = "West US"
|
||||
vm_size = "Standard_A2"
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["sources.azure-arm.basic-example"]
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Deprovision
|
||||
|
||||
Azure VMs should be deprovisioned at the end of every build. For Windows this
|
||||
|
|
|
@ -194,6 +194,9 @@ to update your VM.
|
|||
Set the `ARM_IMAGE_RESOURCEGROUP_ID` variable to an existing resource group in the
|
||||
subscription where the resulting image will be created.
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"variables": {
|
||||
|
@ -224,3 +227,43 @@ subscription where the resulting image will be created.
|
|||
]
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
variable "client_id" {
|
||||
type = string
|
||||
}
|
||||
variable "client_secret" {
|
||||
type = string
|
||||
}
|
||||
variable "subscription_id" {
|
||||
type = string
|
||||
}
|
||||
variable "resource_group" {
|
||||
type = string
|
||||
}
|
||||
|
||||
source "azure-chroot" "basic-example" {
|
||||
client_id = var.client_id
|
||||
client_secret = var.client_secret
|
||||
subscription_id = var.subscription_id
|
||||
|
||||
image_resource_id = "/subscriptions/${var.subscription_id}/resourceGroups/${var.resource_group}/providers/Microsoft.Compute/images/MyDebianOSImage-{{timestamp}}"
|
||||
|
||||
source = "credativ:Debian:9:latest"
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["sources.azure-chroot.basic-example"]
|
||||
|
||||
provisioner "shell" {
|
||||
inline = ["apt-get update", "apt-get upgrade -y"]
|
||||
inline_shebang = "/bin/sh -x"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
|
|
@ -23,6 +23,9 @@ artifact.
|
|||
Below is a fully functioning example. It doesn't do anything useful, since no
|
||||
provisioners are defined, but it will connect to the specified host via ssh.
|
||||
|
||||
<Tabs>
|
||||
<Tab heading="JSON">
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "null",
|
||||
|
@ -32,6 +35,25 @@ provisioners are defined, but it will connect to the specified host via ssh.
|
|||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab heading="HCL2">
|
||||
|
||||
```hcl
|
||||
source "null" "basic-example" {
|
||||
ssh_host = "127.0.0.1"
|
||||
ssh_username = "foo"
|
||||
ssh_password = "bar"
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["sources.null.basic-example"]
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
|
||||
## Configuration Reference
|
||||
|
||||
The null builder has no configuration parameters other than the
|
||||
|
|
Loading…
Reference in New Issue