Selaa lähdekoodia

Merge pull request #229 from mdr-engineering/feature/ftd_MSOCI-1450_JiraMigration

Adds Jira RDS and Instance to Test and Prod GovCloud
Frederick Damstra 4 vuotta sitten
vanhempi
sitoutus
4aa0eea50c

+ 1 - 0
prod/aws-us-gov/mdr-prod-c2/210-rds-jira/.tfswitch.toml

@@ -0,0 +1 @@
+../../../../.tfswitch.toml

+ 42 - 0
prod/aws-us-gov/mdr-prod-c2/210-rds-jira/terragrunt.hcl

@@ -0,0 +1,42 @@
+locals {
+  # If you want to use any of the variables in _this_ file, you have to load them here.
+  # However, they will all be available as inputs to the module loaded in terraform.source
+  # below.
+
+  # e.g. inherited variables:
+  environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
+  partition_vars = read_terragrunt_config(find_in_parent_folders("partition.hcl"))
+  region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
+  account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
+  global_vars = read_terragrunt_config(find_in_parent_folders("globals.hcl"))
+}
+
+# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
+# working directory, into a temporary folder, and execute your Terraform commands in that folder.
+terraform {
+  # Double slash is intentional and required to show root of modules
+  source = "git@github.xdr.accenturefederalcyber.com:mdr-engineering/xdr-terraform-modules.git//base/jira/rds_jira?ref=v1.21.4"
+}
+
+# Include all settings from the root terragrunt.hcl file
+include {
+  path = find_in_parent_folders()
+}
+
+dependency "vpc" {
+  config_path = "../010-vpc-public"
+}
+
+# These are the variables we have to pass in to use the module specified in the terragrunt source above
+inputs = {
+  # All of the inputs from the inherited hcl files are available automatically
+  # (via the `inputs` section of the root `terragrunt.hcl`). However, modules
+  # will be more flexible if you specify particular input values.
+  tags = {
+    Terraform = "aws/${basename(get_parent_terragrunt_dir())}/${path_relative_to_include()}/"
+  }
+  identifier = "jira2"
+  instance_type = local.account_vars.locals.instance_types["jira-rds"]
+  vpc_id = dependency.vpc.outputs.vpc_id
+  subnets = dependency.vpc.outputs.private_subnets
+}

+ 1 - 0
prod/aws-us-gov/mdr-prod-c2/220-instance-jira/.tfswitch.toml

@@ -0,0 +1 @@
+../../../../.tfswitch.toml

+ 48 - 0
prod/aws-us-gov/mdr-prod-c2/220-instance-jira/terragrunt.hcl

@@ -0,0 +1,48 @@
+locals {
+  # If you want to use any of the variables in _this_ file, you have to load them here.
+  # However, they will all be available as inputs to the module loaded in terraform.source
+  # below.
+  environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
+  partition_vars = read_terragrunt_config(find_in_parent_folders("partition.hcl"))
+  region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
+  account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
+  global_vars = read_terragrunt_config(find_in_parent_folders("globals.hcl"))
+}
+
+# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
+# working directory, into a temporary folder, and execute your Terraform commands in that folder.
+terraform {
+  # Double slash is intentional and required to show root of modules
+  source = "git@github.xdr.accenturefederalcyber.com:mdr-engineering/xdr-terraform-modules.git//base/jira/instance_jira?ref=v1.21.4"
+}
+
+dependency "vpc" {
+  config_path = "../010-vpc-public"
+}
+
+dependency "rds" {
+  config_path = "../210-rds-jira"
+}
+
+# Include all settings from the root terragrunt.hcl file
+include {
+  path = find_in_parent_folders()
+}
+
+# These are the variables we have to pass in to use the module specified in the terragrunt source above
+inputs = {
+  # All of the inputs from the inherited hcl files are available automatically
+  # (via the `inputs` section of the root `terragrunt.hcl`). However, modules
+  # will be more flexible if you specify particular input values.
+  tags = {
+    Purpose = "Jira Ticketing"
+    Terraform = "aws/${basename(get_parent_terragrunt_dir())}/${path_relative_to_include()}/"
+  }
+  instance_count = local.account_vars.locals.github_instance_count
+  instance_type = local.account_vars.locals.instance_types["jira-server"]
+  vpc_id = dependency.vpc.outputs.vpc_id
+  azs = dependency.vpc.outputs.azs
+  public_subnets = dependency.vpc.outputs.public_subnets
+  private_subnets = dependency.vpc.outputs.private_subnets
+  rds_sg = dependency.rds.outputs.security_group_id
+}

+ 2 - 0
prod/aws-us-gov/mdr-prod-c2/account.hcl

@@ -148,6 +148,8 @@ locals {
     "qcompliance"    = "c5a.8xlarge", # legacy: c4.8xlarge
     "github"         = "c5.4xlarge", # legacy: c4.4xlarge in prod, c5.2xlarge in test
     "github-backup"  = "t3a.medium", # legacy: t2.medium
+    "jira-rds"       = "db.t3.medium",
+    "jira-server"    = "t3a.medium", # legacy test: t2.small, legacy prod: t2.medium
   }
 
   # Bastion

+ 0 - 1
test/aws-us-gov/mdr-test-c2/090-instance-github/terragrunt.hcl

@@ -33,7 +33,6 @@ inputs = {
   tags = {
     Purpose = "GitHub Enterprise"
     Terraform = "aws/${basename(get_parent_terragrunt_dir())}/${path_relative_to_include()}/"
-    Schedule  = "none"
   }
   instance_count = local.account_vars.locals.github_instance_count
   instance_type = local.account_vars.locals.instance_types["github"]

+ 1 - 0
test/aws-us-gov/mdr-test-c2/210-rds-jira/.tfswitch.toml

@@ -0,0 +1 @@
+../../../../.tfswitch.toml

+ 42 - 0
test/aws-us-gov/mdr-test-c2/210-rds-jira/terragrunt.hcl

@@ -0,0 +1,42 @@
+locals {
+  # If you want to use any of the variables in _this_ file, you have to load them here.
+  # However, they will all be available as inputs to the module loaded in terraform.source
+  # below.
+
+  # e.g. inherited variables:
+  environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
+  partition_vars = read_terragrunt_config(find_in_parent_folders("partition.hcl"))
+  region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
+  account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
+  global_vars = read_terragrunt_config(find_in_parent_folders("globals.hcl"))
+}
+
+# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
+# working directory, into a temporary folder, and execute your Terraform commands in that folder.
+terraform {
+  # Double slash is intentional and required to show root of modules
+  source = "git@github.xdr.accenturefederalcyber.com:mdr-engineering/xdr-terraform-modules.git//base/jira/rds_jira?ref=v1.21.4"
+}
+
+# Include all settings from the root terragrunt.hcl file
+include {
+  path = find_in_parent_folders()
+}
+
+dependency "vpc" {
+  config_path = "../010-vpc-public"
+}
+
+# These are the variables we have to pass in to use the module specified in the terragrunt source above
+inputs = {
+  # All of the inputs from the inherited hcl files are available automatically
+  # (via the `inputs` section of the root `terragrunt.hcl`). However, modules
+  # will be more flexible if you specify particular input values.
+  tags = {
+    Terraform = "aws/${basename(get_parent_terragrunt_dir())}/${path_relative_to_include()}/"
+  }
+  identifier = "jira2"
+  instance_type = local.account_vars.locals.instance_types["jira-rds"]
+  vpc_id = dependency.vpc.outputs.vpc_id
+  subnets = dependency.vpc.outputs.private_subnets
+}

+ 1 - 0
test/aws-us-gov/mdr-test-c2/220-instance-jira/.tfswitch.toml

@@ -0,0 +1 @@
+version = "0.13.5"

+ 48 - 0
test/aws-us-gov/mdr-test-c2/220-instance-jira/terragrunt.hcl

@@ -0,0 +1,48 @@
+locals {
+  # If you want to use any of the variables in _this_ file, you have to load them here.
+  # However, they will all be available as inputs to the module loaded in terraform.source
+  # below.
+  environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))
+  partition_vars = read_terragrunt_config(find_in_parent_folders("partition.hcl"))
+  region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
+  account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
+  global_vars = read_terragrunt_config(find_in_parent_folders("globals.hcl"))
+}
+
+# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
+# working directory, into a temporary folder, and execute your Terraform commands in that folder.
+terraform {
+  # Double slash is intentional and required to show root of modules
+  source = "git@github.xdr.accenturefederalcyber.com:mdr-engineering/xdr-terraform-modules.git//base/jira/instance_jira?ref=v1.21.4"
+}
+
+dependency "vpc" {
+  config_path = "../010-vpc-public"
+}
+
+dependency "rds" {
+  config_path = "../210-rds-jira"
+}
+
+# Include all settings from the root terragrunt.hcl file
+include {
+  path = find_in_parent_folders()
+}
+
+# These are the variables we have to pass in to use the module specified in the terragrunt source above
+inputs = {
+  # All of the inputs from the inherited hcl files are available automatically
+  # (via the `inputs` section of the root `terragrunt.hcl`). However, modules
+  # will be more flexible if you specify particular input values.
+  tags = {
+    Purpose = "Jira Ticketing"
+    Terraform = "aws/${basename(get_parent_terragrunt_dir())}/${path_relative_to_include()}/"
+  }
+  instance_count = local.account_vars.locals.github_instance_count
+  instance_type = local.account_vars.locals.instance_types["jira-server"]
+  vpc_id = dependency.vpc.outputs.vpc_id
+  azs = dependency.vpc.outputs.azs
+  public_subnets = dependency.vpc.outputs.public_subnets
+  private_subnets = dependency.vpc.outputs.private_subnets
+  rds_sg = dependency.rds.outputs.security_group_id
+}

+ 2 - 0
test/aws-us-gov/mdr-test-c2/account.hcl

@@ -152,6 +152,8 @@ locals {
     "qcompliance"    = "t3a.small", # legacy: ? not sure
     "github"         = "c5.2xlarge", # legacy: c4.4xlarge in prod, c5.2xlarge in test
     "github-backup"  = "t3a.medium", # legacy: t2.micro
+    "jira-rds"       = "db.t3.medium",
+    "jira-server"    = "t3a.small", # legacy test: t2.small, legacy prod: t2.medium
   }
 
   # TODO: The instance types below should be moved to the instance_type map above