Skip to content

Commit 8842ef3

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix/issue/1547
2 parents 8ecdf35 + 3c75842 commit 8842ef3

File tree

329 files changed

+20884
-65268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

329 files changed

+20884
-65268
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
### v1.9.5
2+
## What's Changed
3+
* Increase the max value of `AWS::Cognito::UserPoolClient#RefreshTokenValidity` to `315360000` by @BR0kEN- in https://github.com/aws-cloudformation/cfn-lint/pull/3567
4+
* Update CloudFormation schemas to 2024-08-05 by @github-actions in https://github.com/aws-cloudformation/cfn-lint/pull/3539
5+
6+
## New Contributors
7+
* @BR0kEN- made their first contribution in https://github.com/aws-cloudformation/cfn-lint/pull/3567
8+
9+
**Full Changelog**: https://github.com/aws-cloudformation/cfn-lint/compare/v1.9.4...v1.9.5
10+
11+
### v1.9.4
12+
## What's Changed
13+
* Add logic to handle Ref `AWS::NoValue` in list by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3563
14+
15+
**Full Changelog**: https://github.com/aws-cloudformation/cfn-lint/compare/v1.9.3...v1.9.4
16+
117
### v1.9.3
218
## What's Changed
319
* Update schema filtering to use new condition logic by @kddejong in https://github.com/aws-cloudformation/cfn-lint/pull/3552

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ If you'd like cfn-lint to be run automatically when making changes to files in y
342342
```yaml
343343
repos:
344344
- repo: https://github.com/aws-cloudformation/cfn-lint
345-
rev: v1.9.3 # The version of cfn-lint to use
345+
rev: v1.9.5 # The version of cfn-lint to use
346346
hooks:
347347
- id: cfn-lint
348348
files: path/to/cfn/dir/.*\.(json|yml|yaml)$
@@ -353,7 +353,7 @@ If you are using a `.cfnlintrc` and specifying the `templates` or `ignore_templa
353353
```yaml
354354
repos:
355355
- repo: https://github.com/aws-cloudformation/cfn-lint
356-
rev: v1.9.3 # The version of cfn-lint to use
356+
rev: v1.9.5 # The version of cfn-lint to use
357357
hooks:
358358
- id: cfn-lint-rc
359359
```

docs/rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ The following **225** rules are applied by this linter:
155155
| [E3512<a name="E3512"></a>](../src/cfnlint/rules/resources/iam/ResourcePolicy.py) | Validate resource based IAM polices | IAM resources polices are embedded JSON in CloudFormation. This rule validates those embedded policies. | | [Source](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html) | `resources`,`iam` |
156156
| [E3513<a name="E3513"></a>](../src/cfnlint/rules/resources/iam/ResourceEcrPolicy.py) | Validate ECR repository policy | Private ECR repositories have a policy. This rule validates those policies. | | [Source](https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-policies.html) | `resources`,`iam`,`ecr` |
157157
| [E3601<a name="E3601"></a>](../src/cfnlint/rules/resources/stepfunctions/StateMachineDefinition.py) | Validate the structure of a StateMachine definition | Validate the Definition or DefinitionString inside a AWS::StepFunctions::StateMachine resource | | [Source](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-state-machine-structure.html) | `resources`,`statemachine` |
158-
| [E3615<a name="E3615"></a>](../src/cfnlint/rules/resources/cloudwatch/AlarmAwsNamespacePeriod.py) | Validate CloudWatch Alarm using AWS metrics has a correct period | Period < 60 not supported for namespaces with the following prefix: AWS/ | | [Source]() | `resources` |
158+
| [E3615<a name="E3615"></a>](../src/cfnlint/rules/resources/cloudwatch/AlarmPeriod.py) | Validate the period is a valid value | Valid values are 10, 30, 60, and any multiple of 60. | | [Source]() | `resources`,`cloudwatch` |
159159
| [E3617<a name="E3617"></a>](../src/cfnlint/rules/resources/managedblockchain/NodeNodeConfigurationInstanceTypeEnum.py) | Validate ManagedBlockchain instance type | Validates the ManagedBlockchain instance types based on region and data gathered from the pricing APIs | | [Source]() | `resources` |
160160
| [E3620<a name="E3620"></a>](../src/cfnlint/rules/resources/docdb/DBInstanceClassEnum.py) | Validate a DocDB DB Instance class | Validates the DocDB instance types based on region and data gathered from the pricing APIs | | [Source]() | `resources` |
161161
| [E3621<a name="E3621"></a>](../src/cfnlint/rules/resources/appstream/FleetInstanceTypeEnum.py) | Validate the instance types for AppStream Fleet | Validates the AppStream Fleet instance types based on region and data gathered from the pricing APIs | | [Source]() | `resources` |

scripts/update_schemas_manually.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@
7777
values={"requiredXor": ["LaunchTemplateId", "LaunchTemplateName"]},
7878
path="/definitions/LaunchTemplateSpecification",
7979
),
80-
Patch(
81-
values={"pattern": "^ephemeral([0-9]|[1][0-9]|[2][0-3])$"},
82-
path="/definitions/BlockDeviceMapping/properties/VirtualName",
83-
),
8480
Patch(
8581
values={
8682
"dependentExcluded": {
@@ -606,18 +602,6 @@
606602
),
607603
],
608604
),
609-
ResourcePatch(
610-
resource_type="AWS::Cognito::UserPoolClient",
611-
patches=[
612-
Patch(
613-
values={
614-
"maximum": 3650,
615-
"minimum": 0,
616-
},
617-
path="/properties/RefreshTokenValidity",
618-
),
619-
],
620-
),
621605
ResourcePatch(
622606
resource_type="AWS::Config::ConfigRule",
623607
patches=[

scripts/update_snapshot_results.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# integration/
44
cfn-lint test/fixtures/templates/integration/dynamic-references.yaml -e -c I --format json > test/fixtures/results/integration/dynamic-references.json
55
cfn-lint test/fixtures/templates/integration/resources-cloudformation-init.yaml -e -c I --format json > test/fixtures/results/integration/resources-cloudformation-init.json
6+
cfn-lint test/fixtures/templates/integration/ref-no-value.yaml -e -c I --format json > test/fixtures/results/integration/ref-no-value.json
67

78
# public/
89
cfn-lint test/fixtures/templates/public/lambda-poller.yaml -e -c I --format json > test/fixtures/results/public/lambda-poller.json

src/cfnlint/context/conditions/_conditions.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from cfnlint.context.conditions.exceptions import Unsatisfiable
2323

2424
if TYPE_CHECKING:
25-
from cfnlint.context.context import Parameter
25+
from cfnlint.context.context import Context, Parameter
2626

2727

2828
@dataclass(frozen=True)
@@ -127,13 +127,18 @@ def _build_conditions(self, conditions: set[str]) -> Iterator["Conditions"]:
127127
if scenarios_attempted >= self._max_scenarios:
128128
return
129129

130-
def evolve_from_instance(self, instance: Any) -> Iterator[tuple[Any, "Conditions"]]:
130+
def evolve_from_instance(
131+
self, instance: Any, context: "Context"
132+
) -> Iterator[tuple[Any, "Conditions"]]:
131133

132134
conditions = get_conditions_from_property(instance)
133135

134136
for scenario in self._build_conditions(conditions):
135137
yield build_instance_from_scenario(
136-
instance, scenario.status, is_root=True
138+
instance,
139+
scenario.status,
140+
is_root=True,
141+
context=context,
137142
), scenario
138143

139144
@property

src/cfnlint/context/conditions/_utils.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55

66
from __future__ import annotations
77

8-
from typing import Any
8+
from typing import TYPE_CHECKING, Any
99

1010
from cfnlint.decode.node import Mark, dict_node, list_node
1111
from cfnlint.helpers import is_function
1212

13+
if TYPE_CHECKING:
14+
from cfnlint.context.context import Context
15+
1316

1417
def get_conditions_from_property(instance: Any, is_root: bool = True) -> set[str]:
1518
"""
@@ -50,7 +53,10 @@ def get_conditions_from_property(instance: Any, is_root: bool = True) -> set[str
5053

5154

5255
def build_instance_from_scenario(
53-
instance: Any, scenario: dict[str, bool], is_root: bool = True
56+
instance: Any,
57+
scenario: dict[str, bool],
58+
is_root: bool,
59+
context: "Context",
5460
) -> Any:
5561
"""
5662
Get object values from a provided scenario.
@@ -76,35 +82,48 @@ def build_instance_from_scenario(
7682
getattr(instance, "end_mark", Mark(0, 0)),
7783
)
7884
for v in instance:
79-
new_value = build_instance_from_scenario(v, scenario, is_root=False)
85+
new_value = build_instance_from_scenario(
86+
v,
87+
scenario,
88+
is_root=False,
89+
context=context,
90+
)
8091
if new_value is not None:
8192
new_list.append(new_value)
8293
return new_list
8394

8495
if isinstance(instance, dict):
8596
fn_k, fn_v = is_function(instance)
86-
if fn_k == "Fn::If":
97+
if fn_k == "Fn::If" and "Fn::If" in context.functions:
8798
if isinstance(fn_v, list) and len(fn_v) == 3:
8899
if isinstance(fn_v[0], str):
89100
if_path = scenario.get(fn_v[0], None)
90101
if if_path is not None:
91102
new_value = build_instance_from_scenario(
92-
fn_v[1] if if_path else fn_v[2], scenario, is_root
103+
fn_v[1] if if_path else fn_v[2],
104+
scenario,
105+
is_root,
106+
context=context,
93107
)
94108
if new_value is not None:
95109
return new_value
96110
return None
97111
return instance
98-
if fn_k == "Ref" and fn_v == "AWS::NoValue":
99-
return {} if is_root else None
112+
if fn_k == "Ref" and fn_v == "AWS::NoValue" and "Ref" in context.functions:
113+
return None
100114
if is_root:
101115
new_obj: dict[str, Any] = dict_node(
102116
{},
103117
getattr(instance, "start_mark", Mark(0, 0)),
104118
getattr(instance, "end_mark", Mark(0, 0)),
105119
)
106120
for k, v in instance.items():
107-
new_value = build_instance_from_scenario(v, scenario, is_root=False)
121+
new_value = build_instance_from_scenario(
122+
v,
123+
scenario,
124+
is_root=False,
125+
context=context,
126+
)
108127
if new_value is not None:
109128
new_obj[k] = new_value
110129
return new_obj

0 commit comments

Comments
 (0)