GoogleCloudPlatform / GoogleCloudPlatform/deploymentmanager-samples

unable to split the folder name value in jinja file

Open
#531 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jinja
Stars
951
Forks
700
PR merge metrics
No merged PRs in 30d

Description

Hi Team,

I'm doing project factory automation in jinja file, However i faced issue while split the folder name and folder id from folder api. Please find the below steps for more details

step1: I have created a folder using below code and it is successfully created.

resources:
- name: {{ properties['foldername'] }}
type: gcp-types/cloudresourcemanager-v2:folders
properties:
{% if properties['isorg'] == "yes" %}
parent: organizations/{{ properties['orgid'] }}
{% else %}
parent: folders/{{ properties['parentfolderid'] }}
{% endif %}
displayName: {{ properties['folderdisplayName'] }}

Step 2: once created i need the folder id to parse the value in parent->id of project.

- name: {{ properties['projectid'] }}
type: gcp-types/cloudresourcemanager-v1:projects
properties:
projectId: {{ properties['projectid'] }}
parent:
type: folders
id: $(ref.{{ properties['foldername'] }}.name).split('/')[1]

I'm getting error that above split command, it is not working. Kindly assist me how to split the above value>

Example:
Output of Inline reference value for newly created folder name is : core/123456789
I want to split foldername is core and folderid is 12345678 with above jinja file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.