average-plastic-1653
02/05/2024, 6:55 PMaverage-plastic-1653
02/05/2024, 7:00 PMred-match-15116
02/05/2024, 7:06 PMCan I add an ESC environment to a stack using the Automation API? Thanks.Yup. We're working on getting the SDK docs updated with these new additions but in the meanwhile, here's the test code that exercises these functions for an example: https://github.com/pulumi/pulumi/blob/6f41d715d90dfd87b9d274b4a1bc95ca1a6b6b14/sdk/python/lib/test/automation/test_local_workspace.py#L211
average-plastic-1653
02/05/2024, 7:17 PMred-match-15116
02/05/2024, 7:19 PMaverage-plastic-1653
02/05/2024, 7:29 PMred-match-15116
02/05/2024, 7:30 PMaverage-plastic-1653
02/05/2024, 7:30 PMaverage-plastic-1653
02/05/2024, 7:30 PMred-match-15116
02/05/2024, 7:30 PMaverage-plastic-1653
02/06/2024, 6:24 PMstack = auto.create_or_select_stack(stack_name=client_code, work_dir=work_dir)
stack.add_environments("gcp-base-env")
config = stack.get_all_config() #is this needed?
stack.refresh(on_output=print)
up_res = stack.up(on_output=print, debug=True)
Code snippet from _ _ main __ .py
config = Config()
# GCP
org_billing_account = config.get("gcp-base-env:GCP_ORG_BILLING_ACCOUNT")
org_id = config.get("gcp-base-env:GCP_ORG_ID")
attached a screenshot of running pulumi env openred-match-15116
02/06/2024, 7:24 PMconfig = stack.get_all_config()
- you would only need that if you wanted to access the configuration values within the automation script (rather than the pulumi program)
From your ___main__.py_
, can you try the following:
config = Config("gcp-base-env")
org_billing_account = config.get("GCP_ORG_BILLING_ACCOUNT")
org_id = config.get("GCP_ORG_ID")
average-plastic-1653
02/06/2024, 7:44 PMaverage-plastic-1653
02/06/2024, 7:58 PMmain.56a454faf2ef5516.js:1 ERROR TypeError: Cannot read properties of undefined (reading 'indexOf')
at main.56a454faf2ef5516.js:1:3627252
at Array.filter (<anonymous>)
at t.getValidEnvironments (main.56a454faf2ef5516.js:1:3627224)
at Object.next (main.56a454faf2ef5516.js:1:3627121)
at je.next (main.56a454faf2ef5516.js:1:10124)
at He._next (main.56a454faf2ef5516.js:1:9804)
at He.next (main.56a454faf2ef5516.js:1:9497)
at main.56a454faf2ef5516.js:1:15367
at sn._next (main.56a454faf2ef5516.js:1:14888)
at sn.next (main.56a454faf2ef5516.js:1:9497)
red-match-15116
02/06/2024, 7:59 PMaverage-plastic-1653
02/06/2024, 8:00 PMaverage-plastic-1653
02/06/2024, 8:00 PM