Skip to content

Commit bf4fb05

Browse files
committed
switch to input json path
1 parent 6afbe09 commit bf4fb05

5 files changed

Lines changed: 1164 additions & 85 deletions

File tree

package/cloudshell/iac/terraform/services/clp_envvar_handler.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ def set_env_vars_based_on_clp(self):
6767
os.environ["ARM_CLIENT_SECRET"] = self._shell_helper.api.DecryptPassword(attr.Value).Value
6868

6969

70-
71-
7270
class GCPCloudProviderEnvVarHandler(BaseCloudProviderEnvVarHandler):
7371
def __init__(self, clp_res_model, clp_resource_attributes, shell_helper):
7472
BaseCloudProviderEnvVarHandler.__init__(self)
@@ -81,7 +79,7 @@ def set_env_vars_based_on_clp(self):
8179
if self.does_attribute_match(self._clp_res_model, attr, self._shell_helper, "CREDENTIALS JSON PATH"):
8280
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = attr.Value
8381
if self.does_attribute_match(self._clp_res_model, attr, self._shell_helper, "PROJECT"):
84-
os.environ["project"] = attr.Value
82+
os.environ["GOOGLE_PROJECT"] = attr.Value
8583
project_flag = True
8684
if not project_flag:
8785
raise ValueError("Project ID was not found on GCP Cloud Provider")

shells/backends/gcp_tf_backend/shell-definition.yaml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,14 @@ node_types:
1717
vendor.resource.Gcp Tf Backend:
1818
derived_from: cloudshell.nodes.GenericResource
1919
properties:
20-
Private Key:
21-
description: Private key (Use only if Cloud Provider not specified)
22-
type: cloudshell.datatypes.Password
23-
tags: [ setting, user_input ]
24-
# Private Key:
25-
# description: Private key (Use only if Cloud Provider not specified)
26-
# type: string
27-
# tags: [ setting, user_input ]
28-
# Client Email:
29-
# description: Client Email (Use only if Cloud Provider not specified)
30-
# type: cloudshell.datatypes.Password
31-
# tags: [ setting, user_input ]
32-
Client Email:
33-
description: Client Email (Use only if Cloud Provider not specified)
20+
Credentials Json Path:
21+
description: Credentials Json Path (Use only if Cloud Provider not specified)
3422
type: string
3523
tags: [ setting, user_input ]
3624
Bucket Name:
3725
description: The name of the bucket to be used in order to save the state file
3826
type: string
3927
tags: [ setting, user_input ]
40-
Prefix:
41-
description: GCS prefix inside the bucket. Named states for workspaces are stored in an object called <prefix>/<name>.tfstate (Optional)
42-
type: string
43-
tags: [ setting, user_input ]
4428
Cloud Provider:
4529
description: In case Private Key and Client Email were not filled - the keys from the cloud provider will be used.
4630
type: string
@@ -72,18 +56,12 @@ node_types:
7256
default: Describe the resource shell template
7357
Bucket Name:
7458
description: The name of the bucket to be used in order to save the state file
75-
type: string
76-
Prefix:
77-
description: GCS prefix inside the bucket. Named states for workspaces are stored in an object called <prefix>/<name>.tfstate (Optional)
78-
type: string
59+
type: string
7960
# Private Key:
8061
# description: Private key
8162
# type: string
82-
Private Key:
83-
description: Private key
84-
type: cloudshell.datatypes.Password
85-
Client Email:
86-
description: Client Email
63+
Credentials Json Path:
64+
description: Credentials Json Path
8765
type: string
8866
Project:
8967
type: string

shells/backends/gcp_tf_backend/src/data_model.py

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -155,34 +155,19 @@ def cloudshell_model_name(self):
155155
return 'GcpTfBackend'
156156

157157
@property
158-
def private_key(self):
159-
"""
160-
:rtype: string
161-
"""
162-
return self.attributes['Gcp Tf Backend.Private Key'] if 'Gcp Tf Backend.Private Key' in self.attributes else None
163-
164-
@private_key.setter
165-
def private_key(self, value):
166-
"""
167-
Private key (Use only if Cloud Provider not specified)
168-
:type value: string
169-
"""
170-
self.attributes['Gcp Tf Backend.Private Key'] = value
171-
172-
@property
173-
def client_email(self):
158+
def credentials_json_path(self):
174159
"""
175160
:rtype: str
176161
"""
177-
return self.attributes['Gcp Tf Backend.Client Email'] if 'Gcp Tf Backend.Client Email' in self.attributes else None
162+
return self.attributes['Gcp Tf Backend.Credentials Json Path'] if 'Gcp Tf Backend.Credentials Json Path' in self.attributes else None
178163

179-
@client_email.setter
180-
def client_email(self, value):
164+
@credentials_json_path.setter
165+
def credentials_json_path(self, value):
181166
"""
182-
Client Email (Use only if Cloud Provider not specified)
167+
Credentials Json Path (Use only if Cloud Provider not specified)
183168
:type value: str
184169
"""
185-
self.attributes['Gcp Tf Backend.Client Email'] = value
170+
self.attributes['Gcp Tf Backend.Credentials Json Path'] = value
186171

187172
@property
188173
def bucket_name(self):
@@ -199,21 +184,6 @@ def bucket_name(self, value):
199184
"""
200185
self.attributes['Gcp Tf Backend.Bucket Name'] = value
201186

202-
@property
203-
def prefix(self):
204-
"""
205-
:rtype: str
206-
"""
207-
return self.attributes['Gcp Tf Backend.Prefix'] if 'Gcp Tf Backend.Prefix' in self.attributes else None
208-
209-
@prefix.setter
210-
def prefix(self, value):
211-
"""
212-
GCS prefix inside the bucket. Named states for workspaces are stored in an object called <prefix>/<name>.tfstate (Optional)
213-
:type value: str
214-
"""
215-
self.attributes['Gcp Tf Backend.Prefix'] = value
216-
217187
@property
218188
def cloud_provider(self):
219189
"""

0 commit comments

Comments
 (0)