Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
fix(ecs,cw): add reported issues (#676)
Nahuel Nucera45894fd27a2a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4e36feb7..c9665c0e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,15 @@ Versioning follows [Semantic Versioning](https://semver.org/).---+## [Unreleased]++### Fixed+- **CloudWatch Logs `GetLogEvents` / `FilterLogEvents` accept `logGroupIdentifier`** — both ops now resolve the target log group from the AWS-documented `logGroupIdentifier` parameter (either the bare group name or a full `arn:aws:logs:<region>:<account>:log-group:<name>[:*]` ARN), as well as the original `logGroupName`. Calls that pass an ARN — common from AWS SDK code that has the group ARN handy — no longer fail with `ResourceNotFoundException: The specified log group does not exist: None`. Reported by @msulima.+- **ElastiCache `DescribeCacheClusters` emits full `CacheNode` shape** — the per-node XML now includes `CacheNodeCreateTime` (ISO8601), `ParameterGroupStatus`, `CustomerAvailabilityZone` (derived from the cluster's preferred AZ), and `SourceCacheNodeId` (when non-empty) in addition to the previous `CacheNodeId` / `CacheNodeStatus` / `Endpoint`. `hashicorp/terraform-provider-aws` v6.45.0 deref's `CacheNodeCreateTime` without a nil check during read after `aws_elasticache_cluster` apply, causing `Unexpected nil pointer in: {CacheNodeCreateTime:<nil> …}` and preventing Terraform from confirming cluster availability. Reported by @trackme-ddisley.+- **API Gateway v1 `UpdateStage` boolean fields parsed from patch strings** — AWS sends `patchOperations[].value` as strings, but the v1 PATCH handler previously assigned them as-is via the generic patch path. SDK clients (e.g. Pulumi / AWS SDK Go v2) that read back `tracingEnabled` and `cacheClusterEnabled` then failed deserialization with `expected Boolean to be of type *bool, got string instead`. Those two root-stage fields are now coerced to `bool` (`"true"` → `True`) before being applied, with an exact path match so a stage variable named `tracingEnabled` is unaffected. Contributed by @duc12597.++---+## [1.3.44] — 2026-05-19### Addeddiff --git a/ministack/services/apigateway_v1.py b/ministack/services/apigateway_v1.pyindex 0983825e..13759ddb 100644--- a/ministack/services/apigateway_v1.py+++ b/ministack/services/apigateway_v1.py@@ -450,7 +450,7 @@ def _apply_stage_patch(stage, patch_ops):if not _try_apply_method_settings_patch(stage, op):if "value" in op:path = op.get("path", "")- if "tracingEnabled" in path or "cacheClusterEnabled" in path:+ if path in ("/tracingEnabled", "/cacheClusterEnabled"):# UpdateStage sends patch `value` as strings (e.g. `"true"` for `tracingEnabled`)op["value"] = str(op["value"]).lower() == "true"leftover.append(op)diff --git a/ministack/services/cloudwatch_logs.py b/ministack/services/cloudwatch_logs.pyindex 338407ec..33d1ac5d 100644--- a/ministack/services/cloudwatch_logs.py+++ b/ministack/services/cloudwatch_logs.py@@ -427,8 +427,27 @@ def _put_log_events(data):return json_response({"nextSequenceToken": token})+def _resolve_log_group_name(data):+ """Per AWS: GetLogEvents / FilterLogEvents accept either `logGroupName` or+ `logGroupIdentifier` (name or ARN), but not both. Returns the resolved name+ or None."""+ name = data.get("logGroupName")+ if name:+ return name+ ident = data.get("logGroupIdentifier")+ if not ident:+ return None+ if ident.startswith("arn:"):+ # arn:aws:logs:<region>:<account>:log-group:<name>[:*]+ parts = ident.split(":log-group:", 1)+ if len(parts) == 2:+ tail = parts[1]+ return tail[:-2] if tail.endswith(":*") else tail+ return ident++def _get_log_events(data):- group = data.get("logGroupName")+ group = _resolve_log_group_name(data)stream = data.get("logStreamName")limit = min(data.get("limit", 10000), 10000)start_from_head = data.get("startFromHead", False)@@ -519,7 +538,7 @@ def _compile_filter_pattern(raw: str):def _filter_log_events(data):- group = data.get("logGroupName")+ group = _resolve_log_group_name(data)raw_pattern = data.get("filterPattern", "")pattern_fn = _compile_filter_pattern(raw_pattern)limit = min(data.get("limit", 10000), 10000)diff --git a/ministack/services/elasticache.py b/ministack/services/elasticache.pyindex d9422c8a..e134b890 100644--- a/ministack/services/elasticache.py+++ b/ministack/services/elasticache.py@@ -1598,14 +1598,29 @@ def _cluster_xml_inner(c):ep = c.get("_endpoint", {})nodes_xml = ""# CacheNodeList.member.locationName = "CacheNode"+ az = c.get("PreferredAvailabilityZone", "")for node in c.get("CacheNodes", []):nep = node.get("Endpoint", {})+ # CacheNodeCreateTime is a TStamp (ISO8601); fall back to cluster create if absent.+ created = node.get("CacheNodeCreateTime") or c.get("CacheClusterCreateTime") or time.time()+ if isinstance(created, (int, float)):+ created_iso = time.strftime("%Y-%m-%dT%H:%M:%S.000Z", time.gmtime(created))+ else:+ created_iso = str(created)+ node_az = node.get("CustomerAvailabilityZone") or az+ pgs = node.get("ParameterGroupStatus", "in-sync")+ src = node.get("SourceCacheNodeId") or ""+ src_xml = f"<SourceCacheNodeId>{src}</SourceCacheNodeId>" if src else ""nodes_xml += (f"<CacheNode>"f"<CacheNodeId>{node['CacheNodeId']}</CacheNodeId>"f"<CacheNodeStatus>{node['CacheNodeStatus']}</CacheNodeStatus>"+ f"<CacheNodeCreateTime>{created_iso}</CacheNodeCreateTime>"f"<Endpoint><Address>{nep.get('Address', 'localhost')}</Address>"f"<Port>{nep.get('Port', 6379)}</Port></Endpoint>"+ f"<ParameterGroupStatus>{pgs}</ParameterGroupStatus>"+ f"<CustomerAvailabilityZone>{node_az}</CustomerAvailabilityZone>"+ f"{src_xml}"f"</CacheNode>")return (diff --git a/tests/test_cloudwatch_logs.py b/tests/test_cloudwatch_logs.pyindex 50814fe3..4bba5c6d 100644--- a/tests/test_cloudwatch_logs.py+++ b/tests/test_cloudwatch_logs.py@@ -28,6 +28,35 @@ def test_logs_filter(logs):resp = logs.filter_log_events(logGroupName="/test/ministack", filterPattern="MiniStack")assert len(resp["events"]) >= 1++def test_logs_get_log_events_by_identifier_arn(logs):+ logs.create_log_group(logGroupName="/cwl/ident-arn")+ logs.create_log_stream(logGroupName="/cwl/ident-arn", logStreamName="s1")+ logs.put_log_events(+ logGroupName="/cwl/ident-arn",+ logStreamName="s1",+ logEvents=[{"timestamp": int(time.time() * 1000), "message": "hi"}],+ )+ arn = "arn:aws:logs:us-east-1:000000000000:log-group:/cwl/ident-arn:*"+ resp = logs.get_log_events(logGroupIdentifier=arn, logStreamName="s1")+ assert len(resp["events"]) == 1+ # Bare name accepted as identifier too.+ resp2 = logs.get_log_events(logGroupIdentifier="/cwl/ident-arn", logStreamName="s1")+ assert len(resp2["events"]) == 1+++def test_logs_filter_log_events_by_identifier_arn(logs):+ logs.create_log_group(logGroupName="/cwl/ident-arn-flt")+ logs.create_log_stream(logGroupName="/cwl/ident-arn-flt", logStreamName="s1")+ logs.put_log_events(+ logGroupName="/cwl/ident-arn-flt",+ logStreamName="s1",+ logEvents=[{"timestamp": int(time.time() * 1000), "message": "ERROR boom"}],+ )+ arn = "arn:aws:logs:us-east-1:000000000000:log-group:/cwl/ident-arn-flt"+ resp = logs.filter_log_events(logGroupIdentifier=arn, filterPattern="ERROR")+ assert len(resp["events"]) >= 1+def test_logs_create_group_v2(logs):logs.create_log_group(logGroupName="/cwl/cg-v2")resp = logs.describe_log_groups(logGroupNamePrefix="/cwl/cg-v2")diff --git a/tests/test_elasticache.py b/tests/test_elasticache.pyindex 0b94886e..665bf44f 100644--- a/tests/test_elasticache.py+++ b/tests/test_elasticache.py@@ -25,6 +25,24 @@ def test_elasticache_create(ec):assert clusters[0]["CacheClusterId"] == "test-redis"assert clusters[0]["Engine"] == "redis"+def test_elasticache_cache_node_full_fields(ec):+ """terraform-provider-aws v6 derefs CacheNodeCreateTime / ParameterGroupStatus /+ CustomerAvailabilityZone without nil checks. Issue #675."""+ ec.create_cache_cluster(+ CacheClusterId="cn-fields",+ Engine="redis",+ CacheNodeType="cache.t3.micro",+ NumCacheNodes=1,+ )+ resp = ec.describe_cache_clusters(CacheClusterId="cn-fields", ShowCacheNodeInfo=True)+ node = resp["CacheClusters"][0]["CacheNodes"][0]+ assert "CacheNodeCreateTime" in node+ assert node["ParameterGroupStatus"] == "in-sync"+ assert node["CustomerAvailabilityZone"] # non-empty+ assert node["CacheNodeId"] == "0001"+ assert node["CacheNodeStatus"] == "available"++def test_elasticache_replication_group(ec):ec.create_replication_group(ReplicationGroupId="test-rg",