CloudFormation: Support deletion of AWS::LOGS::LogGroup (#7443)

This commit is contained in:
Bert Blommers 2024-03-08 20:50:14 +00:00 committed by GitHub
parent b2ff3d98f6
commit b13e493823
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -420,11 +420,13 @@ class LogGroup(CloudFormationModel):
resource_name, tags, **properties
)
def delete(self, account_id: str, region_name: str) -> None:
backend = logs_backends[account_id][region_name]
backend.delete_log_group(self.name)
@classmethod
def has_cfn_attr(cls, attr: str) -> bool:
return attr in [
"Arn",
]
return attr in ["Arn"]
def get_cfn_attribute(self, attribute_name: str) -> str:
from moto.cloudformation.exceptions import UnformattedGetAttTemplateException

View File

@ -28,3 +28,6 @@ def test_tagging():
arn = logs_client.describe_log_groups()["logGroups"][0]["arn"]
tags = logs_client.list_tags_for_resource(resourceArn=arn)["tags"]
assert tags == {"foo": "bar"}
cf_client.delete_stack(StackName="test_stack")
assert logs_client.describe_log_groups()["logGroups"] == []