github.phpd.cn/cilium/cilium@v1.6.12/test/packet/main.tf (about) 1 variable "private_key_path" { 2 } 3 4 variable "packet_token" { 5 } 6 7 variable "packet_project_id" { 8 } 9 10 variable "packet_plan" { 11 default="baremetal_0" 12 } 13 14 variable "packet_location" { 15 default="sjc1" 16 } 17 18 variable "nodes" { 19 default = 1 20 } 21 22 provider "packet" { 23 auth_token = "${var.packet_token}" 24 } 25 26 # Create a device and add it to tf_project_1 27 resource "packet_device" "test" { 28 count = "${var.nodes}" 29 hostname = "test-${count.index}" 30 plan = "${var.packet_plan}" 31 facility = "${var.packet_location}" 32 operating_system = "ubuntu_18_04" 33 billing_cycle = "hourly" 34 project_id = "${var.packet_project_id}" 35 36 connection { 37 type = "ssh" 38 user = "root" 39 private_key = "${file("${var.private_key_path}")}" 40 agent = false 41 } 42 43 provisioner "file" { 44 source="scripts" 45 destination="/provision" 46 } 47 48 provisioner "remote-exec" { 49 inline = [ 50 "sudo chmod 755 /provision/*.sh", 51 "sudo /provision/install.sh", 52 "go get -u github.com/cilium/cilium || true" 53 ] 54 } 55 }