Skip to content

Commit

Permalink
Remove percent sign when parsing metadata name (GoogleCloudPlatform#7417
Browse files Browse the repository at this point in the history
)

* Remove percent sign when parsing metadata name

* Remove percent sign when parsing metadata name
  • Loading branch information
maqiuyujoyce authored and ericayyliu committed Jul 26, 2023
1 parent 82d172e commit 3f3aaf8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mmv1/provider/terraform_kcc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3f3aaf8

Please sign in to comment.