본문 바로가기
IT/기타

Terraform Win SSH 복사 테스트

by JGSHIN 2025. 3. 6.
SMALL
variable "admin_password" {
  description = "Admin user password for SSH connection"
  type        = string
  default     = "패스워드"
}

variable "host" {
  description = "Target host for remote connection"
  type        = string
  default     = "192.168.99.43"
}

resource "null_resource" "test" {

  provisioner "file" {
    source      = "${path.module}/showip.bat"
    destination = "C:/Temp/showip.bat"
  }

  provisioner "remote-exec" {
    inline = [
      "cmd.exe /c C:/Temp/showip.bat"
    ]
  }

  connection {
    type     = "ssh"
    user     = "admin"
    password = var.admin_password
    host     = var.host
    timeout  = "2m"
    target_platform  = "windows"
  }
}

 

취약점 보안 검사 스크립트 돌릴때,

호스트 IP 랑 패스워드를 좀 암호화 하여 리스트 형식으로 만들면 조금 더 편리 하겠네요.

LIST
📧 이메일 문의
by @ 2025 JGSHIN