This commit is contained in:
Manuel Romero
2021-06-29 11:04:14 +02:00
parent d6fde98d5f
commit 2c48a3d4e5
3 changed files with 98 additions and 0 deletions

51
vm-fort-aws/main.tf Normal file
View File

@@ -0,0 +1,51 @@
terraform {
required_version = ">= 0.13"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.37.0"
}
}
}
provider "aws" {
alias = "myaws"
region = var.region
access_key = var.aws_provider_access_key
secret_key = var.aws_provider_access_secret
}
module "ec2_cluster" {
source = "terraform-aws-modules/ec2-instance/aws"
providers = {
aws = aws.myaws
}
version = "~> 3.0"
name = "fort-${var.provision_id}"
instance_count = 1
ami = var.ami
instance_type = var.instance_type
key_name = var.key_name
monitoring = false
vpc_security_group_ids = var.vpc_security_group_ids
subnet_ids = var.subnet_ids
associate_public_ip_address = true
tags = {
"24x7" = ""
"Owner" = var.user_id
"Cost Center" = "3100"
Deployment = "QMI"
}
}

11
vm-fort-aws/outputs.tf Normal file
View File

@@ -0,0 +1,11 @@
output "fort_url" {
value = "https://${module.ec2_cluster.public_dns}"
}
output "fort_admin_console" {
value = "http://${module.ec2_cluster.public_dns}:8000/admin/"
}
output "ssh" {
value = "ssh -i qmiforts.cer qlikfort@${module.ec2_cluster.public_dns}"
}

36
vm-fort-aws/variables.tf Normal file
View File

@@ -0,0 +1,36 @@
variable "aws_provider_access_key" {
}
variable "aws_provider_access_secret" {
}
variable "region" {
default = "eu-west-1"
}
variable "provision_id" {
}
variable "user_id" {
default = null
}
variable "ami" {
default = "ami-07a3e622866c877d9"
}
variable "key_name" {
default = "qmiforts"
}
variable "instance_type" {
default = "t2.2xlarge"
}
variable "vpc_security_group_ids" {
default = ["sg-0162d0120153aea3b"]
}
variable "subnet_ids" {
default = ["subnet-4d441b17", "subnet-95c22fde", "subnet-70938116"]
}