Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions terraform/vsphere/cloud-init.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ write_files:
content: ${tpl_priv_key}
path: /tmp/id_rsa
permissions: '0600'
- content: |
[default]
aws_access_key_id = ${tpl_aws_access_key_id}
aws_secret_access_key = ${tpl_aws_secret_access_key}
path: /tmp/credentials
permissions: '0600'

runcmd:
- while [ ! -f "/tmp/env.sh" ]; do sleep 5; done
Expand Down
2 changes: 2 additions & 0 deletions terraform/vsphere/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ resource "local_file" "cloud-init" {
{
tpl_priv_key = base64encode(tls_private_key.ssh.private_key_openssh),
tpl_pub_key = tls_private_key.ssh.public_key_openssh,
tpl_aws_access_key_id = var.aws_access_key_id
tpl_aws_secret_access_key = var.aws_secret_access_key
tpl_name = each.value.instance_name,
tpl_cluster = each.value.cluster
})
Expand Down
10 changes: 10 additions & 0 deletions terraform/vsphere/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,14 @@ variable "vsphere_dns" {
description = "vSphere VM DNS"
type = string
default = ""
}

variable "aws_access_key_id" {
description ="AWS Access Key"
type = string
}

variable "aws_secret_access_key" {
description ="AWS Secret Access Key"
type = string
}
2 changes: 2 additions & 0 deletions vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ func vsphere_create_variables(config *Config) []string {
tf_variables = append(tf_variables, "vsphere_network = \""+config.Vsphere_Network+"\"")
tf_variables = append(tf_variables, "vsphere_memory = \""+config.Vsphere_Memory+"\"")
tf_variables = append(tf_variables, "vsphere_cpu = \""+config.Vsphere_Cpu+"\"")
tf_variables = append(tf_variables, "aws_access_key_id = \""+config.Aws_Access_Key_Id+"\"")
tf_variables = append(tf_variables, "aws_secret_access_key = \""+config.Aws_Secret_Access_Key+"\"")

if (config.Vsphere_Dns != "") && (config.Vsphere_Gw != "") && (config.Vsphere_Node_Ip != "") {
tf_variables = append(tf_variables, "vsphere_dns = \""+config.Vsphere_Dns+"\"")
Expand Down