-
-
Save jjasghar/e91c0cce6e6ba64736d04019ade67340 to your computer and use it in GitHub Desktop.
multiple machine diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- one_machine_chef/one_machine_chef_vcenter.tf 2017-10-23 16:07:25.000000000 -0500 | |
+++ multiple_machine_chef/multiple_machine_chef.tf 2017-10-26 07:55:30.000000000 -0500 | |
@@ -9,8 +9,11 @@ | |
# Create a virtual machine within the folder | |
resource "vsphere_virtual_machine" "terraform_01" { | |
+ | |
+ count = "${var.count}" | |
+ | |
# name of the machine inside vCenter | |
- name = "terraform-1" | |
+ name = "${format("terraform-%02d", count.index + 1)}" | |
# DNS inside the machine | |
dns_suffixes = ["tirefi.re"] | |
# Domain instead of default vsphere.local | |
@@ -60,7 +63,7 @@ | |
user_name = "${var.chef_provision.["user_name"]}" | |
# I couldn't figure out how to put the userkey as a variable, so you'll need to change this for you | |
user_key = "${file("/Users/jjasghar/repo/vmware_playground/pems/admini.pem")}" | |
- node_name = "${var.chef_provision.["node_name_default"]}" | |
+ node_name = "terraform-0${count.index + 1}" | |
# Here's a inital run_list :) | |
run_list = ["recipe[base]"] | |
recreate_client = "${var.chef_provision.["recreate_client"]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- one_machine_chef/variables.tf 2017-10-20 10:49:22.000000000 -0500 | |
+++ multiple_machine_chef/variables.tf 2017-10-26 07:55:44.000000000 -0500 | |
@@ -13,14 +13,17 @@ | |
default = "vcenter.tirefi.re" | |
} | |
+# Count of machines | |
+variable "count" { | |
+ default = 3 | |
+} | |
+ | |
# My connections for the Chef server | |
variable "chef_provision" { | |
type = "map" | |
description = "Configuration details for chef server" | |
default = { | |
- # A default node name | |
- node_name_default = "terraform-1" | |
# Run it again? You probably need to recreate the client | |
recreate_client = true | |
# Chef server :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment