From 3d63d8963617724628d0364aff1d34b885fca0e9 Mon Sep 17 00:00:00 2001 From: vivekshankar1 <59958706+vivekshankar1@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:22:41 +0530 Subject: [PATCH] add chef aws tags (#8750) * add chef aws tags Signed-off-by: Vivek Shankar * cluster ctl deps add in automate deploymnt Signed-off-by: Vivek Shankar --------- Signed-off-by: Vivek Shankar --- components/automate-backend-deployment/habitat/plan.sh | 2 +- .../automate-cli/cmd/chef-automate/genA2haRbTmpl.go | 9 +++++++++ .../automate-cli/cmd/chef-automate/initConfigHa.go | 7 +++++++ components/automate-cluster-ctl/lib/cluster/config.rb | 9 ++++++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/components/automate-backend-deployment/habitat/plan.sh b/components/automate-backend-deployment/habitat/plan.sh index 41bc4abc193..b1e6abd1baa 100644 --- a/components/automate-backend-deployment/habitat/plan.sh +++ b/components/automate-backend-deployment/habitat/plan.sh @@ -24,7 +24,7 @@ pkg_deps=( core/rsync/3.2.3/20240107034222 core/terraform1/1.5.7/20240106055300 core/busybox-static/1.34.1/20240105230035 - chef/automate-ha-cluster-ctl/0.1.0/20250109090656 + chef/automate-ha-cluster-ctl ) #core/aws-cli ( core/aws-cli/1.21.11/20231020110846 core/aws-cli/1.21.11/20220817123642 ) # core/openssl11 ( core/openssl11/1.1.1w/20231020105352 core/openssl11/1.1.1k/20220311131131 ) diff --git a/components/automate-cli/cmd/chef-automate/genA2haRbTmpl.go b/components/automate-cli/cmd/chef-automate/genA2haRbTmpl.go index 696d63ddcfa..baa66c59e0a 100644 --- a/components/automate-cli/cmd/chef-automate/genA2haRbTmpl.go +++ b/components/automate-cli/cmd/chef-automate/genA2haRbTmpl.go @@ -304,5 +304,14 @@ aws do ### DEPRECATED: AWS Tag: Production flag - set true for production environment {{ if .Aws.Config.XProduction }} production "{{ .Aws.Config.XProduction }}" {{ else }} production "{{ .Aws.Config.XProduction }}" {{ end }} tags({"X-Contact"=>"{{ .Aws.Config.XContact }}", "X-Dept"=>"{{ .Aws.Config.XDept }}", "X-Project"=>"{{ .Aws.Config.XProject }}", "X-Customer"=>"{{ .Aws.Config.XCustomer }}", "X-Production"=>"{{ .Aws.Config.XProduction }}"}) + + ### DEPRECATED: Below tags are used for CHEF AWS infrastructure tagging + {{ if .Aws.Config.XEphemeral }} ephemeral "{{ .Aws.Config.XEphemeral }}" {{ else }} # ephemeral "{{ .Aws.Config.XEphemeral }}" {{ end }} + {{ if .Aws.Config.XTeam }} team "{{ .Aws.Config.XTeam }}" {{ else }} # team "{{ .Aws.Config.XTeam }}" {{ end }} + {{ if .Aws.Config.XOwner }} owner "{{ .Aws.Config.XOwner }}" {{ else }} # owner "{{ .Aws.Config.XOwner }}" {{ end }} + {{ if .Aws.Config.XApplication }} application "{{ .Aws.Config.XApplication }}" {{ else }} # application "{{ .Aws.Config.XApplication }}" {{ end }} + {{ if .Aws.Config.XSolutions }} solutions "{{ .Aws.Config.XSolutions }}" {{ else }} # solutions "{{ .Aws.Config.XSolutions }}" {{ end }} + {{ if .Aws.Config.XName }} Name "{{ .Aws.Config.XName }}" {{ else }} # Name "{{ .Aws.Config.XName }}" {{ end }} + {{ if .Aws.Config.XExpiration }} expiration "{{ .Aws.Config.XExpiration }}" {{ else }} # expiration "{{ .Aws.Config.XExpiration }}" {{ end }} end ` diff --git a/components/automate-cli/cmd/chef-automate/initConfigHa.go b/components/automate-cli/cmd/chef-automate/initConfigHa.go index 922a17bb38d..da95c468377 100644 --- a/components/automate-cli/cmd/chef-automate/initConfigHa.go +++ b/components/automate-cli/cmd/chef-automate/initConfigHa.go @@ -101,6 +101,13 @@ type ConfigToml struct { XProject string `toml:"X-Project"` XProduction string `toml:"X-Production"` XCustomer string `toml:"X-Customer"` + XEphemeral string `toml:"ephemeral"` + XTeam string `toml:"team"` + XOwner string `toml:"owner"` + XApplication string `toml:"application"` + XSolutions string `toml:"solutions"` + XName string `toml:"Name"` + XExpiration string `toml:"expiration"` AwsAutomateRoute53Prefix string `toml:"aws_automate_route53_prefix"` AwsChefServerRoute53Prefix string `toml:"aws_chef_server_route53_prefix"` AwsRoute53HostedZone string `toml:"aws_route53_hosted_zone"` diff --git a/components/automate-cluster-ctl/lib/cluster/config.rb b/components/automate-cluster-ctl/lib/cluster/config.rb index 4e8df015b9e..7e412a1de1b 100644 --- a/components/automate-cluster-ctl/lib/cluster/config.rb +++ b/components/automate-cluster-ctl/lib/cluster/config.rb @@ -210,7 +210,14 @@ def self.restore_deploy_symlink(path) { "X-Contact" => configuration[:contact], "X-Dept" => configuration[:dept], - "X-Project" => configuration[:project] + "X-Project" => configuration[:project], + "ephemeral" => configuration[:ephemeral], + "team" => configuration[:team], + "owner" => configuration[:owner], + "application" => configuration[:application], + "solutions" => configuration[:solutions], + "Name" => configuration[:Name], + "expiration" => configuration[:expiration], } end end