Skip to content

feat: create an image without flexible IP - #371

Merged
remyleone merged 1 commit into
scaleway:mainfrom
apoiget:main
Dec 3, 2026
Merged

remyleone merged 1 commit into
scaleway:mainfrom
apoiget:main

Conversation

@apoiget

@apoiget apoiget commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

feature to create with packer an instance without public IP, the packer communicator use the first private network

Closes #313


$ cat scw.pkr.hcl
packer {
  required_plugins {
    scaleway = {
      version = ">= 1.1.0"
      source  = "github.com/scaleway/scaleway"
    }
  }
}

source "scaleway" "test" {
  access_key       = var.scw_access_key
  secret_key       = var.scw_secret_key
  project_id       = var.scw_project_id
  zone             = var.scw_region
  remove_volume    = true
  tags = ["custom", "packer"]
  image = "rockylinux_9" # Id or label
  commercial_type = "PLAY2-MICRO"
  ssh_username = "root"
  ssh_private_key_file = "~/.ssh/id_rsa"
  private_network_ids = [
    "xxxxxxx"
  ]
  disable_public_ip = true
}

build {
  sources = ["source.scaleway.test"]
}

$ packer build -var-file=./variables.pkrvars.hcl .
scaleway.test: output will be in this color.

==> scaleway.test: Pre-validating image name: image-packer-xxxxxxx in zone fr-par-2
==> scaleway.test: Pre-validating snapshot names
==> scaleway.test: Using existing SSH private key
==> scaleway.test: Creating server...
==> scaleway.test: Attaching private network xxxxxxx...
==> scaleway.test: Private network xxxxxxx attached successfully
==> scaleway.test: Waiting for server to become active...
==> scaleway.test: PrivateNICs <nic_id>
==> scaleway.test: NIC <nic_id>— IP {{ <private_ip>fffffff0}}
==> scaleway.test: NIC <nic_id>— IP {{ <private_ip_v6>fffffffffffffffff000000000000000}}
==> scaleway.test: Using SSH communicator to connect: <private_ip>
==> scaleway.test: Waiting for SSH to become available...
==> scaleway.test: Connected to SSH!
==> scaleway.test: Waiting for any user data apply to finish if provided...
==> scaleway.test: Shutting down server...
==> scaleway.test: Backing up server to image: image-packer-xxxxxxx
==> scaleway.test: Creating snapshot for volume: xxxxxxx
==> scaleway.test: Creating image from snapshots: image-packer-xxxxxxx
==> scaleway.test: Destroying server...
==> scaleway.test: Removing Volumes ...
Build 'scaleway.test' finished after 2 minutes 20 seconds.

Testing error case :

$ cat scw.pkr.hcl
packer {
  required_plugins {
    scaleway = {
      version = ">= 1.1.0"
      source  = "github.com/scaleway/scaleway"
    }
  }
}

source "scaleway" "test" {
  access_key       = var.scw_access_key
  secret_key       = var.scw_secret_key
  project_id       = var.scw_project_id
  zone             = var.scw_region
  remove_volume    = true
  tags = ["custom", "packer"]
  image = "rockylinux_9" # Id or label
  commercial_type = "PLAY2-MICRO"
  ssh_username = "root"
  ssh_private_key_file = "~/.ssh/id_rsa"
  disable_public_ip = true
}

build {
  sources = ["source.scaleway.test"]
}

$ packer build -var-file=./variables.pkrvars.hcl .
Error: 1 error(s) occurred:

* At least one private network must be defined when using disable_public_ip

  on scw.pkr.hcl line 10:
  (source code not available)

@apoiget
apoiget force-pushed the main branch 4 times, most recently from ee7c3ed to e87783e Compare October 21, 2026 16:31
@apoiget
apoiget marked this pull request as ready for review October 21, 2026 16:35
@apoiget
apoiget requested a review from remyleone as a code owner October 21, 2026 16:35
@apoiget apoiget changed the title Create an image without flexible IP feat: Create an image without flexible IP Oct 22, 2026
@codecov-commenter

codecov-commenter commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 8.16327% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 9.15%. Comparing base (952621d) to head (0811878).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
builder/scaleway/step_server_info.go 0.00% 36 Missing ⚠️
builder/scaleway/step_create_server.go 0.00% 7 Missing ⚠️
builder/scaleway/config.hcl2spec.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #371      +/-   ##
========================================
+ Coverage   9.14%   9.15%   +0.01%     
========================================
  Files         39      39              
  Lines       1564    1605      +41     
========================================
+ Hits         143     147       +4     
- Misses      1421    1458      +37     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@remyleone remyleone changed the title feat: Create an image without flexible IP feat: create an image without flexible IP Oct 29, 2026
@remyleone
remyleone requested a review from yfodil November 4, 2026 13:15
Comment thread builder/scaleway/step_server_info.go Resolved
@remyleone
remyleone enabled auto-merge December 3, 2026 10:40
Add disable_public_ip and use_private_ip to connect through the first private network

Co-authored-by: Adrian POIGET <poigetadrian@gmail.com>
@remyleone
remyleone added this pull request to the merge queue Dec 3, 2026
Merged via the queue into scaleway:main with commit ea3ff54 Dec 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create an image without flexible IP

4 participants