From 6f30e43f8a330c0bc0ad122ebf801bd6ae28cd5c Mon Sep 17 00:00:00 2001 From: maqiuyujoyce <33072938+maqiuyujoyce@users.noreply.github.com> Date: Thu, 9 Mar 2023 15:06:35 -0800 Subject: [PATCH] Remove percent sign when parsing metadata name (#7417) * Remove percent sign when parsing metadata name * Remove percent sign when parsing metadata name --- mmv1/provider/terraform_kcc.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mmv1/provider/terraform_kcc.rb b/mmv1/provider/terraform_kcc.rb index daa10cb72176..bc1a29949af8 100644 --- a/mmv1/provider/terraform_kcc.rb +++ b/mmv1/provider/terraform_kcc.rb @@ -87,8 +87,10 @@ def copy_common_files(output_folder, generate_code, generate_docs) end def guess_metadata_mapping_name(object) # Split the last import format by '/' and take the last part. Then use # the regex to verify if it is a value field in the format of {{value}}. - last_import_part = - import_id_formats_from_resource(object)[-1].split('/')[-1].scan(/{{[[:word:]]+}}/) + last_import_part = import_id_formats_from_resource(object)[-1] + .gsub('%', '') + .split('/')[-1] + .scan(/{{[[:word:]]+}}/) # If it is a value field, the length of last_import_part will be 1; # otherwise it'll be 0. # Remove '{{' and '}}' and only return the field name.