Open lskrajny opened 5 years ago
@lskrajny it looks like we haven't configured the output AWS::ApiGateway::RestApi
resource to have those tags. This would be a very simple change to make.
Changes to support this: Add the tags field here: https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/model/apigateway.py#L23
Add it to the RestApi resource: https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/model/api/api_generator.py#L87
(Example of adding them to the stage: https://github.com/awslabs/serverless-application-model/blob/develop/samtranslator/model/api/api_generator.py#L212-L213)
Update tests.
Sent a PR, let me know if all good
@lskrajny there is a merge conflict in the PR. Could you please resolve it and update the PR?
I reviewed your PR and tried deploying a template with the changes (details in #1244), and found that Tags
were not added to the ApiGateway RestApi resource (but were successfully added to the ApiGateway Stage resource, like is currently implemented in SAM).
I discussed adding tags to both the V1 RestApi and V2 Api resource with ApiGateway and asked why it didn't work. Here are the main takeaways:
tags
in the OpenApi spec. ApiGateway may add support for adding tags in the OpenApi document. If this happens, we can likely support tags on both V1/V2 resources. This is pending a deeper dive from their team to see if this is possible.I'll keep this thread updated as we chase this down. In the meantime, it looks like it isn't yet possible in SAM to support adding tags to the AWS::ApiGateway::RestApi resource.
@keetonian, you're right that for V1, tags aren't added to the resource upon initial deployment. However, if you change the value of the tag and update the stack, the tag is added to the resource. Obviously, this is still a bug, and I reported this behavior to AWS.
But does this mean that adding tags to the RestApi/Api resource when using OpenApi/Swagger to define an API is supported for V1? Is there simply a bug where CloudFormation fails to deploy the initial tag?
@Slooz Support for V2 to add tags in openapi is coming soon in SAM.
I see that both V1 and V2 APIs have ability to add tags to the Api and RestApi. Is there any possibility that SAM will also have functionality to add tags toe Api (not the Stage)?
Also can't tag Api in SAM 1.0.0. only stage tagged.
This is a showstopper for us. Any ETA?
Also wondering if we can get an update as to when this will be fixed.
Hi! Still seems to be an issue today, any ETA on a fix / workaround?
This issue still persists as of SAM CLI version 1.36.0.
However, auto generated tags from AWS SAM are actually DO properly work. This is important, because these tags cover the majority of uses cases including bill cost tags & least priveleges IAM policies.
For the auto generated tags to work, tags/* resources must be authorised.
Any progress on this? I'm still seeing this as an issue. I'm using SAM CLI v1.72.0
Description:
Steps to reproduce the issue:
Prepare a SAM template with tags configured for API, eg:
Observed result: No tags Expected result: 2 custom tags should be visible