:wave: Hey all, having a great experience with Pul...
# general
m
👋 Hey all, having a great experience with Pulumi so far. I had a question about API Gateway, wondering if I'm misunderstanding or if maybe this is a limitation in Pulumi. The AWS API Gateway docs state that you can specify
$default
as a stage name, which will let you route via
/
- I'd like to do that.
Copy code
You can create a $default stage that is served from the base of your API's URL—for example, https://{api_id}.execute-api.{region}.<http://amazonaws.com/|amazonaws.com/>. You use this URL to invoke an API stage.
I set that in my pulumi code:
Copy code
stage = aws.apigateway.Stage(
            f"{self.rest_api._name}-prod-stage",
            deployment=deployment.id,
            rest_api=self.rest_api.id,
            stage_name="$default",
            opts=pulumi.ResourceOptions(parent=self),
        )
but I get this error:
Copy code
aws:apigateway:Stage (api-gateway-prod-stage):
    error: 1 error occurred:
    	* Error creating API Gateway Stage: BadRequestException: Stage name only allows a-zA-Z0-9_
From the error + docs it looks like Pulumi doesn't seem to support this?
Copy code
Each API Gateway deployment is associated with a so-called stage. A stage is simply a version of your API, such as stage, prod, v1, or v2. For simple APIs, you will likely just have one. You can always define a custom stage name, but if you leave it off, a default of stage will be chosen.
e
@mysterious-belgium-44686 I think you are setting the stage name as "stage name =" $ default "," that "$" is a wrong character
m
Yeah, I'm trying to set the stage name to
$default
- in the AWS API Gateway docs they indicate that
$default
is a special stage name that will let you route via
/
Oh darn, I forgot to link the docs.
b
@mysterious-belgium-44686 I'm not entirely sure because I'm on my phone not laptop, but I think the
$default
only applies to apiGateway v2, and you're using the v1 resource
m
Aha, that would explain it - thanks 👍
b
the v1 API docs don't reference
$stage
at all: https://docs.aws.amazon.com/apigateway/api-reference/resource/stage/
m
Very interesting, this gives me something to dig into then - thanks for the help.