Skip to content

Commit 9fd29a6

Browse files
authored
Remove dependencies on terraform-aws-account-metadata. Use Terraform vars instead (#8)
1 parent 5014d49 commit 9fd29a6

25 files changed

+207
-90
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This is a collection of reusable root modules for CloudPosse AWS accounts.
1111
Use the `terraform-root-modules` Docker image as the base image in the application `Dockerfile`, and copy the modules from `/aws` folder into `/conf` folder
1212

1313
```dockerfile
14-
FROM cloudposse/terraform-root-modules:0.1.4 as terraform-root-modules
14+
FROM cloudposse/terraform-root-modules:0.1.6 as terraform-root-modules
1515

1616
FROM cloudposse/geodesic:0.9.16
1717

aws/acm-cloudfront/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ provider "aws" {
2020
}
2121

2222
variable "domain_name" {
23-
description = "Domain name (E.g. staging.cloudposse.org)"
23+
description = "Domain name (E.g. staging.cloudposse.co)"
2424
}
2525

2626
module "certificate" {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
domain_name="staging.cloudposse.co"

aws/acm/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ provider "aws" {
1313
}
1414

1515
variable "domain_name" {
16-
description = "Domain name (E.g. staging.cloudposse.org)"
16+
description = "Domain name (E.g. staging.cloudposse.co)"
1717
}
1818

1919
module "certificate" {

aws/acm/terraform.tfvars.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
domain_name="foobar.domain.com"
1+
domain_name="staging.cloudposse.co"

aws/backing-services/aurora-postgres.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ variable "POSTGRES_CLUSTER_ENABLED" {
3939

4040
module "aurora_postgres" {
4141
source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=tags/0.3.5"
42-
namespace = "${module.identity.namespace}"
43-
stage = "${module.identity.stage}"
42+
namespace = "${var.namespace}"
43+
stage = "${var.stage}"
4444
name = "postgres"
4545
engine = "aurora-postgresql"
4646
cluster_family = "aurora-postgresql9.6"
@@ -51,9 +51,9 @@ module "aurora_postgres" {
5151
db_name = "${var.POSTGRES_DB_NAME}"
5252
db_port = "5432"
5353
vpc_id = "${module.vpc.vpc_id}"
54-
availability_zones = ["${module.identity.availability_zones}"]
54+
availability_zones = ["${data.aws_availability_zones.available}"]
5555
subnets = ["${module.subnets.private_subnet_ids}"]
56-
zone_id = "${module.identity.zone_id}"
56+
zone_id = "${var.zone_id}"
5757
security_groups = ["${module.kops_metadata.nodes_security_group_id}"]
5858
enabled = "${var.POSTGRES_CLUSTER_ENABLED}"
5959
}

aws/backing-services/elasticache-redis.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ variable "REDIS_CLUSTER_ENABLED" {
1818

1919
module "elasticache_redis" {
2020
source = "git::https://github.com/cloudposse/terraform-aws-elasticache-redis.git?ref=tags/0.4.3"
21-
namespace = "${module.identity.namespace}"
22-
stage = "${module.identity.stage}"
21+
namespace = "${var.namespace}"
22+
stage = "${var.stage}"
2323
name = "redis"
24-
zone_id = "${module.identity.zone_id}"
24+
zone_id = "${var.zone_id}"
2525
security_groups = ["${module.kops_metadata.nodes_security_group_id}"]
2626
vpc_id = "${module.vpc.vpc_id}"
2727
subnets = ["${module.subnets.private_subnet_ids}"]
@@ -34,7 +34,7 @@ module "elasticache_redis" {
3434
alarm_cpu_threshold_percent = "75"
3535
alarm_memory_threshold_bytes = "10000000"
3636
apply_immediately = "true"
37-
availability_zones = ["${module.identity.availability_zones}"]
37+
availability_zones = ["${data.aws_availability_zones.available}"]
3838
automatic_failover = "false"
3939
enabled = "${var.REDIS_CLUSTER_ENABLED}"
4040
}

aws/backing-services/main.tf

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,44 @@ terraform {
44
backend "s3" {}
55
}
66

7-
variable "aws_assume_role_arn" {}
7+
variable "aws_assume_role_arn" {
8+
type = "string"
9+
}
10+
11+
variable "namespace" {
12+
type = "string"
13+
description = "Namespace (e.g. `cp` or `cloudposse`)"
14+
}
15+
16+
variable "stage" {
17+
type = "string"
18+
description = "Stage (e.g. `prod`, `dev`, `staging`)"
19+
}
20+
21+
variable "region" {
22+
type = "string"
23+
description = "AWS region"
24+
}
25+
26+
variable "zone_name" {
27+
type = "string"
28+
description = "DNS zone name"
29+
}
30+
31+
variable "zone_id" {
32+
type = "string"
33+
description = "DNS zone ID"
34+
}
35+
36+
data "aws_availability_zones" "available" {}
837

938
provider "aws" {
1039
assume_role {
1140
role_arn = "${var.aws_assume_role_arn}"
1241
}
1342
}
1443

15-
module "identity" {
16-
source = "git::[email protected]:cloudposse/terraform-aws-account-metadata.git?ref=init"
17-
}
18-
1944
module "kops_metadata" {
2045
source = "git::https://github.com/cloudposse/terraform-aws-kops-metadata.git?ref=tags/0.1.1"
21-
dns_zone = "${module.identity.aws_region}.${module.identity.zone_name}"
46+
dns_zone = "${var.region}.${var.zone_name}"
2247
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace="cp"
2+
stage="staging"
3+
region="us-west-2"
4+
zone_name="us-west-2.cloudposse.co"
5+
zone_id="XXXXXXXXXXXX"

aws/backing-services/vpc.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ locals {
44

55
module "vpc" {
66
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.3.3"
7-
namespace = "${module.identity.namespace}"
8-
stage = "${module.identity.stage}"
7+
namespace = "${var.namespace}"
8+
stage = "${var.stage}"
99
name = "${local.name}"
1010
cidr_block = "10.0.0.0/16"
1111
}
1212

1313
module "subnets" {
1414
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.3.4"
15-
availability_zones = ["${module.identity.availability_zones}"]
16-
namespace = "${module.identity.namespace}"
17-
stage = "${module.identity.stage}"
15+
availability_zones = ["${data.aws_availability_zones.available}"]
16+
namespace = "${var.namespace}"
17+
stage = "${var.stage}"
1818
name = "${local.name}"
19-
region = "${module.identity.aws_region}"
19+
region = "${var.region}"
2020
vpc_id = "${module.vpc.vpc_id}"
2121
igw_id = "${module.vpc.igw_id}"
2222
cidr_block = "${module.vpc.vpc_cidr_block}"

0 commit comments

Comments
 (0)