From 8447cf7519f771ee3bf3b633a5ae55f26d4ad5ce Mon Sep 17 00:00:00 2001 From: nikhilmulinti Date: Mon, 23 Dec 2024 16:08:37 +0530 Subject: [PATCH] updating envyamlupdater.go script --- .../terraform/scripts/envYAMLUpdater.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/infra-as-code/terraform/scripts/envYAMLUpdater.go b/infra-as-code/terraform/scripts/envYAMLUpdater.go index f9ba6bdd6..d55689848 100644 --- a/infra-as-code/terraform/scripts/envYAMLUpdater.go +++ b/infra-as-code/terraform/scripts/envYAMLUpdater.go @@ -18,21 +18,12 @@ func main() { } // Unmarshal the JSON output into a Go struct type TfOutput struct { - EsDataVolumeIDs struct { - Value []string `json:"value"` - } `json:"es_data_volume_ids"` - EsMasterVolumeIDs struct { - Value []string `json:"value"` - } `json:"es_master_volume_ids"` DBHost struct { Value string `json:"value"` } `json:"db_instance_endpoint"` DBName struct { Value string `json:"value"` } `json:"db_instance_name"` - Zones struct { - Value []string `json:"value"` - } `json:"zone"` KubeConfig struct { Value string `json:"value"` } `json:"kubectl_config"` @@ -50,15 +41,9 @@ func main() { os.Exit(1) } // Replace the placeholders with the actual volume IDs - output := strings.ReplaceAll(string(yamlFile), "", tfOutput.EsDataVolumeIDs.Value[0]) - output = strings.ReplaceAll(output, "", tfOutput.EsDataVolumeIDs.Value[1]) - output = strings.ReplaceAll(output, "", tfOutput.EsDataVolumeIDs.Value[2]) - output = strings.ReplaceAll(output, "", tfOutput.EsMasterVolumeIDs.Value[0]) - output = strings.ReplaceAll(output, "", tfOutput.EsMasterVolumeIDs.Value[1]) - output = strings.ReplaceAll(output, "", tfOutput.EsMasterVolumeIDs.Value[2]) + output := string(yamlFile) output = strings.ReplaceAll(output, "", tfOutput.DBHost.Value) output = strings.ReplaceAll(output, "", tfOutput.DBName.Value) - output = strings.ReplaceAll(output, "", tfOutput.Zones.Value[0]) // Write the updated YAML to stdout fmt.Println(output)