Skip to content

Commit a0c293d

Browse files
committed
test iap use
Signed-off-by: Glen Yu <glen.yu@gmail.com>
1 parent 6221735 commit a0c293d

File tree

6 files changed

+33
-9
lines changed

6 files changed

+33
-9
lines changed

.github/workflows/packer.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Packer Build
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, dev]
66
paths-ignore: ['**/README.md','**/CHANGELOG.md', 'terraform/*']
77

88
env:
@@ -37,6 +37,12 @@ jobs:
3737
with:
3838
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
3939
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'
40+
- name: 'Set up Google Cloud SDK'
41+
uses: 'google-github-actions/setup-gcloud@v2'
42+
with:
43+
version: 'latest'
44+
project_id: '${{ vars.GCP_PROJECT_ID }}'
45+
install_components: 'beta' # optional: install additional components
4046

4147
- name: Setup `packer`
4248
uses: hashicorp/setup-packer@main

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77

8+
## [1.2.0] - 2025-??-??
9+
### Added
10+
- `dev` branch to GHA trigger
11+
- `Set up Google Cloud SDK` step to the GHA job steps
12+
- using IAP to connect to the VM to build (which requires Google Cloud SDK)
13+
- `use_iap` = true
14+
- `preemptible` = true
15+
### Changed
16+
- Updated Consul version from `1.20.5` to `1.21.0`
17+
- Updated Nomad version from `1.9.7` to `1.10.0`
18+
- Updated Vault version from `1.19.0` to `1.19.3`
19+
820
## [1.1.0] - 2025-03-26
921
### Added
1022
- Consul backend storage config example to `vault_server.hcl.sample`

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ You will need to add the following secrets to GitHub:
6464
- `HCP_CLIENT_SECRET`
6565

6666
**NOTE**: You can track up to ~~[10 buckets (images) for free](https://www.hashicorp.com/products/packer/pricing)~~, but if you do not wish to, you can always comment out `hcp_packer_registry` block from the image build template file(s).
67+
6768
**UPDATE**: As of [v1.1.0](https://github.com/Neutrollized/packer-gcp-with-githubactions/blob/main/CHANGELOG.md#110---2025-03-26), due to recent HCP Packer pricing changes, there's no longer a free tier and hence I've commented out `hcp_packer_registry` references as it's always been my goal to keep my repos/deployments as cost-effective as possible for learning.
6869

6970

base-docker/base_docker.pkr.hcl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,19 @@ source "googlecompute" "base-docker" {
2626
project_id = var.project_id
2727
zone = var.zone
2828
machine_type = "n1-standard-2"
29-
ssh_username = "packer"
30-
use_os_login = "false"
29+
preemptible = true
3130

3231
# gcloud compute images list
3332
source_image_family = var.source_image_family
3433

35-
image_family = var.image_family
36-
image_name = "docker-${var.arch}-base-${local.datestamp}"
37-
image_description = "Debian 12 image with Docker-CE installed"
34+
image_family = var.image_family
35+
image_architecture = var.arch
36+
image_name = "docker-${var.arch}-base-${local.datestamp}"
37+
image_description = "Debian 12 image with Docker-CE installed"
38+
39+
ssh_username = "packer"
40+
use_os_login = false
41+
use_iap = true
3842

3943
tags = ["packer"]
4044
}

hashistack/variables.pkrvars.hcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
zone = "northamerica-northeast2-c"
22
arch = "amd64"
33

4-
consul_version = "1.20.5"
5-
nomad_version = "1.9.7"
6-
vault_version = "1.19.0"
4+
consul_version = "1.21.0"
5+
nomad_version = "1.10.0"
6+
vault_version = "1.19.3"

terraform/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ variable "packer_sa_iam_roles_list" {
2727
default = [
2828
"roles/compute.instanceAdmin.v1",
2929
"roles/iam.serviceAccountUser",
30+
"roles/iap.tunnelResourceAccessor",
3031
]
3132
}
3233

0 commit comments

Comments
 (0)