From 97a54204e8b0958c6f9ada7080613a8b7406385e Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Wed, 17 Mar 2021 00:45:47 +0600 Subject: [PATCH] v5.0.1.0 Changelog: https://haproxy-wi.org/changelog.py#5_0_1 --- app/scripts/terraform/aws_instance.tf | 1 + app/scripts/terraform/gcore_instance.tf | 18 +++++++++++++ .../terraform/templates/aws_vars_template.j2 | 1 + .../templates/gcore_vars_template.j2 | 17 ++++++++++++ app/scripts/terraform/var_generator.yml | 6 +++++ app/scripts/terraform/variable.tf | 26 ++++++++++++++++++- 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 app/scripts/terraform/gcore_instance.tf create mode 100644 app/scripts/terraform/templates/gcore_vars_template.j2 diff --git a/app/scripts/terraform/aws_instance.tf b/app/scripts/terraform/aws_instance.tf index c6a7bd80..51ae8f7b 100644 --- a/app/scripts/terraform/aws_instance.tf +++ b/app/scripts/terraform/aws_instance.tf @@ -6,6 +6,7 @@ module "aws_module" { public_ip = var.public_ip floating_ip = var.floating_ip volume_size = var.volume_size + volume_type = var.volume_type delete_on_termination = var.delete_on_termination name = var.name os = var.os diff --git a/app/scripts/terraform/gcore_instance.tf b/app/scripts/terraform/gcore_instance.tf new file mode 100644 index 00000000..c5973236 --- /dev/null +++ b/app/scripts/terraform/gcore_instance.tf @@ -0,0 +1,18 @@ +module "gcore_module" { + source = "github.com/Aidaho12/haproxy-wi-terraform-modules?ref=gcore" + + region = var.region + instance_type = var.instance_type + network_type = var.network_type + network_name = var.network_name + volume_size = var.volume_size + delete_on_termination = var.delete_on_termination + volume_type = var.volume_type + name = var.name + os = var.os + ssh_key_name = var.ssh_key_name + firewall = var.firewall + username = var.username + password = var.password + project = var.project +} diff --git a/app/scripts/terraform/templates/aws_vars_template.j2 b/app/scripts/terraform/templates/aws_vars_template.j2 index a9f0aea3..4e8d80bd 100644 --- a/app/scripts/terraform/templates/aws_vars_template.j2 +++ b/app/scripts/terraform/templates/aws_vars_template.j2 @@ -7,6 +7,7 @@ floating_ip = {% if floating_ip == 'true' %}true{%else%}false{%endif%} delete_on_termination = {% if delete_on_termination == 'true' %}true{%else%}false{%endif%} volume_size = {{volume_size}} +volume_type = "{{volume_type}}" name = "{{server_name}}" os = "{{os}}" ssh_key_name = "{{ssh_name}}" diff --git a/app/scripts/terraform/templates/gcore_vars_template.j2 b/app/scripts/terraform/templates/gcore_vars_template.j2 new file mode 100644 index 00000000..a4aea93b --- /dev/null +++ b/app/scripts/terraform/templates/gcore_vars_template.j2 @@ -0,0 +1,17 @@ +region = {{region}} +instance_type = "{{size}}" +project = "{{project}}" +network_name = "{{network_name}}" +network_type = "{{network_type}}" + +delete_on_termination = {% if delete_on_termination == 'true' %}true{%else%}false{%endif%} + +volume_size = {{volume_size}} +volume_type = "{{volume_type}}" +name = "{{server_name}}" +os = "{{os}}" +ssh_key_name = "{{ssh_name}}" +firewall = {% if firewall == 'true' %}true{%else%}false{%endif%} + +username = "{{username}}" +password = "{{pass}}" diff --git a/app/scripts/terraform/var_generator.yml b/app/scripts/terraform/var_generator.yml index da9c3119..543e8050 100644 --- a/app/scripts/terraform/var_generator.yml +++ b/app/scripts/terraform/var_generator.yml @@ -18,3 +18,9 @@ src: templates/do_vars_template.j2 dest: "vars/{{server_name}}_{{group}}_{{cloud}}.tfvars" when: cloud == "do" + + - name: Create gcore var file + template: + src: templates/gcore_vars_template.j2 + dest: "vars/{{server_name}}_{{group}}_{{cloud}}.tfvars" + when: cloud == "gcore" diff --git a/app/scripts/terraform/variable.tf b/app/scripts/terraform/variable.tf index d2d56cd8..421aba2f 100644 --- a/app/scripts/terraform/variable.tf +++ b/app/scripts/terraform/variable.tf @@ -1,17 +1,41 @@ variable "region" {} +variable "project" { + default = "123" +} +variable "username" { + type = string + default = "123" +} +variable "password" { + type = string + default = "123" +} variable "instance_type" { default = "123" } +variable "network_type" { + type = string + default = "any_subnet" +} +variable "network_name" { + type = string + default = "" +} variable "public_ip" { default = false } -variable "floating_ip" {} +variable "floating_ip" { + default = false +} variable "volume_size" { default = "123" } variable "delete_on_termination" { default = false } +variable "volume_type" { + default = "standard" +} variable "name" {} variable "os" {} variable "ssh_key_name" {}