-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
79 lines (61 loc) · 1.82 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
terraform {
required_version = "~> 0.11"
required_providers {
aws = "~> 2.41"
}
}
provider "aws" {
region = "us-east-1"
assume_role {
role_arn = "arn:aws:iam::ACCOUNTID_one:role/ADMINISTRATIVE_ROLE"
session_name = "Terraform-account_one_Admin"
}
alias = "account_one"
}
provider "aws" {
region = "us-east-1"
assume_role {
role_arn = "arn:aws:iam::ACCOUNTID_two:role/ADMINISTRATIVE_ROLE"
session_name = "Terraform-account_two_Admin"
}
alias = "account_two"
}
// Zone-Apex-Domain static website infrastructure
module "example_net" {
// Must pass all used providers, see:
// https://www.terraform.io/docs/configuration/modules.html#passing-providers-explicitly
// For this example,
// Route 53 and ACM entries are in the AWS Account "account_one", while
// everything else is in "account_two"
providers = {
aws.static-website-account = "aws.account_one"
aws.route53-account = "aws.account_two"
aws.acm-account = "aws.account_two"
aws.lambda-account = "aws.account_one"
aws.iam-account = "aws.account_one"
aws.git-account = "aws.account_one"
}
// Variables
source = "environment/common/stacks/static-website-tld/"
aws_route53_zone {
name = "example.net"
comment = "Managed by Terraform"
}
// Either re-use an existing shared logging bucket
// s3_bucket_log_bucket = "${aws_s3_bucket.my-bucket-name.id}"
// Otherwise, you may want to create an S3 bucket
# s3_bucket_log_bucket = "logs-${replace(var.aws_route53_zone["name"], ".", "-")}"
s3_bucket_log_bucket = "logs-example-net"
}
module "account_one" {
providers = {
aws = "aws.account_one"
}
source = "account/common/"
}
module "account_two" {
providers = {
aws = "aws.account_two"
}
source = "account/two/"
}