UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit 6356ef3d authored by Ismail Ahmad's avatar Ismail Ahmad
Browse files

refactor(cloud resource tags): adds CI_PIPELIN_URL tag to resources to know...

refactor(cloud resource tags): adds CI_PIPELIN_URL tag to resources to know what pipeline created it
parent 214778ed
No related branches found
No related tags found
1 merge request!153BB-1271 Fix TF Workspace Deletion
Pipeline #132661 failed
Showing
with 29 additions and 7 deletions
......@@ -11,8 +11,10 @@ terraform {
module "ci" {
source = "../../main"
# Set by CI - "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
# Set by CI - "TF_VAR_env=$(echo $CI_COMMIT_REF_SLUG | cut -c 1-7)-$(echo $CI_COMMIT_SHA | cut -c 1-7)"
env = var.env
# Set by CI - "TF_VAR_ci_pipeline_url=$ci_pipeline_url"
ci_pipeline_url = var.ci_pipeline_url
# Calculated in CI
vpc_cidr = var.vpc_cidr
......
variable "vpc_cidr" {}
variable "env" {}
\ No newline at end of file
variable "env" {}
variable "ci_pipeline_url" {}
\ No newline at end of file
......@@ -29,7 +29,8 @@ locals {
tags = {
"terraform" = "true",
"env" = var.env,
"project" = "umbrella"
"project" = "umbrella",
"ci_pipeline_url" = var.ci_pipeline_url
}
}
......
......@@ -28,4 +28,10 @@ variable "hub_tgwa" {
variable "hub_tgw_rt" {
default = "tgw-rtb-04b66987e7d96a3d4"
}
\ No newline at end of file
}
variable ci_pipeline_url {
type = string
default = "none"
description = "URL to the pipeline that created this resource"
}
......@@ -23,6 +23,7 @@ module "ci" {
source = "../../main"
env = var.env
ci_pipeline_url = var.ci_pipeline_url
vpc_id = data.terraform_remote_state.networking.outputs.vpc_id
subnets = data.terraform_remote_state.networking.outputs.intra_subnets
......
......@@ -2,4 +2,5 @@ variable "aws_region" {
default = "us-gov-west-1"
}
variable "env" {}
\ No newline at end of file
variable "env" {}
variable "ci_pipeline_url" {}
\ No newline at end of file
......@@ -23,6 +23,7 @@ module "ci" {
source = "../../main"
env = var.env
ci_pipeline_url = var.ci_pipeline_url
vpc_id = data.terraform_remote_state.networking.outputs.vpc_id
private_subnets = data.terraform_remote_state.networking.outputs.private_subnets
public_subnets = data.terraform_remote_state.networking.outputs.public_subnets
......
......@@ -2,4 +2,5 @@ variable "aws_region" {
default = "us-gov-west-1"
}
variable "env" {}
\ No newline at end of file
variable "env" {}
variable "ci_pipeline_url" {}
\ No newline at end of file
......@@ -4,7 +4,8 @@ locals {
tags = {
"project" = "umbrella"
"env" = var.env
"terraform" = "true"
"terraform" = "true",
"ci_pipeline_url" = var.ci_pipeline_url
}
}
......
......@@ -75,3 +75,9 @@ variable "agent_asg" {
variable "agent_spot" {
default = false
}
variable ci_pipeline_url {
type = string
default = "none"
description = "URL to the pipeline that created this resource"
}
......@@ -17,6 +17,7 @@ include:
interruptible: false
variables:
TF_IN_AUTOMATION: "1"
TF_VAR_ci_pipeline_url: $CI_PIPELINE_URL
before_script:
- echo "$TF_VAR_env"
- cd ${CI_PROJECT_DIR}/${TF_ROOT}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment