handsome-rocket-92204
05/21/2019, 6:18 PMincalculable-sundown-82514
05/21/2019, 6:38 PMawait
them in an async
functionincalculable-sundown-82514
05/21/2019, 6:39 PMhandsome-rocket-92204
05/21/2019, 6:43 PMasync def get_restapi(name):
result = await apigateway.get_rest_api(name=name)
return result.id
if get_restapi('test-jenkins') == None:
rest_api = apigateway.RestApi(name, name=name)
Obviously this wouldn't work but that's the functionality I'm looking forincalculable-sundown-82514
05/21/2019, 6:44 PMapigateway.get_rest_api
returns None when the rest API isn’t found, but I think it’s more likely that it’ll throw an exception insteadincalculable-sundown-82514
05/21/2019, 6:44 PMif get_restapi
logic inside its own async function and then await get_restapi
to await the future.handsome-rocket-92204
05/21/2019, 6:47 PMhandsome-rocket-92204
05/21/2019, 7:48 PMapigwclient = boto3.client('apigateway')
existingapigws = apigwclient.get_rest_apis().get('items')
for gw in existingapigws:
name = gw.get('name')
if name in names:
names.remove(name)
So I'm just removing gateways that already exist from my list of ones to create before the main loophandsome-rocket-92204
05/21/2019, 7:53 PMlittle-river-49422
05/21/2019, 8:33 PMlittle-river-49422
05/21/2019, 8:33 PMlittle-river-49422
05/21/2019, 8:36 PMhandsome-rocket-92204
05/21/2019, 8:38 PMbig-glass-16858
05/22/2019, 12:34 PMprops
in pulumi.ComponentResource()
, documentation says the following : props (Optional[dict]) – An optional list of input properties to use as inputs for the resource. , When checking Node.JS docs for `new ComponentResource()`it doesn't have props and it says : unused . Component resources do not communicate or store their properties with the Pulumi engine. I'm a little bit confused, did I miss something ?handsome-rocket-92204
05/22/2019, 2:44 PMUse get functions to read the existing resource and bring its parameters into the stack, like this:
export const database = gcp.sql.DatabaseInstance.get('test-database', 'name-in-gcp');
Is there a way to do the same in Python? Trying to come up with a feasible solution for migrating Terraform-controlled resources into a Pulumi stacklittle-river-49422
05/22/2019, 4:30 PMlittle-river-49422
05/22/2019, 4:32 PMlittle-river-49422
05/22/2019, 4:32 PMlittle-river-49422
05/22/2019, 4:32 PMhandsome-rocket-92204
05/22/2019, 4:33 PMlittle-river-49422
05/22/2019, 4:34 PMhandsome-rocket-92204
05/22/2019, 5:08 PMlittle-river-49422
05/22/2019, 6:34 PMlittle-river-49422
05/22/2019, 6:35 PMhandsome-rocket-92204
05/22/2019, 7:06 PMhandsome-rocket-92204
05/22/2019, 7:09 PMproud-artist-4864
05/23/2019, 7:06 AMlittle-river-49422
05/23/2019, 7:07 AMpulumi up
for surelittle-river-49422
05/23/2019, 7:07 AMproud-artist-4864
05/23/2019, 7:07 AMproud-artist-4864
05/23/2019, 7:07 AM