Skip to content

Commit 70a674c

Browse files
authored
Merge pull request #56 from IBM/encrypted-zprofile-makefile-fixes
Configuration for encrypted images, zprofiles and go-cty stable release and checks
2 parents 114a8ed + 995ff40 commit 70a674c

8 files changed

+460
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ To generate the packer plugin binary from source code follow these steps. An aut
250250
go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
251251
go get -d github.com/hashicorp/hcl/v2/hcldec@latest
252252
go get -d golang.org/x/crypto/ssh@latest
253-
go get -d github.com/zclconf/go-cty/cty@latest
253+
go get -d github.com/zclconf/go-cty/cty@v1.9.1
254254
go mod tidy
255255
go mod vendor
256256
go generate ./builder/ibmcloud/vpc/...

developer/Makefile

+11-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ setup:
44
cd ..; go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest
55
cd ..; go get github.com/hashicorp/hcl/v2/hcldec@latest
66
cd ..; go get golang.org/x/crypto/ssh@latest
7-
cd ..; go get github.com/zclconf/go-cty/cty@latest
7+
cd ..; go get github.com/zclconf/go-cty/cty@v1.9.1
88

99
plugin:
1010
cd ..; go mod tidy
@@ -23,21 +23,28 @@ validate-all:
2323
run-centos:
2424
cd ..; packer validate -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.centos.pkr.hcl
2525
cd ..; packer build -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.centos.pkr.hcl
26-
26+
2727
run-centos-parallel:
2828
cd ..; packer validate -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.centos-parallel.pkr.hcl
2929
cd ..; packer build -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.centos-parallel.pkr.hcl
3030

31-
3231
run-centos-ansible:
3332
cd ..; packer validate -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.centos-ansible.pkr.hcl
3433
cd ..; packer build -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.centos-ansible.pkr.hcl
3534

35+
run-centos-encrypted:
36+
cd ..; packer validate -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.centos-encrypted.pkr.hcl
37+
cd ..; packer build -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.centos-encrypted.pkr.hcl
38+
3639
run-rhel:
3740
cd ..; packer validate -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.rhel.pkr.hcl
3841
cd ..; packer build -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.rhel.pkr.hcl
3942

4043
run-windows:
4144
cd ..; packer init -upgrade developer/examples/build.vpc.windows.pkr.hcl
4245
cd ..; packer validate -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.windows.pkr.hcl
43-
cd ..; packer build -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.windows.pkr.hcl
46+
cd ..; packer build -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.windows.pkr.hcl
47+
48+
run-zprofile:
49+
cd ..; packer validate -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.zprofile.pkr.hcl
50+
cd ..; packer build -var-file="developer/variables.pkrvars.hcl" developer/examples/build.vpc.zprofile.pkr.hcl
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// packer {
2+
// required_plugins {
3+
// ibmcloud = {
4+
// version = ">=v3.0.0"
5+
// source = "github.com/IBM/ibmcloud"
6+
// }
7+
// }
8+
// }
9+
10+
variable "IBM_API_KEY" {
11+
type = string
12+
}
13+
14+
variable "SUBNET_ID" {
15+
type = string
16+
}
17+
18+
variable "REGION" {
19+
type = string
20+
}
21+
22+
variable "RESOURCE_GROUP_ID" {
23+
type = string
24+
}
25+
26+
variable "SECURITY_GROUP_ID" {
27+
type = string
28+
}
29+
30+
locals {
31+
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
32+
}
33+
34+
source "ibmcloud-vpc" "centos-encrypted-image" {
35+
api_key = var.IBM_API_KEY
36+
region = var.REGION
37+
subnet_id = var.SUBNET_ID
38+
resource_group_id = var.RESOURCE_GROUP_ID
39+
security_group_id = var.SECURITY_GROUP_ID
40+
41+
vsi_base_image_name = "test-encrypted-packer-img"
42+
43+
vsi_profile = "bx2-2x8"
44+
vsi_interface = "public"
45+
vsi_user_data_file = ""
46+
47+
image_name = "packer-encrypted-image-${local.timestamp}"
48+
49+
communicator = "ssh"
50+
ssh_username = "root"
51+
ssh_port = 22
52+
ssh_timeout = "15m"
53+
54+
timeout = "30m"
55+
}
56+
57+
build {
58+
sources = [
59+
"source.ibmcloud-vpc.centos-encrypted-image"
60+
]
61+
62+
provisioner "shell" {
63+
execute_command = "{{.Vars}} bash '{{.Path}}'"
64+
inline = [
65+
"echo 'Hello from IBM Cloud Packer Plugin - VPC Infrastructure'",
66+
"echo 'Hello from IBM Cloud Packer Plugin - VPC Infrastructure' >> /hello.txt"
67+
]
68+
}
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// packer {
2+
// required_plugins {
3+
// ibmcloud = {
4+
// version = ">=v3.0.0"
5+
// source = "github.com/IBM/ibmcloud"
6+
// }
7+
// }
8+
// }
9+
10+
variable "IBM_API_KEY" {
11+
type = string
12+
}
13+
14+
variable "SUBNET_ID" {
15+
type = string
16+
}
17+
18+
variable "REGION" {
19+
type = string
20+
}
21+
22+
variable "RESOURCE_GROUP_ID" {
23+
type = string
24+
}
25+
26+
variable "SECURITY_GROUP_ID" {
27+
type = string
28+
}
29+
// variable "VPC_URL" {
30+
// type = string
31+
// }
32+
// variable "IAM_URL" {
33+
// type = string
34+
// }
35+
36+
37+
locals {
38+
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
39+
}
40+
41+
source "ibmcloud-vpc" "centos" {
42+
api_key = var.IBM_API_KEY
43+
region = var.REGION
44+
subnet_id = var.SUBNET_ID
45+
resource_group_id = var.RESOURCE_GROUP_ID
46+
security_group_id = var.SECURITY_GROUP_ID
47+
48+
vsi_base_image_name = "ibm-centos-7-9-minimal-amd64-5"
49+
50+
vsi_profile = "bx2-2x8"
51+
vsi_interface = "public"
52+
vsi_user_data_file = ""
53+
54+
image_name = "packer-${local.timestamp}-1"
55+
56+
communicator = "ssh"
57+
ssh_username = "root"
58+
ssh_port = 22
59+
ssh_timeout = "15m"
60+
61+
timeout = "30m"
62+
}
63+
64+
source "ibmcloud-vpc" "centos-other" {
65+
api_key = var.IBM_API_KEY
66+
region = var.REGION
67+
subnet_id = var.SUBNET_ID
68+
resource_group_id = var.RESOURCE_GROUP_ID
69+
security_group_id = var.SECURITY_GROUP_ID
70+
71+
vsi_base_image_name = "ibm-centos-7-9-minimal-amd64-5"
72+
73+
vsi_profile = "bx2-2x8"
74+
vsi_interface = "public"
75+
vsi_user_data_file = ""
76+
77+
image_name = "packer-${local.timestamp}-2"
78+
79+
communicator = "ssh"
80+
ssh_username = "root"
81+
ssh_port = 22
82+
ssh_timeout = "15m"
83+
84+
timeout = "30m"
85+
}
86+
87+
build {
88+
sources = [
89+
"source.ibmcloud-vpc.centos",
90+
"source.ibmcloud-vpc.centos-other"
91+
]
92+
93+
provisioner "shell" {
94+
execute_command = "{{.Vars}} bash '{{.Path}}'"
95+
inline = [
96+
"echo 'Hello from IBM Cloud Packer Plugin - VPC Infrastructure'",
97+
"echo 'Hello from IBM Cloud Packer Plugin - VPC Infrastructure' >> /hello.txt"
98+
]
99+
}
100+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// packer {
2+
// required_plugins {
3+
// ibmcloud = {
4+
// version = ">=v2.2.0"
5+
// source = "github.com/IBM/ibmcloud"
6+
// }
7+
// }
8+
// }
9+
10+
variable "IBM_API_KEY" {
11+
type = string
12+
}
13+
14+
variable "SUBNET_ID" {
15+
type = string
16+
}
17+
18+
variable "REGION" {
19+
type = string
20+
}
21+
22+
variable "RESOURCE_GROUP_ID" {
23+
type = string
24+
}
25+
26+
variable "SECURITY_GROUP_ID" {
27+
type = string
28+
}
29+
30+
locals {
31+
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
32+
}
33+
34+
source "ibmcloud-vpc" "zprofile" {
35+
api_key = var.IBM_API_KEY
36+
region = var.REGION
37+
38+
subnet_id = var.SUBNET_ID
39+
resource_group_id = var.RESOURCE_GROUP_ID
40+
security_group_id = var.SECURITY_GROUP_ID
41+
42+
vsi_base_image_name = "ibm-zos-2-4-s390x-dev-test-wazi-1"
43+
vsi_profile = "bz2-2x8"
44+
vsi_interface = "public"
45+
vsi_user_data_file = ""
46+
47+
image_name = "packer-zprofile-${local.timestamp}"
48+
49+
communicator = "ssh"
50+
ssh_username = "ibmuser"
51+
ssh_port = 22
52+
ssh_timeout = "20m"
53+
54+
timeout = "20m"
55+
}
56+
57+
build {
58+
sources = [
59+
"source.ibmcloud-vpc.zprofile"
60+
]
61+
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
packer {
2+
required_plugins {
3+
ibmcloud = {
4+
version = ">=v3.0.0"
5+
source = "github.com/IBM/ibmcloud"
6+
}
7+
}
8+
}
9+
10+
variable "ibm_api_key" {
11+
type = string
12+
default = "${env("IBM_API_KEY")}"
13+
}
14+
15+
variable "REGION" {
16+
type = string
17+
}
18+
19+
variable "RESOURCE_GROUP_ID" {
20+
type = string
21+
}
22+
23+
variable "SECURITY_GROUP_ID" {
24+
type = string
25+
}
26+
27+
locals {
28+
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
29+
}
30+
31+
source "ibmcloud-vpc" "centos-encrypted-image" {
32+
api_key = "${var.ibm_api_key}"
33+
region = "us-south"
34+
subnet_id = "0717-4ad0af5f-8084-469d-a10e-49c444caa312"
35+
resource_group_id = ""
36+
security_group_id = ""
37+
38+
vsi_base_image_name = "test-encrypted-packer-img"
39+
40+
vsi_profile = "bx2-2x8"
41+
vsi_interface = "public"
42+
vsi_user_data_file = ""
43+
44+
image_name = "packer-encrypted-image-${local.timestamp}"
45+
46+
communicator = "ssh"
47+
ssh_username = "root"
48+
ssh_port = 22
49+
ssh_timeout = "15m"
50+
51+
timeout = "30m"
52+
}
53+
54+
build {
55+
sources = [
56+
"source.ibmcloud-vpc.centos-encrypted-image"
57+
]
58+
59+
provisioner "shell" {
60+
execute_command = "{{.Vars}} bash '{{.Path}}'"
61+
inline = [
62+
"echo 'Hello from IBM Cloud Packer Plugin - VPC Infrastructure'",
63+
"echo 'Hello from IBM Cloud Packer Plugin - VPC Infrastructure' >> /hello.txt"
64+
]
65+
}
66+
}

0 commit comments

Comments
 (0)