File tree Expand file tree Collapse file tree 5 files changed +185
-1
lines changed
infrastructure/terraform/components Expand file tree Collapse file tree 5 files changed +185
-1
lines changed Original file line number Diff line number Diff line change 1+ resource "aws_iam_policy" "github_deploy_overload" {
2+ name = " ${ local . csi } -github-deploy-overload"
3+ description = " Overloads the github permission to perform build actions for services in this account"
4+ policy = data. aws_iam_policy_document . github_deploy . json
5+ }
6+
7+ resource "aws_iam_role_policy_attachment" "github_deploy_overload" {
8+ role = local. bootstrap . iam_github_deploy_role [" name" ]
9+ policy_arn = aws_iam_policy. github_deploy_overload . arn
10+ }
11+
12+ # tfsec:ignore:aws-iam-no-policy-wildcards Policy voilation expected for CI user role
13+ data "aws_iam_policy_document" "github_deploy" {
14+ statement {
15+ effect = " Allow"
16+
17+ actions = [
18+ " grafana:*" ,
19+ ]
20+ resources = [" *" ]
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ locals {
2+ bootstrap = data. terraform_remote_state . bootstrap . outputs
3+ }
4+
5+ data "terraform_remote_state" "bootstrap" {
6+ backend = " s3"
7+
8+ config = {
9+ bucket = local.terraform_state_bucket
10+
11+ key = format (
12+ " %s/%s/%s/%s/bootstrap.tfstate" ,
13+ var. project ,
14+ var. aws_account_id ,
15+ " eu-west-2" ,
16+ " bootstrap"
17+ )
18+
19+ region = " eu-west-2"
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ locals {
2+ bootstrap = data. terraform_remote_state . bootstrap . outputs
3+ acct = data. terraform_remote_state . acct . outputs
4+ }
5+
6+ data "terraform_remote_state" "bootstrap" {
7+ backend = " s3"
8+
9+ config = {
10+ bucket = local.terraform_state_bucket
11+
12+ key = format (
13+ " %s/%s/%s/%s/bootstrap.tfstate" ,
14+ var. project ,
15+ var. aws_account_id ,
16+ " eu-west-2" ,
17+ " bootstrap"
18+ )
19+
20+ region = " eu-west-2"
21+ }
22+ }
23+
24+ data "terraform_remote_state" "acct" {
25+ backend = " s3"
26+
27+ config = {
28+ bucket = local.terraform_state_bucket
29+
30+ key = format (
31+ " %s/%s/%s/%s/acct.tfstate" ,
32+ var. project ,
33+ var. aws_account_id ,
34+ " eu-west-2" ,
35+ var. parent_acct_environment
36+ )
37+
38+ region = " eu-west-2"
39+ }
40+ }
Original file line number Diff line number Diff line change 1+ locals {
2+ terraform_state_bucket = format (
3+ " %s-tfscaffold-%s-%s" ,
4+ var. project ,
5+ var. aws_account_id ,
6+ var. region ,
7+ )
8+
9+ csi = replace (
10+ format (
11+ " %s-%s-%s" ,
12+ var. project ,
13+ var. environment ,
14+ var. component ,
15+ ),
16+ " _" ,
17+ " " ,
18+ )
19+
20+ # CSI for use in resources with a global namespace, i.e. S3 Buckets
21+ csi_global = replace (
22+ format (
23+ " %s-%s-%s-%s-%s" ,
24+ var. project ,
25+ var. aws_account_id ,
26+ var. region ,
27+ var. environment ,
28+ var. component ,
29+ ),
30+ " _" ,
31+ " " ,
32+ )
33+
34+ default_tags = merge (
35+ var. default_tags ,
36+ {
37+ Project = var.project
38+ Environment = var.environment
39+ Component = var.component
40+ Group = var.group
41+ Name = local.csi
42+ },
43+ )
44+ }
Original file line number Diff line number Diff line change 1- # Define the variables that will be initialised in etc/{env,versions}_<region>_<environment>.tfvars...
1+ # #
2+ # Basic Required Variables for tfscaffold Components
3+ # #
4+
5+ variable "project" {
6+ type = string
7+ description = " The name of the tfscaffold project"
8+ }
9+
10+ variable "environment" {
11+ type = string
12+ description = " The name of the tfscaffold environment"
13+ }
14+
15+ variable "aws_account_id" {
16+ type = string
17+ description = " The AWS Account ID (numeric)"
18+ }
19+
20+ variable "region" {
21+ type = string
22+ description = " The AWS Region"
23+ }
24+
25+ variable "group" {
26+ type = string
27+ description = " The group variables are being inherited from (often synonmous with account short-name)"
28+ }
29+
30+ # #
31+ # tfscaffold variables specific to this component
32+ # #
33+
34+ # This is the only primary variable to have its value defined as
35+ # a default within its declaration in this file, because the variables
36+ # purpose is as an identifier unique to this component, rather
37+ # then to the environment from where all other variables come.
38+ variable "component" {
39+ type = string
40+ description = " The variable encapsulating the name of this component"
41+ default = " examplecomponent"
42+ }
43+
44+ variable "default_tags" {
45+ type = map (string )
46+ description = " A map of default tags to apply to all taggable resources within the component"
47+ default = {}
48+ }
49+
50+ # #
51+ # Variables specific to the component
52+ # #
53+
54+ variable "log_retention_in_days" {
55+ type = number
56+ description = " The retention period in days for the Cloudwatch Logs events to be retained, default of 0 is indefinite"
57+ default = 0
58+ }
You can’t perform that action at this time.
0 commit comments