-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
79 lines (68 loc) · 1.76 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 {
backend "s3" {
encrypt = true
key = "mkdocs-demo.tfstate"
}
}
provider "aws" {
region = var.region
}
provider "aws" {
region = "us-east-1"
alias = "us_east_1"
}
data "aws_caller_identity" "current" {}
data "aws_region" "current" {}
module "production_site_bucket" {
source = "./modules/simple-site-bucket"
bucket_name = local.site_name
tags = merge(local.global_tags, {
project-environment = "production"
})
}
module "development_site_bucket" {
source = "./modules/simple-site-bucket"
bucket_name = local.dev_site_name
tags = merge(local.global_tags, {
project-environment = "development"
})
}
locals {
site_name = var.site_bucket_name
dev_site_name = format("%s-development", local.site_name)
artifact_bucket_name = format("%s-artifacts", local.site_name)
global_tags = {
CreatedBy = "ntno/mkdocs-demo"
Provisioner = "Terraform"
project = "mkdocs-demo"
domain = "personal"
}
}
module "demo_site_cicd" {
source = "git::https://github.com/ntno/tf-module-static-site-cicd?ref=1.2.0"
artifact_bucket_name = local.artifact_bucket_name
github_repo = var.github_repo
github_org = var.github_org
tags = local.global_tags
integration_environment = {
environment_id = "integration"
ci_prefix = format("%s-%s-ci-pr-", var.github_org, var.github_repo)
tags = {
project-environment = "integration"
}
}
deployment_environments = {
"production" = {
deploy_bucket = local.site_name
tags = {
project-environment = "production"
}
},
"development" = {
deploy_bucket = local.dev_site_name
tags = {
project-environment = "development"
}
}
}
}