Skip to content

Commit

Permalink
ci: update tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1230 committed Dec 17, 2023
1 parent 482a9a4 commit 60d9c57
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion terraform/environments/shared-resources/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ resource "aws_resourcegroups_group" "resource_group" {
}

tags = {
awsApplication = "${var.project-name}-group"
awsApplication = "${var.project-name}"
}
}

Expand Down
29 changes: 29 additions & 0 deletions terraform/init-state/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ provider "aws" {

data "aws_caller_identity" "current" {}

variable "common_tags" {
description = "Common tags to be applied to all resources"
type = map(string)
default = {
awsApplication = "personal-website"
}
}

variable "project-name" {
description = "Project name"
default = "personal-website"
Expand All @@ -23,9 +31,29 @@ locals {
dynamodb_table_name = "${var.project-name}-terraform-locks"
}

resource "aws_resourcegroups_group" "resource_group" {
name = var.project-name

resource_query {
query = jsonencode({
ResourceTypeFilters = ["AWS::AllSupported"]
TagFilters = [
{
Key = "awsApplication"
Values = [var.common_tags["awsApplication"]]
}
]
})
}

tags = {
awsApplication = "${var.project-name}-group"
}
}

resource "aws_s3_bucket" "terraform_state" {
bucket = local.bucket_name
tags = var.common_tags

lifecycle {
prevent_destroy = true
Expand All @@ -43,6 +71,7 @@ resource "aws_dynamodb_table" "terraform_locks" {
name = local.dynamodb_table_name
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
tags = var.common_tags

attribute {
name = "LockID"
Expand Down

0 comments on commit 60d9c57

Please sign in to comment.