Skip to content

Conversation

@silv-io
Copy link
Member

@silv-io silv-io commented Oct 30, 2025

Motivation

This PR is part of the IaC usability initiative. In that initiative we want to make error messages for Cfn clearer. Adding which resources can't be added an why in the DescribeStack is a first step for this.

Changes

  • Add a visitor to the cloudformation engine which determines if a resource is available in the license catalog
  • Use that visitor when ignoring of unsupported resources is disabled to set the status to failed and adding the reason to the describe output
  • Add a test to test this behavior for every kind of error message that we've prepared

Tests

Added a location for catalog integration tests in tests/integration/test_catalog.py and also a parametrized test for all error cases in test_catalog_reports_unsupported_resources_in_stack_status

Related

FLC-62

@silv-io silv-io added notes: skip Pull request does not have to be mentioned in the release notes notes: needed Pull request should be mentioned in the release notes semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases docs: needed Pull request requires documentation updates and removed notes: skip Pull request does not have to be mentioned in the release notes labels Oct 30, 2025
@localstack-bot
Copy link
Contributor

Currently, only patch changes are allowed on main. Your PR labels (semver: minor, docs: needed, notes: needed) indicate that it cannot be merged into the main at this time.

@github-actions
Copy link

github-actions bot commented Oct 30, 2025

Test Results - Preflight, Unit

22 889 tests  ±0   21 075 ✅ ±0   6m 25s ⏱️ -7s
     1 suites ±0    1 814 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 1b70e37. ± Comparison against base commit 53d7108.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 30, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 5s ⏱️ +6s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 1b70e37. ± Comparison against base commit 53d7108.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 30, 2025

Test Results - Alternative Providers

587 tests   331 ✅  18m 49s ⏱️
  1 suites  256 💤
  1 files      0 ❌

Results for commit 1b70e37.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 30, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   2h 32m 55s ⏱️
5 501 tests 4 949 ✅ 552 💤 0 ❌
5 507 runs  4 949 ✅ 558 💤 0 ❌

Results for commit 1b70e37.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 30, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 55m 47s ⏱️ -46s
5 121 tests ±0  4 729 ✅ ±0  392 💤 ±0  0 ❌ ±0 
5 123 runs  ±0  4 729 ✅ ±0  394 💤 ±0  0 ❌ ±0 

Results for commit 1b70e37. ± Comparison against base commit 53d7108.

♻️ This comment has been updated with latest results.

@silv-io silv-io added this to the 4.12 milestone Nov 24, 2025
@silv-io silv-io force-pushed the flc-62-use-catalog-in-cfn-createstack-and-save-errors-for-describe branch from d56f88f to d0fd050 Compare November 26, 2025 15:01
@github-actions
Copy link

github-actions bot commented Nov 26, 2025

S3 Image Test Results (AMD64 / ARM64)

    2 files      2 suites   8m 24s ⏱️
  552 tests   500 ✅  52 💤 0 ❌
1 104 runs  1 000 ✅ 104 💤 0 ❌

Results for commit 1b70e37.

♻️ This comment has been updated with latest results.

@silv-io silv-io marked this pull request as ready for review November 28, 2025 12:32
@silv-io silv-io requested a review from k-a-il November 28, 2025 12:32
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blocking issue is moving the resource support checking to after the transformation

CFN_IGNORE_UNSUPPORTED_RESOURCE_TYPES = is_env_not_false("CFN_IGNORE_UNSUPPORTED_RESOURCE_TYPES")

# Comma-separated list of resource type names that CLoudFormation will ignore on stack create/update
CFN_IGNORE_UNSUPPORTED_TYPE_CREATE: list[str] = parse_comma_separated_list(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: do we need to include DELETE operations as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not part of the spec so that's why I didn't add that. Is there a case where we'd need to specifically ignore deletion of a resource that we didn't handle in the create/update?

Also, I think I'll delete the addition of these env vars here because they'd be part of a next iteration PR. So we can discuss that in that follow-up

Comment on lines 149 to 152
try:
aws_client.cloudformation.delete_stack(StackName=stack_id)
except Exception:
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion(minor): we should probably use cleanups here but of course we know the stack deployment should fail so it's not a huge concern.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had that in there while working on it in case something went wrong. I can switch it over to using cleanups instead

)
validator.validate()

if not config.CFN_IGNORE_UNSUPPORTED_RESOURCE_TYPES:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: we should apply this step after transformation, because the transformation process may add resources to the template.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our initial discussion I think it was mentioned to be "after the validations" and I wasn't sure if the transformations are part of that or not. Thank you for spotting that :)

Comment on lines 82 to 99
support_status = self._resource_support_status(resource_type)
if support_status == CloudFormationResourcesSupportAtRuntime.AVAILABLE:
pass
else:
failure_message = self._build_resource_failure_message(
resource_type, support_status
)
self._resource_failure_messages[resource_type] = failure_message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion(style): maybe a match statement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially thought I'll use it in multiple locations, that's why I had the dict. match statement makes more sense now though, I agree :)

self, resource_type: str
) -> AwsServicesSupportStatus | CfnResourceSupportStatus:
service_name = _get_service_name(resource_type)
return self.catalog.get_cloudformation_resource_status(resource_type, service_name, True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: how do we deal with CFn custom resources? I see this was part of #13027 so I don't have the context here. Do we only look at resources with the AWS:: prefix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just skimmed through the code and I don't think we do. I can add in a cross check with what we've added in #13027 here to make it safe 👍🏼

@silv-io silv-io force-pushed the flc-62-use-catalog-in-cfn-createstack-and-save-errors-for-describe branch from cc62478 to 06cb0e8 Compare December 4, 2025 12:56
@silv-io silv-io force-pushed the flc-62-use-catalog-in-cfn-createstack-and-save-errors-for-describe branch from 63314cb to ca9cf02 Compare December 4, 2025 15:35
@silv-io silv-io requested a review from simonrw December 4, 2025 15:57
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my feedback. Looks great 👍

@silv-io silv-io merged commit 0a759a9 into main Dec 5, 2025
50 checks passed
@silv-io silv-io deleted the flc-62-use-catalog-in-cfn-createstack-and-save-errors-for-describe branch December 5, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates notes: needed Pull request should be mentioned in the release notes semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants