Skip to content

Commit

Permalink
Adding resource groups #27
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosrodlop committed Jan 10, 2024
1 parent 501f822 commit c2a1952
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion blueprints/01-getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Initialize the root module and any associated configuration for providers and fi
For more detailed information, see the documentation for the [Terraform Core workflow](https://www.terraform.io/intro/core-workflow).
TODO: Deloyed resources link to AWS Resource Groups
Once deployed has finished, it is possible to check the generated AWS resources via Resource Groups.
> [!TIP]
> These steps are automated in the [Makefile](../../Makefile) at the root of the project under the target `tfDeploy`.
Expand Down
21 changes: 21 additions & 0 deletions blueprints/01-getting-started/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ locals {

vpc_name = "${local.name}-vpc"
cluster_name = "${local.name}-eks"
resource_group_name = "${local.name}-rg"
kubeconfig_file = "kubeconfig_${local.name}.yaml"
kubeconfig_file_path = abspath("${path.root}/${local.kubeconfig_file}")

Expand Down Expand Up @@ -231,3 +232,23 @@ module "vpc" {
tags = local.tags

}

resource "aws_resourcegroups_group" "bp_rg" {
name = local.resource_group_name

resource_query {
query = <<JSON
{
"ResourceTypeFilters": [
"AWS::AllSupported"
],
"TagFilters": [
{
"Key": "tf:blueprint",
"Values": ["${local.name}"]
}
]
}
JSON
}
}
21 changes: 21 additions & 0 deletions blueprints/02-at-scale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ locals {
vpc_name = "${local.name}-vpc"
cluster_name = "${local.name}-eks"
efs_name = "${local.name}-efs"
resource_group_name = "${local.name}-rg"
kubeconfig_file = "kubeconfig_${local.name}.yaml"
kubeconfig_file_path = abspath("${path.root}/${local.kubeconfig_file}")

Expand Down Expand Up @@ -407,3 +408,23 @@ module "vpc" {
tags = local.tags

}

resource "aws_resourcegroups_group" "bp_rg" {
name = local.resource_group_name

resource_query {
query = <<JSON
{
"ResourceTypeFilters": [
"AWS::AllSupported"
],
"TagFilters": [
{
"Key": "tf:blueprint",
"Values": ["${local.name}"]
}
]
}
JSON
}
}

0 comments on commit c2a1952

Please sign in to comment.