module alpine postinstall

This commit is contained in:
Patrick CAO HUU THIEN 2022-11-28 15:06:16 +01:00
commit 99550a76d0
3 changed files with 40 additions and 0 deletions

0
.gitignore vendored Normal file
View File

29
main.tf Normal file
View File

@ -0,0 +1,29 @@
## NEED a provider
# use in root module:
#
# module "postinstall" {
# source "../alpine_postinstall"
# connexion_ip = var.eth0_ip
# connexion_private_key = var.pm_private_key
# }
resource "null_resource" "alpine_postinstall" {
connection {
type = "ssh"
user = "root"
host = var.connection_ip
private_key = var.connection_private_key
}
provisioner "remote-exec" {
inline = [
# see https://git.alpinelinux.org/aports/tree/main/
"echo '#--------------------------'",
"echo '# module alpine_postinstall'",
"echo '#--------------------------'",
"apk add file man-pages tzdata bash htop vim",
"apk add openssh-server",
"echo '# module DONE'",
]
}
}

11
variables.tf Normal file
View File

@ -0,0 +1,11 @@
variable "connection_ip" {
type = string
description = "ipv4"
}
variable "connection_private_key" {
type = string
description = "private key used by terraform"
sensitive = true
}