· 9 years ago · Aug 26, 2016, 01:50 PM
1/*
2- create an alb spanning both public subnets in travis-realm
3- create an asg config
4 - use application artifact as ami id
5- create an asg spanning both private subnets in travis-realm
6- associate config with asg
7- associate asg with alb
8- create security groups to allow access
9- create Route 53 records
10*/
11variable "aws_access_key_id" {
12}
13variable "aws_secret_access_key" {
14}
15variable "aws_region" {
16}
17variable "atlas_token" {
18}
19variable "lasso_environment_id" {
20}
21
22# Configure the Consul provider
23provider "consul" {
24 address = ""
25 datacenter = "us-west-1"
26 scheme = "https"
27 token = ""
28}
29
30data "consul_keys" "subnet_id_1" {
31 datacenter = "us-west-1"
32
33 # Read the launch AMI from Consul
34 key {
35 name = "id"
36 path = "network/us-west-1b/subnets/private/id"
37 }
38}
39
40provider "atlas" {
41 token = "${var.atlas_token}"
42}
43
44atlas {
45 name = "lassocrm/keymaker-${var.lasso_environment_id}"
46}
47
48data "atlas_artifact" "keymaker" {
49 name = "lassocrm/keymaker"
50 type = "amazon.image"
51 build = "latest"
52}
53
54provider "aws" {
55 access_key = "${var.aws_access_key_id}"
56 secret_key = "${var.aws_secret_access_key}"
57 region = "${var.aws_region}"
58}
59
60# Create a new load balancer
61//resource "aws_alb" "test" {
62// name = "test-alb-tf"
63// internal = false
64// security_groups = [
65// "${aws_security_group.alb_sg.id}"]
66// subnets = [
67// "${aws_subnet.public.*.id}"]
68//
69// enable_deletion_protection = true
70//
71// access_logs {
72// bucket = "${aws_s3_bucket.alb_logs.bucket}"
73// prefix = "test-alb"
74// }
75//
76// tags {
77// Environment = "production"
78// }
79//}