-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
90 lines (77 loc) · 1.65 KB
/
main.tf
File metadata and controls
90 lines (77 loc) · 1.65 KB
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
80
81
82
83
84
85
86
87
88
89
90
# Terraform Config
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 6.0"
}
awscc = {
source = "hashicorp/awscc"
version = "~> 1.0"
}
}
backend "s3" {
use_lockfile = true
region = "eu-west-2"
key = "ndr/terraform.tfstate"
encrypt = true
}
}
provider "aws" {
region = "eu-west-2"
default_tags {
tags = {
Owner = var.owner
Environment = var.environment
Workspace = terraform.workspace
}
}
}
provider "awscc" {
region = "eu-west-2"
}
provider "aws" {
alias = "us_east_1"
region = "us-east-1"
default_tags {
tags = {
Owner = var.owner
Environment = var.environment
Workspace = terraform.workspace
}
}
}
resource "aws_resourcegroups_group" "workspace" {
name = "${terraform.workspace}-resource_group"
description = "${terraform.workspace} workspace resource group."
tags = {
Name = "${terraform.workspace}-resource_group"
}
resource_query {
query = <<JSON
{
"ResourceTypeFilters": ["AWS::AllSupported"],
"TagFilters": [
{
"Key": "Workspace",
"Values": ["${terraform.workspace}"]
}
]
}
JSON
}
}
data "aws_caller_identity" "current" {}
data "aws_region" "current" {}
data "aws_elb_service_account" "main" {}
data "aws_ssm_parameter" "apim_url" {
name = "/repo/${var.environment}/user-input/apim-api-url"
}
data "terraform_remote_state" "shared" {
backend = "s3"
config = {
bucket = local.shared_terraform_state_bucket
key = "env:/${var.shared_infra_workspace}/ndr/terraform.tfstate"
region = "eu-west-2"
}
}