Skip to content

Commit

Permalink
Align all resources to get the same "Group" tag
Browse files Browse the repository at this point in the history
  • Loading branch information
eldada committed Nov 15, 2024
1 parent c8e96cb commit f0da4c0
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
9 changes: 8 additions & 1 deletion 6.artifactory-aws-install/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ module "eks" {
}
}
}
tags = {
Group = var.common_tag
}
}

eks_managed_node_groups = {
Expand Down Expand Up @@ -83,7 +86,7 @@ module "eks" {
}

tags = {
Name = var.cluster_name
Group = var.common_tag
}
}

Expand All @@ -100,4 +103,8 @@ module "irsa-ebs-csi" {
provider_url = module.eks.oidc_provider
role_policy_arns = [data.aws_iam_policy.ebs_csi_policy.arn]
oidc_fully_qualified_subjects = ["system:serviceaccount:kube-system:ebs-csi-controller-sa"]

tags = {
Group = var.common_tag
}
}
13 changes: 9 additions & 4 deletions 6.artifactory-aws-install/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
output "cluster_endpoint" {
output "eks_cluster_endpoint" {
description = "Endpoint for EKS control plane"
value = module.eks.cluster_endpoint
}

output "cluster_security_group_id" {
output "eks_cluster_security_group_id" {
description = "Security group ids attached to the cluster control plane"
value = module.eks.cluster_security_group_id
}
Expand All @@ -13,18 +13,23 @@ output "region" {
value = var.region
}

output "cluster_name" {
output "eks_cluster_name" {
description = "Kubernetes Cluster Name"
value = module.eks.cluster_name
}

output "resources_tag" {
description = "The common tag applied on all resources"
value = "Group: ${var.common_tag}"
}

# Output the command to configure kubectl config to the newly created EKS cluster
output "x_cluster_kubectl_context" {
description = "Connect kubectl to Kubernetes Cluster"
value = "aws eks --region ${var.region} update-kubeconfig --name ${module.eks.cluster_name}"
}

output "x_artifactory_url" {
# value = data.kubernetes_resources.nginx_service.objects[0].metadata
description = "The URL of the load balancer for Artifactory"
value = "https://${data.kubernetes_resources.nginx_service.objects[0].status.loadBalancer.ingress[0].hostname}"
}
6 changes: 3 additions & 3 deletions 6.artifactory-aws-install/rds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_db_subnet_group" "artifactory_subnet_group" {
subnet_ids = module.vpc.private_subnets

tags = {
Name = "artifactory-subnet-group"
Group = var.common_tag
}
}

Expand All @@ -28,7 +28,7 @@ resource "aws_db_instance" "artifactory_db" {
skip_final_snapshot = true

tags = {
Name = "artifactory-db"
Group = var.common_tag
}
}

Expand All @@ -50,6 +50,6 @@ resource "aws_security_group" "rds_sg" {
}

tags = {
Name = "artifactory-rds-sg"
Group = var.common_tag
}
}
2 changes: 1 addition & 1 deletion 6.artifactory-aws-install/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "aws_s3_bucket" "artifactory_binarystore" {
force_destroy = true

tags = {
Name = "artifactory-binarystore"
Group = var.common_tag
}

lifecycle {
Expand Down
5 changes: 5 additions & 0 deletions 6.artifactory-aws-install/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ variable "namespace" {
variable "artifactory_chart_version" {
default = "107.98.7"
}

variable "common_tag" {
description = "The 'Group' tag to apply to all resources"
default = "jfrog"
}
4 changes: 4 additions & 0 deletions 6.artifactory-aws-install/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ module "vpc" {
private_subnet_tags = {
"kubernetes.io/role/internal-elb" = 1
}

tags = {
Group = var.common_tag
}
}

0 comments on commit f0da4c0

Please sign in to comment.