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

helpful-ice-5738

02/08/2019, 9:39 PM
I am setting up an API with `aws.apigateway.x.API()`:
Copy code
const api = new aws.apigateway.x.API("name", {
	stageName: "demo",
    routes: [
	    {
	        path: "/",
	        method: "POST",
	        eventHandler: lambda,
	    },
	    {
	    	path: "/",
	    	method: "PUT",
	    	eventHandler: lambda,
	    }
    ]
});
and am attempting to attach an api key…
Copy code
const api_key = new aws.apigateway.ApiKey("demo", {
	name: "demo",
	stageKeys: [{
		restApi: api.id,
		stageName: api.stageName
	}]
})
output from pulumi up is:
Copy code
aws:apigateway:ApiKey (demo):
    warning: urn:pulumi:pulumi_demo::webserver::aws:apigateway/apiKey:ApiKey::demo verification warning: "stage_key": [DEPRECATED] Since the API Gateway usage plans feature was launched on August 11, 2016, usage plans are now required to associate an API key with an API stage
    error: aws:apigateway/apiKey:ApiKey resource 'demo' has a problem: "stage_key.0.stage_name": required field is not set
    error: aws:apigateway/apiKey:ApiKey resource 'demo' has a problem: "stage_key.0.rest_api_id": required field is not set
with api.ts, I am able to set stageName per
Copy code
const stageName = args.stageName || "stage"; `
but apikey.ts doesn’t seem to ingest the var?
gotta access it via deployment?
exports.stagename = api.stageName;
must be undefined (returns no export) and
exports.stagename = api.deployment.stageName;
returns an empty string (edited)
got it….
api.stage.stageName
😄
and
api.restApi.id
(leaving this here in case it helps someone else but I am good to go - turns out you should look at the structure and exports.blah is a good way to do that 😛 )