https://pulumi.com logo
#python
Title
# python
h

handsome-rocket-92204

05/21/2019, 3:22 PM
Finally got it working. had to import asyncio and use ensure_future. Here's example code:
Copy code
import asyncio
import pulumi
from pulumi_aws import apigateway

async def get_vpclink(name):
  result = await apigateway.get_vpc_link(name=name)
  return result.id

rest_api = apigateway.RestApi('test-api-jenkins')

api_method = apigateway.Method('post', authorization='NONE', http_method='POST',
                              resource_id=rest_api.root_resource_id,
                              rest_api=rest_api.id)

integration = apigateway.Integration('post', connection_id=asyncio.ensure_future(get_vpclink('test-jenkins')),
                                    connection_type='VPC_LINK', http_method='POST',
                                    resource_id=rest_api.root_resource_id,
                                    rest_api=rest_api.id, type='HTTP_PROXY',
                                    uri='<https://test-api-jenkins.example.com/generic-webhook-trigger/invoke>')

pulumi.export('REST API ID', rest_api.id)