bored-knife-37934
07/09/2025, 1:57 PMself._deployment = aws.apigateway.Deployment(f"{logic_name}-deployment",
rest_api=self._args.api.id,
triggers= self.compute_deploy_triggers(),
opts=ResourceOptions(
parent=self,
)
)
self._stage = aws.apigateway.Stage(f"{logic_name}-stage",
rest_api=self._args.api.id,
stage_name=self._args.stage_name,
# deployment=self._deployment.id,
opts=ResourceOptions(
parent=self
)
)
This is inside a ComponentResource, so the RestAPI and stage name are saved as _args.
The issue is that with this configuration, whenever the deployment gets replaced i have this error:
sdk-v2/provider2.go572 sdk.helper_schema: deleting API Gateway Deployment (xxxxx): operation error API Gateway: DeleteDeployment, https response error StatusCode: 400, RequestID: xxxx, BadRequestException: Active stages pointing to this deployment must be moved or deleted: provider=aws@6.83.0I have tried to work with some pulumi Resource Options, by changing the stage as follows:
self._stage = aws.apigateway.Stage(f"{logic_name}-stage",
rest_api=self._args.api.id,
stage_name=self._args.stage_name,
deployment=self._deployment.id,
opts=ResourceOptions(
parent=self,
depends_on=[self._deployment],
delete_before_replace=True,
replace_on_changes=["deployment"],
)
)
Doing this solves this error, as both resources are deleted before being re-created. In doing so, I break another piece of code though, because there is a usage-plan that uses the stage and when I replace it the usage plan doesn't react and updates it, therefore the only way is to also update the usage plan like this:
self.usage_plan = aws.apigateway.UsagePlan("usage-plan",
api_stages=[
aws.apigateway.UsagePlanApiStageArgs(
api_id=api.id,
stage=self._stage.stage_name
)
],
#
opts=ResourceOptions(
parent=self,
replace_on_changes=["api_stages"]
)
)
All this seems kinda clunky for what I honestly thought was a trivial thing to implement. I am used to work in Terraform where it is way easier to create the same stuff.
Am I missing something obvious maybe? Do you guys have implemented the same architecture in a easier way?
Thank you in advance 🙂little-cartoon-10569
07/09/2025, 8:32 PMstage_name
property is an output of the Stage resource. Unless you've got some code to change that? Is _stage
the actual Stage resource, and stage_name
is an Output?bored-knife-37934
07/10/2025, 8:13 AMstage=component.get_stage().stage_name
Inside the usage_plan.
Could it be something wrong with that?little-cartoon-10569
07/10/2025, 8:18 AMbored-knife-37934
07/10/2025, 8:22 AMlittle-cartoon-10569
07/10/2025, 9:31 AMNo matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by