Skip to content

Commit

Permalink
Adding Resource Tags (#20)
Browse files Browse the repository at this point in the history
* Added repo, owner, and desc tags on resources

Co-authored-by: Aaron Miller <aaron.c.miller@saic.com>
  • Loading branch information
ac-miller and Aaron Miller committed Jan 11, 2021
1 parent 1f444be commit 61e6cbb
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ This module will use SemVer, and will stay on v0.X for the foreseeable future
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| additional\_tag\_map | Map of additional tags to apply to every taggable resource. If you don't want any use an empty map - '{}' | `map(string)` | n/a | yes |
| description | Short description of what/why this product exists | `string` | n/a | yes |
| hosted\_zone\_domain\_name | Domain name of the hosted zone to create records in | `string` | n/a | yes |
| hosted\_zone\_id | ID of Route53 hosted zone to create records in | `string` | n/a | yes |
| instance\_type | Instance type to use for the cluster nodes | `string` | n/a | yes |
Expand All @@ -185,8 +186,10 @@ This module will use SemVer, and will stay on v0.X for the foreseeable future
| node\_group\_2\_subnet\_id | Subnet to deploy node group 2 to | `string` | n/a | yes |
| node\_group\_3\_subnet\_id | Subnet to deploy node group 3 to | `string` | n/a | yes |
| node\_volume\_size | Volume size of worker node disk in GB | `string` | n/a | yes |
| owner | Email address of owner | `string` | n/a | yes |
| rancher\_letsencrypt\_email | Email address to use for Rancher's LetsEncrypt certificate | `string` | n/a | yes |
| rancher\_letsencrypt\_environment | LetsEncrypt environment to use - Valid options: 'staging', 'production' | `string` | n/a | yes |
| repo | Repo URL that is responsible for this resource | `string` | n/a | yes |
| stage | Stage, e.g. 'prod', 'staging', 'dev' | `string` | n/a | yes |
| subdomain\_rancher | Rancher's endpoint will be '{subdomain\_rancher}.{hosted\_zone\_domain\_name}'. {subdomain\_rancher} can be multi-layered e.g. 'rancher.foo.bar' | `string` | n/a | yes |
| vpc\_id | ID of the VPC to deploy to | `string` | n/a | yes |
Expand Down
3 changes: 3 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module "rke_rancher_master_cluster" {
//source = "git::https://path/to/repo.git?ref=tags/x.y.z"
source = "../.."
additional_tag_map = {}
description = var.description
instance_type = var.instance_type
kubernetes_version = var.kubernetes_version
name = var.name
Expand All @@ -64,6 +65,8 @@ module "rke_rancher_master_cluster" {
node_group_2_subnet_id = module.subnets.public_subnet_ids[1]
node_group_3_subnet_id = module.subnets.public_subnet_ids[2]
node_volume_size = var.node_volume_size
owner = var.owner
repo = var.repo
stage = var.stage
vpc_id = module.vpc.vpc_id
hosted_zone_id = var.hosted_zone_id
Expand Down
2 changes: 2 additions & 0 deletions examples/complete/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ region = "us-east-1"
namespace = "saic-oss"
stage = "example"
name = "terraform-aws-rke-rancher-master-cluster"
repo = "https://github.com/saic-oss/terraform-aws-rke-rancher-master-cluster"
description = "Example deployment of the Rancher Master cluster"
instance_type = "t3a.medium"
kubernetes_version = "v1.18.9-rancher1-1"
node_volume_size = "50"
Expand Down
15 changes: 15 additions & 0 deletions examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ variable "name" {
description = "Solution name"
}

variable "repo" {
type = string
description = "Repo URL that is responsible for this resource"
}

variable "owner" {
type = string
description = "Email address of owner"
}

variable "description" {
type = string
description = "Short description of what/why this product exists"
}

variable "region" {
type = string
description = "AWS region to deploy to"
Expand Down
2 changes: 2 additions & 0 deletions load_balancers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ resource "aws_elb" "ingress" { #tfsec:ignore:AWS005
}
instances = concat(tolist(aws_instance.node_group_1.*.id), tolist(aws_instance.node_group_2.*.id), tolist(aws_instance.node_group_3.*.id))
idle_timeout = 1800

tags = module.label.tags
}
6 changes: 6 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ module "label" {
stage = var.stage
name = var.name
additional_tag_map = var.additional_tag_map

tags = {
"Repo" = "${var.repo}",
"Owner" = "${var.owner}",
"Description" = "${var.description}"
}
}
15 changes: 15 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ variable "name" {
description = "Solution name"
}

variable "repo" {
type = string
description = "Repo URL that is responsible for this resource"
}

variable "owner" {
type = string
description = "Email address of owner"
}

variable "description" {
type = string
description = "Short description of what/why this product exists"
}

variable "additional_tag_map" {
type = map(string)
description = "Map of additional tags to apply to every taggable resource. If you don't want any use an empty map - '{}'"
Expand Down

0 comments on commit 61e6cbb

Please sign in to comment.