-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCP: Allow to select algo when generating temporary SSH keypair #10111
Conversation
Codecov Report
|
}, | ||
multistep.If(b.config.PackerDebug, | ||
&communicator.StepDumpSSHKey{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooooh shiny.
Tried to run it and it crashed on me -- {
"variables": {
"image_name": "ubuntu1804-jenkins-{{isotime}}"
},
"builders": [
{
"type": "googlecompute",
"image_name": "{{ user `image_name` | clean_resource_name}}",
"account_file": "/myaccountfile.json",
"project_id": "gifted-station-178619",
"source_image_family": "ubuntu-1804-lts",
"ssh_username": "packer",
"zone": "us-central1-c",
"state_timeout": "20m",
"startup_script_file": "./shell_local_dummy.sh",
"tags": ["packer"]
}
],
"provisioners": [
{
"pause_before": "10s",
"type": "shell",
"inline": ["echo {{ build `ID` }}"]
}
]
}
|
Thanks ! Weird, your file works on my machine 🤔 any special options ? Do you have the crash log ? |
NVM found it ! |
Here's a testfile that works with any value: {
"builders": [
{
"type": "googlecompute",
"project_id": "azr-hashicorp",
"image_name": "base-centos-7-{{timestamp}}",
"source_image": "centos-7-v20200521",
"source_image_family": "centos-7",
"ssh_username": "centos",
"temporary_key_pair_type": "ecdsa",
"temporary_key_pair_bits": 521,
"zone": "europe-west2-a",
"machine_type": "n1-standard-1",
"disk_size": 20,
"enable_secure_boot": true,
"enable_vtpm": true,
"enable_integrity_monitoring": true
}
],
"provisioners": [
{
"destination": "/tmp/hm hi,\\ I have a space \u0026 ☺",
"source": "log.go",
"type": "file"
}
],
"variables": {
"zone": "europe-west4-a"
}
} Edit: HCL2 is not 100%, I'm on it. |
…ct and can be generated
Here's a cool HCL2 test file, ( you need a log.go file there ): variable "zone" {
type = string
default = "europe-west4-a"
}
source "googlecompute" "centos" {
disk_size = 20
enable_integrity_monitoring = true
enable_secure_boot = true
enable_vtpm = true
machine_type = "n1-standard-1"
project_id = "azr-hashicorp"
source_image = "centos-7-v20200521"
source_image_family = "centos-7"
ssh_username = "centos"
zone = "europe-west2-a"
}
build {
source "googlecompute.centos" {
temporary_key_pair_type = "dsa"
image_name = "base-centos-7-dsa"
}
source "googlecompute.centos" {
temporary_key_pair_type = "rsa"
image_name = "base-centos-7-rsa"
}
source "googlecompute.centos" {
temporary_key_pair_type = "ecdsa"
image_name = "base-centos-7-ecdsa"
}
source "googlecompute.centos" {
temporary_key_pair_type = "ed25519"
image_name = "base-centos-7-ed25519"
}
provisioner "file" {
destination = "/tmp/hm hi,\\ I have a space & ☺"
source = "log.go"
}
}
|
cool! Your example works, but my original example still doesn't, and it does work on the master branch so we need to make sure that the default case still works. |
Ah indeed ! Thanks ! |
b321023
to
522d122
Compare
Okay found the why, with no parameter this changed the default keytype from rsa to dsa ( because this was the default for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Lots of nice little add-ons here. I have not tested against the examples but code wise it looks good. I approve, but will defer until @SwampDragons has given the green light that their use case has been satisfied.
package multistep | ||
|
||
// if returns step only if on is true. | ||
func If(on bool, step Step) Step { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
yep, works now! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This is based on top of #10101, to solve the GCP case of #10074 this: