From 523eba559ee3ef64287e3e78e846919c01468e78 Mon Sep 17 00:00:00 2001 From: Oleksandr Nikolaichuk <57410473+Sekator778@users.noreply.github.com> Date: Wed, 18 Nov 2026 01:53:23 +0300 Subject: [PATCH] fix(cloudformation): create an EKS cluster with its encryption and network settings, a replacement included (#8739) --- docs/services/cloudformation.md | 2 +- .../provisioners/CfnPropertyTypes.java | 11 + .../provisioners/DsqlCfnProvisioner.java | 15 +- .../provisioners/EksCfnProvisioner.java | 26 ++ .../provisioners/LambdaCfnProvisioner.java | 26 +- .../io/floci/aws/services/eks/EksService.java | 19 +- .../resources/aws/cfn-property-types.json | 410 +++++++++++++++++- .../CloudFormationEksIntegrationTest.java | 60 +++ .../aws/services/eks/EksServiceTest.java | 13 + .../cloudformation/schema-surface.tsv | 2 +- .../cloudformation/writable-property-gaps.tsv | 3 +- tools/aws/regen_cfn_property_types.py | 2 +- tools/docs/cfn_resource_types.yaml | 2 +- 13 files changed, 536 insertions(+), 55 deletions(-) diff --git a/docs/services/cloudformation.md b/docs/services/cloudformation.md index cb415d4b61..6259ed729c 100644 --- a/docs/services/cloudformation.md +++ b/docs/services/cloudformation.md @@ -219,7 +219,7 @@ cross-resource references. | ECR | `Repository` | | ECS | `Cluster`, `TaskDefinition`, `Service`, `CapacityProvider`, `ClusterCapacityProviderAssociations` | | EFS | `FileSystem` (metadata only, there is no NFS data plane), `MountTarget` (`SecurityGroups` update in place, every other property replaces), `AccessPoint` (`AccessPointTags` update in place, every other property replaces) | -| EKS | `Cluster` (created with `Name`, `Version`, `RoleArn` and `Tags`, a replacement included; `EncryptionConfig` and `KubernetesNetworkConfig` are accepted and ignored on create; updated in place for `Tags`, keeping tags added outside the stack; a change to `Name`, `RoleArn`, `EncryptionConfig`, `BootstrapSelfManagedAddons`, `OutpostConfig`, `AccessConfig.BootstrapClusterCreatorAdminPermissions`, `KubernetesNetworkConfig.IpFamily` or `KubernetesNetworkConfig.ServiceIpv4Cidr` replaces the cluster, as the registry marks them create-only, and deletes the old one once the update commits; a change to `Version` is accepted with a warning and not applied, as the emulator cannot upgrade a cluster in place), `Nodegroup` (created with `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets` and `Tags`; updated in place for `Tags`, keeping tags added outside the stack; a change to `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets`, `AmiType`, `CapacityType`, `DiskSize`, `InstanceTypes` or `RemoteAccess` replaces the nodegroup, as the registry marks them create-only, and deletes the old one once the update commits; `ScalingConfig`, `Labels`, `Taints`, `UpdateConfig`, `Version`, `ReleaseVersion`, `ForceUpdateEnabled`, `LaunchTemplate`, `NodeRepairConfig` and `WarmPoolConfig` are accepted and not applied, whether changed or dropped, with a warning, as the emulator cannot update a nodegroup in place) | +| EKS | `Cluster` (created with `Name`, `Version`, `RoleArn`, `Tags`, `EncryptionConfig` and `KubernetesNetworkConfig.IpFamily` and `ServiceIpv4Cidr`, a replacement included; a change to `EncryptionConfig`, `IpFamily` or `ServiceIpv4Cidr` replaces the cluster with the new value applied; `ElasticLoadBalancing` and `ServiceIpv6Cidr` are accepted and ignored; updated in place for `Tags`, keeping tags added outside the stack; a change to `Name`, `RoleArn`, `EncryptionConfig`, `BootstrapSelfManagedAddons`, `OutpostConfig`, `AccessConfig.BootstrapClusterCreatorAdminPermissions`, `KubernetesNetworkConfig.IpFamily` or `KubernetesNetworkConfig.ServiceIpv4Cidr` replaces the cluster, as the registry marks them create-only, and deletes the old one once the update commits; a change to `Version` is accepted with a warning and not applied, as the emulator cannot upgrade a cluster in place), `Nodegroup` (created with `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets` and `Tags`; updated in place for `Tags`, keeping tags added outside the stack; a change to `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets`, `AmiType`, `CapacityType`, `DiskSize`, `InstanceTypes` or `RemoteAccess` replaces the nodegroup, as the registry marks them create-only, and deletes the old one once the update commits; `ScalingConfig`, `Labels`, `Taints`, `UpdateConfig`, `Version`, `ReleaseVersion`, `ForceUpdateEnabled`, `LaunchTemplate`, `NodeRepairConfig` and `WarmPoolConfig` are accepted and not applied, whether changed or dropped, with a warning, as the emulator cannot update a nodegroup in place) | | RDS | `DBInstance` (starts a real container), `DBCluster` (starts a real container), `DBSubnetGroup`, `DBParameterGroup`, `DBClusterParameterGroup`, `DBProxy`, `DBProxyTargetGroup` | | Aurora DSQL | `Cluster` | | ElastiCache | `CacheCluster` (starts a real container; modifying an existing cluster in place is not supported), `ReplicationGroup` (starts a real container; modifying an existing group in place is not supported), `SubnetGroup`, `User` (Tags are ignored), `UserGroup` (Tags are ignored), `ServerlessCache` (GetAtt uses the dotted Endpoint.* and ReaderEndpoint.* form) | diff --git a/src/main/java/io/floci/aws/services/cloudformation/provisioners/CfnPropertyTypes.java b/src/main/java/io/floci/aws/services/cloudformation/provisioners/CfnPropertyTypes.java index e82f104177..e63cc5ab79 100644 --- a/src/main/java/io/floci/aws/services/cloudformation/provisioners/CfnPropertyTypes.java +++ b/src/main/java/io/floci/aws/services/cloudformation/provisioners/CfnPropertyTypes.java @@ -349,6 +349,17 @@ final class CfnPropertyTypes { return read(path, path.substring(path.lastIndexOf('/') + 1), engine.omitNoValue(raw), shapeName); } + /** + * The property {@code property} of {@code resourceType} in {@code props} read as the shape its + * resource schema declares; null when {@code props} lacks it or it is {@code AWS::NoValue}. + */ + JsonNode readProperty(String resourceType, JsonNode props, String property) { + if (props == null || !props.has(property)) { + return null; + } + return read(property, props.get(property), propertyShape(resourceType, property)); + } + /** Throws the first model validation failure found by {@link #read}, if any. */ void finish() { if (modelFailure != null) { diff --git a/src/main/java/io/floci/aws/services/cloudformation/provisioners/DsqlCfnProvisioner.java b/src/main/java/io/floci/aws/services/cloudformation/provisioners/DsqlCfnProvisioner.java index 855d9eece3..f13e3ca3fe 100644 --- a/src/main/java/io/floci/aws/services/cloudformation/provisioners/DsqlCfnProvisioner.java +++ b/src/main/java/io/floci/aws/services/cloudformation/provisioners/DsqlCfnProvisioner.java @@ -53,11 +53,11 @@ public class DsqlCfnProvisioner implements CfnResourceProvisioner { public void provision(StackResource resource, JsonNode props, ProvisionContext ctx) { String region = ctx.region(); CfnPropertyTypes.Reader types = new CfnPropertyTypes.Reader(ctx.engine()); - JsonNode protection = read(types, props, "DeletionProtectionEnabled"); - JsonNode kmsKey = read(types, props, "KmsEncryptionKey"); - JsonNode multiRegion = read(types, props, "MultiRegionProperties"); - JsonNode tagList = read(types, props, "Tags"); - JsonNode policyDocument = read(types, props, "PolicyDocument"); + JsonNode protection = types.readProperty(TYPE, props, "DeletionProtectionEnabled"); + JsonNode kmsKey = types.readProperty(TYPE, props, "KmsEncryptionKey"); + JsonNode multiRegion = types.readProperty(TYPE, props, "MultiRegionProperties"); + JsonNode tagList = types.readProperty(TYPE, props, "Tags"); + JsonNode policyDocument = types.readProperty(TYPE, props, "PolicyDocument"); types.finish(); Boolean deletionProtection = protection == null ? null : protection.booleanValue(); String kms = kmsKey == null ? null : kmsKey.asText(); @@ -104,11 +104,6 @@ public class DsqlCfnProvisioner implements CfnResourceProvisioner { () -> dsqlService.deleteCluster(region, physicalId), "ResourceNotFoundException"); } - private static JsonNode read(CfnPropertyTypes.Reader types, JsonNode props, String property) { - return props == null ? null - : types.read(property, props.get(property), CfnPropertyTypes.propertyShape(TYPE, property)); - } - private DsqlCluster awaitSettled(String region, String identifier) { Instant deadline = Instant.now().plus(READY_TIMEOUT); while (true) { diff --git a/src/main/java/io/floci/aws/services/cloudformation/provisioners/EksCfnProvisioner.java b/src/main/java/io/floci/aws/services/cloudformation/provisioners/EksCfnProvisioner.java index e17b8f8b8d..197fa99836 100644 --- a/src/main/java/io/floci/aws/services/cloudformation/provisioners/EksCfnProvisioner.java +++ b/src/main/java/io/floci/aws/services/cloudformation/provisioners/EksCfnProvisioner.java @@ -1,5 +1,6 @@ package io.floci.aws.services.cloudformation.provisioners; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; @@ -110,6 +111,9 @@ public class EksCfnProvisioner implements CfnResourceProvisioner { // Unstripped: createCluster reads the reserved cluster-args tag, then drops it. Map templateTags = ctx.resolveTags(props, "Tags"); request.setTags(templateTags); + request.setEncryptionConfig(createSetting(props, "EncryptionConfig", ctx, new TypeReference<>() { })); + request.setKubernetesNetworkConfig( + createSetting(props, "KubernetesNetworkConfig", ctx, new TypeReference<>() { })); Cluster created = eksService.createCluster(request); // The cluster this resource named before is gone or replaced; publish writes only what the // new one has, so its endpoint and certificate must not outlive it. @@ -127,6 +131,28 @@ public class EksCfnProvisioner implements CfnResourceProvisioner { } } + /** + * A create-only property in its API request shape, or null when the template leaves it out. The + * template value is read against the type the resource schema declares, so a value of another type + * fails the resource with CloudFormation's wording. The request model has no ElasticLoadBalancing + * or ServiceIpv6Cidr member, so those members of KubernetesNetworkConfig are not read. + */ + private static T createSetting(JsonNode props, String name, ProvisionContext ctx, TypeReference type) { + CfnPropertyTypes.Reader types = new CfnPropertyTypes.Reader(ctx.engine()); + JsonNode resolved = types.readProperty(CLUSTER, props, name); + types.finish(); + if (resolved == null) { + return null; + } + try { + return MAPPER.convertValue(CfnApiShapeConverter.convert(resolved, CfnApiShapeConverter.OMIT_NULL_PROPERTIES), + type); + } catch (IllegalArgumentException e) { + throw new AwsException("ValidationError", "AWS::EKS::Cluster " + name + " is not valid: " + + e.getMessage(), 400); + } + } + private void publish(StackResource r, Cluster cluster) { r.setPhysicalId(cluster.getName()); r.getAttributes().put("Arn", cluster.getArn()); diff --git a/src/main/java/io/floci/aws/services/cloudformation/provisioners/LambdaCfnProvisioner.java b/src/main/java/io/floci/aws/services/cloudformation/provisioners/LambdaCfnProvisioner.java index e8ef390726..ec56f71670 100644 --- a/src/main/java/io/floci/aws/services/cloudformation/provisioners/LambdaCfnProvisioner.java +++ b/src/main/java/io/floci/aws/services/cloudformation/provisioners/LambdaCfnProvisioner.java @@ -800,7 +800,7 @@ public class LambdaCfnProvisioner implements CfnResourceProvisioner { } private Map resolveLambdaEnvironment(CfnPropertyTypes.Reader types, JsonNode props) { - JsonNode envNode = readTyped(types, FUNCTION, props, "Environment"); + JsonNode envNode = types.readProperty(FUNCTION, props, "Environment"); JsonNode variables = envNode == null ? null : envNode.get("Variables"); if (variables == null) { return Map.of(); @@ -812,7 +812,7 @@ public class LambdaCfnProvisioner implements CfnResourceProvisioner { private static List resolveStringListOrEmpty(CfnPropertyTypes.Reader types, String resourceType, JsonNode props, String source) { - JsonNode values = readTyped(types, resourceType, props, source); + JsonNode values = types.readProperty(resourceType, props, source); return values == null ? List.of() : texts(values); } @@ -823,7 +823,7 @@ public class LambdaCfnProvisioner implements CfnResourceProvisioner { } private List resolveObjectListOrEmpty(CfnPropertyTypes.Reader types, JsonNode props, String source) { - JsonNode resolved = readTyped(types, FUNCTION, props, source); + JsonNode resolved = types.readProperty(FUNCTION, props, source); if (resolved == null) { return List.of(); } @@ -835,24 +835,10 @@ public class LambdaCfnProvisioner implements CfnResourceProvisioner { /** The object property {@code source}, or {@code defaultValue} when the template leaves it out. */ private Map resolveMapOrDefault(CfnPropertyTypes.Reader types, JsonNode props, String source, Map defaultValue) { - JsonNode resolved = readTyped(types, FUNCTION, props, source); + JsonNode resolved = types.readProperty(FUNCTION, props, source); return resolved == null ? defaultValue : jsonObjectToMap(resolved); } - /** - * The property {@code source} of {@code resourceType} read against the type its resource schema - * declares, or null when the template leaves it out, {@code Ref: AWS::NoValue} directly or - * through {@code Fn::If} included. A value of another type is refused before the function is - * touched; see {@link CfnPropertyTypes}. - */ - private static JsonNode readTyped(CfnPropertyTypes.Reader types, String resourceType, JsonNode props, - String source) { - if (props == null || !props.has(source)) { - return null; - } - return types.read(source, props.get(source), CfnPropertyTypes.propertyShape(resourceType, source)); - } - private static Map mapWithNullValue(String key) { Map map = new HashMap<>(); map.put(key, null); @@ -861,7 +847,7 @@ public class LambdaCfnProvisioner implements CfnResourceProvisioner { private void putStringListIfPresent(Map request, CfnPropertyTypes.Reader types, JsonNode props, String source) { - JsonNode values = readTyped(types, FUNCTION, props, source); + JsonNode values = types.readProperty(FUNCTION, props, source); if (values != null) { request.put(source, texts(values)); } @@ -869,7 +855,7 @@ public class LambdaCfnProvisioner implements CfnResourceProvisioner { private void putResolvedMapIfPresent(Map request, CfnPropertyTypes.Reader types, JsonNode props, String source) { - JsonNode resolved = readTyped(types, FUNCTION, props, source); + JsonNode resolved = types.readProperty(FUNCTION, props, source); if (resolved != null) { request.put(source, jsonObjectToMap(resolved)); } diff --git a/src/main/java/io/floci/aws/services/eks/EksService.java b/src/main/java/io/floci/aws/services/eks/EksService.java index 87da19ba3b..bf2c480b7c 100644 --- a/src/main/java/io/floci/aws/services/eks/EksService.java +++ b/src/main/java/io/floci/aws/services/eks/EksService.java @@ -815,6 +815,8 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun } cluster.setTags(request.getTags() != null ? ReservedTags.stripReservedTags(request.getTags()) : new HashMap<>()); + // Refused before the cluster security group exists, so a bad ipFamily leaves nothing behind. + resolveIpFamily(request.getKubernetesNetworkConfig()); ResourcesVpcConfig vpcConfig = buildVpcConfigResponse(request.getResourcesVpcConfig(), resolvedVpcId); SecurityGroup clusterSg = null; if (ec2Service != null && !vpcConfig.getVpcId().isBlank()) { @@ -1789,10 +1791,19 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun } } config.setServiceIpv4Cidr(resolvedCidr); - config.setIpFamily(request != null && request.getIpFamily() != null ? request.getIpFamily() : "ipv4"); + config.setIpFamily(resolveIpFamily(request)); return config; } + private static String resolveIpFamily(KubernetesNetworkConfig request) { + String ipFamily = request != null && request.getIpFamily() != null ? request.getIpFamily() : "ipv4"; + if (!"ipv4".equals(ipFamily) && !"ipv6".equals(ipFamily)) { + throw new AwsException("InvalidParameterException", + "Invalid ipFamily '" + ipFamily + "'. Valid values: ipv4 | ipv6", 400); + } + return ipFamily; + } + static Logging defaultLogging() { return new Logging(List.of(new LogSetup(new ArrayList<>(ALL_LOG_TYPES), false))); } @@ -1855,8 +1866,10 @@ public class EksService implements TagHandler, ResourceProvider, Ec2InstanceLaun "Only one encryption configuration is allowed", 400); } EncryptionConfig config = requestedConfigs.getFirst(); - if (config == null || config.getResources() == null || config.getResources().isEmpty() - || !List.of("secrets").equals(config.getResources())) { + // AWS: Resources is optional, "this field no longer affects which resources are encrypted", and + // "secrets" is the only supported value. + boolean resourcesOmitted = config != null && (config.getResources() == null || config.getResources().isEmpty()); + if (config == null || !(resourcesOmitted || List.of("secrets").equals(config.getResources()))) { throw new AwsException("InvalidParameterException", "Invalid k8s resource and provider for encryption", 400); } diff --git a/src/main/resources/aws/cfn-property-types.json b/src/main/resources/aws/cfn-property-types.json index 999caa0796..dd71bbb087 100644 --- a/src/main/resources/aws/cfn-property-types.json +++ b/src/main/resources/aws/cfn-property-types.json @@ -2,7 +2,7 @@ "_source": { "generator": "tools/aws/regen_cfn_property_types.py", "schemas": "https://schema.cloudformation.us-east-1.amazonaws.com/CloudformationSchema.zip", - "retrieved": "2026-11-16", + "retrieved": "2026-11-17", "note": "make cfn-property-types-verify checks the file against AWS." }, "operations": { @@ -11,6 +11,7 @@ "AWS::EC2::Instance": "AWS::EC2::Instance", "AWS::EC2::LaunchTemplate": "AWS::EC2::LaunchTemplate", "AWS::ECS::TaskDefinition": "AWS::ECS::TaskDefinition", + "AWS::EKS::Cluster": "AWS::EKS::Cluster", "AWS::Events::Rule": "AWS::Events::Rule", "AWS::Lambda::Function": "AWS::Lambda::Function", "AWS::Lambda::LayerVersion": "AWS::Lambda::LayerVersion", @@ -92,35 +93,40 @@ "AWS::DSQL::Cluster": { "type": "structure", "members": { - "Status": "String", - "PolicyVersion": "String", - "EncryptionDetails": "AWS::DSQL::Cluster.EncryptionDetails", - "KmsEncryptionKey": "String", - "MultiRegionProperties": "AWS::DSQL::Cluster.MultiRegionProperties", + "DeletionProtectionEnabled": "Boolean", + "Tags": "AWS::DSQL::Cluster.Tags", "ResourceArn": "String", "Identifier": "String", - "VpcEndpointServiceName": "String", - "VpcEndpoint": "String", - "Endpoint": "String", "CreationTime": "String", + "Status": "String", + "VpcEndpointServiceName": "String", + "MultiRegionProperties": "AWS::DSQL::Cluster.MultiRegionProperties", + "KmsEncryptionKey": "String", + "EncryptionDetails": "AWS::DSQL::Cluster.EncryptionDetails", + "Endpoint": "String", + "VpcEndpoint": "String", + "PolicyVersion": "String", "PolicyDocument": "String", - "DeletionProtectionEnabled": "Boolean", - "Tags": "AWS::DSQL::Cluster.Tags" + "MetricGroups": "AWS::DSQL::Cluster.MetricGroups" } }, "AWS::DSQL::Cluster.EncryptionDetails": { "type": "structure", "members": { - "EncryptionType": "String", "EncryptionStatus": "String", + "EncryptionType": "String", "KmsKeyArn": "String" } }, + "AWS::DSQL::Cluster.MetricGroups": { + "type": "list", + "member": "AWS::DSQL::Cluster/MetricGroup" + }, "AWS::DSQL::Cluster.MultiRegionProperties": { "type": "structure", "members": { - "Clusters": "AWS::DSQL::Cluster.MultiRegionProperties.Clusters", - "WitnessRegion": "String" + "WitnessRegion": "String", + "Clusters": "AWS::DSQL::Cluster.MultiRegionProperties.Clusters" } }, "AWS::DSQL::Cluster.MultiRegionProperties.Clusters": { @@ -131,11 +137,20 @@ "type": "list", "member": "AWS::DSQL::Cluster/Tag" }, + "AWS::DSQL::Cluster/MetricGroup": { + "type": "structure", + "members": { + "MetricGroup": "String" + }, + "required": [ + "MetricGroup" + ] + }, "AWS::DSQL::Cluster/Tag": { "type": "structure", "members": { - "Value": "String", - "Key": "String" + "Key": "String", + "Value": "String" }, "required": [ "Key", @@ -1532,6 +1547,369 @@ "SourceContainer": "String" } }, + "AWS::EKS::Cluster": { + "type": "structure", + "members": { + "EncryptionConfig": "AWS::EKS::Cluster.EncryptionConfig", + "KubernetesNetworkConfig": "AWS::EKS::Cluster/KubernetesNetworkConfig", + "Logging": "AWS::EKS::Cluster/Logging", + "Name": "String", + "Id": "String", + "ResourcesVpcConfig": "AWS::EKS::Cluster/ResourcesVpcConfig", + "OutpostConfig": "AWS::EKS::Cluster/OutpostConfig", + "AccessConfig": "AWS::EKS::Cluster/AccessConfig", + "UpgradePolicy": "AWS::EKS::Cluster/UpgradePolicy", + "RemoteNetworkConfig": "AWS::EKS::Cluster/RemoteNetworkConfig", + "ComputeConfig": "AWS::EKS::Cluster/ComputeConfig", + "StorageConfig": "AWS::EKS::Cluster/StorageConfig", + "RoleArn": "String", + "Version": "String", + "Force": "Boolean", + "RollbackConfig": "AWS::EKS::Cluster/RollbackConfig", + "Tags": "AWS::EKS::Cluster.Tags", + "Arn": "String", + "Endpoint": "String", + "CertificateAuthorityData": "String", + "ActiveCertificateAuthorityId": "String", + "CertificateAuthority": "AWS::EKS::Cluster/CertificateAuthority", + "ClusterSecurityGroupId": "String", + "EncryptionConfigKeyArn": "String", + "OpenIdConnectIssuerUrl": "String", + "BootstrapSelfManagedAddons": "Boolean", + "DeletionProtection": "Boolean", + "ZonalShiftConfig": "AWS::EKS::Cluster/ZonalShiftConfig", + "ControlPlaneScalingConfig": "AWS::EKS::Cluster/ControlPlaneScalingConfig", + "KubeApiServerConfig": "AWS::EKS::Cluster/KubeApiServerConfig", + "KubeSchedulerConfig": "AWS::EKS::Cluster/KubeSchedulerConfig", + "KubeControllerManagerConfig": "AWS::EKS::Cluster/KubeControllerManagerConfig" + }, + "required": [ + "RoleArn", + "ResourcesVpcConfig" + ] + }, + "AWS::EKS::Cluster.EncryptionConfig": { + "type": "list", + "member": "AWS::EKS::Cluster/EncryptionConfig" + }, + "AWS::EKS::Cluster.Tags": { + "type": "list", + "member": "AWS::EKS::Cluster/Tag" + }, + "AWS::EKS::Cluster/AccessConfig": { + "type": "structure", + "members": { + "BootstrapClusterCreatorAdminPermissions": "Boolean", + "AuthenticationMode": "String" + } + }, + "AWS::EKS::Cluster/ActiveCertificateAuthority": { + "type": "structure", + "members": { + "Id": "String", + "ActivatedBy": "String" + } + }, + "AWS::EKS::Cluster/BlockStorage": { + "type": "structure", + "members": { + "Enabled": "Boolean" + } + }, + "AWS::EKS::Cluster/CertificateAuthority": { + "type": "structure", + "members": { + "Data": "String", + "Active": "AWS::EKS::Cluster/ActiveCertificateAuthority" + } + }, + "AWS::EKS::Cluster/ClusterLogging": { + "type": "structure", + "members": { + "EnabledTypes": "AWS::EKS::Cluster/EnabledTypes" + } + }, + "AWS::EKS::Cluster/ComputeConfig": { + "type": "structure", + "members": { + "Enabled": "Boolean", + "NodeRoleArn": "String", + "NodePools": "AWS::EKS::Cluster/ComputeConfig.NodePools" + } + }, + "AWS::EKS::Cluster/ComputeConfig.NodePools": { + "type": "list", + "member": "String" + }, + "AWS::EKS::Cluster/ControlPlanePlacement": { + "type": "structure", + "members": { + "GroupName": "String", + "SpreadLevel": "String" + } + }, + "AWS::EKS::Cluster/ControlPlaneScalingConfig": { + "type": "structure", + "members": { + "Tier": "String" + } + }, + "AWS::EKS::Cluster/ElasticLoadBalancing": { + "type": "structure", + "members": { + "Enabled": "Boolean", + "GatewayApi": "AWS::EKS::Cluster/GatewayApi" + } + }, + "AWS::EKS::Cluster/EnabledTypes": { + "type": "list", + "member": "AWS::EKS::Cluster/LoggingTypeConfig" + }, + "AWS::EKS::Cluster/EncryptionConfig": { + "type": "structure", + "members": { + "Provider": "AWS::EKS::Cluster/Provider", + "Resources": "AWS::EKS::Cluster/EncryptionConfig.Resources" + } + }, + "AWS::EKS::Cluster/EncryptionConfig.Resources": { + "type": "list", + "member": "String" + }, + "AWS::EKS::Cluster/EtcdPlacement": { + "type": "structure", + "members": { + "SpreadLevel": "String" + } + }, + "AWS::EKS::Cluster/GatewayApi": { + "type": "structure", + "members": { + "Crds": "AWS::EKS::Cluster/GatewayApiCrds" + }, + "required": [ + "Crds" + ] + }, + "AWS::EKS::Cluster/GatewayApiCrds": { + "type": "structure", + "members": { + "Managed": "Boolean" + }, + "required": [ + "Managed" + ] + }, + "AWS::EKS::Cluster/HorizontalPodAutoscalerControllerConfig": { + "type": "structure", + "members": { + "HorizontalPodAutoscalerSyncPeriod": "String" + } + }, + "AWS::EKS::Cluster/KubeApiServerConfig": { + "type": "structure", + "members": { + "EventTtl": "String", + "ServiceNodePortRange": "AWS::EKS::Cluster/ServiceNodePortRange" + } + }, + "AWS::EKS::Cluster/KubeControllerManagerConfig": { + "type": "structure", + "members": { + "PodGcControllerConfig": "AWS::EKS::Cluster/PodGcControllerConfig", + "HorizontalPodAutoscalerControllerConfig": "AWS::EKS::Cluster/HorizontalPodAutoscalerControllerConfig" + } + }, + "AWS::EKS::Cluster/KubeSchedulerConfig": { + "type": "structure", + "members": { + "NodeResourcesFit": "AWS::EKS::Cluster/NodeResourcesFitConfig" + } + }, + "AWS::EKS::Cluster/KubernetesNetworkConfig": { + "type": "structure", + "members": { + "ServiceIpv4Cidr": "String", + "ServiceIpv6Cidr": "String", + "IpFamily": "String", + "ElasticLoadBalancing": "AWS::EKS::Cluster/ElasticLoadBalancing" + } + }, + "AWS::EKS::Cluster/Logging": { + "type": "structure", + "members": { + "ClusterLogging": "AWS::EKS::Cluster/ClusterLogging" + } + }, + "AWS::EKS::Cluster/LoggingTypeConfig": { + "type": "structure", + "members": { + "Type": "String" + } + }, + "AWS::EKS::Cluster/NodeResourcesFitConfig": { + "type": "structure", + "members": { + "ScoringStrategy": "AWS::EKS::Cluster/ScoringStrategy" + } + }, + "AWS::EKS::Cluster/OutpostConfig": { + "type": "structure", + "members": { + "OutpostArns": "AWS::EKS::Cluster/OutpostConfig.OutpostArns", + "ControlPlaneInstanceType": "String", + "ControlPlanePlacement": "AWS::EKS::Cluster/ControlPlanePlacement", + "EtcdInstanceType": "String", + "EtcdPlacement": "AWS::EKS::Cluster/EtcdPlacement" + }, + "required": [ + "OutpostArns", + "ControlPlaneInstanceType" + ] + }, + "AWS::EKS::Cluster/OutpostConfig.OutpostArns": { + "type": "list", + "member": "String" + }, + "AWS::EKS::Cluster/PodGcControllerConfig": { + "type": "structure", + "members": { + "TerminatedPodGcThreshold": "Integer" + } + }, + "AWS::EKS::Cluster/Provider": { + "type": "structure", + "members": { + "KeyArn": "String" + } + }, + "AWS::EKS::Cluster/RemoteNetworkConfig": { + "type": "structure", + "members": { + "RemoteNodeNetworks": "AWS::EKS::Cluster/RemoteNodeNetworks", + "RemotePodNetworks": "AWS::EKS::Cluster/RemotePodNetworks" + } + }, + "AWS::EKS::Cluster/RemoteNodeNetwork": { + "type": "structure", + "members": { + "Cidrs": "AWS::EKS::Cluster/RemoteNodeNetwork.Cidrs" + }, + "required": [ + "Cidrs" + ] + }, + "AWS::EKS::Cluster/RemoteNodeNetwork.Cidrs": { + "type": "list", + "member": "String" + }, + "AWS::EKS::Cluster/RemoteNodeNetworks": { + "type": "list", + "member": "AWS::EKS::Cluster/RemoteNodeNetwork" + }, + "AWS::EKS::Cluster/RemotePodNetwork": { + "type": "structure", + "members": { + "Cidrs": "AWS::EKS::Cluster/RemotePodNetwork.Cidrs" + }, + "required": [ + "Cidrs" + ] + }, + "AWS::EKS::Cluster/RemotePodNetwork.Cidrs": { + "type": "list", + "member": "String" + }, + "AWS::EKS::Cluster/RemotePodNetworks": { + "type": "list", + "member": "AWS::EKS::Cluster/RemotePodNetwork" + }, + "AWS::EKS::Cluster/ResourceWeight": { + "type": "structure", + "members": { + "Name": "String", + "Weight": "Integer" + } + }, + "AWS::EKS::Cluster/ResourcesVpcConfig": { + "type": "structure", + "members": { + "EndpointPrivateAccess": "Boolean", + "EndpointPublicAccess": "Boolean", + "PublicAccessCidrs": "AWS::EKS::Cluster/ResourcesVpcConfig.PublicAccessCidrs", + "SecurityGroupIds": "AWS::EKS::Cluster/ResourcesVpcConfig.SecurityGroupIds", + "SubnetIds": "AWS::EKS::Cluster/ResourcesVpcConfig.SubnetIds", + "ControlPlaneEgressMode": "String" + }, + "required": [ + "SubnetIds" + ] + }, + "AWS::EKS::Cluster/ResourcesVpcConfig.PublicAccessCidrs": { + "type": "list", + "member": "String" + }, + "AWS::EKS::Cluster/ResourcesVpcConfig.SecurityGroupIds": { + "type": "list", + "member": "String" + }, + "AWS::EKS::Cluster/ResourcesVpcConfig.SubnetIds": { + "type": "list", + "member": "String" + }, + "AWS::EKS::Cluster/RollbackConfig": { + "type": "structure", + "members": { + "TimeoutMinutes": "Integer" + } + }, + "AWS::EKS::Cluster/ScoringStrategy": { + "type": "structure", + "members": { + "Type": "String", + "Resources": "AWS::EKS::Cluster/ScoringStrategy.Resources" + } + }, + "AWS::EKS::Cluster/ScoringStrategy.Resources": { + "type": "list", + "member": "AWS::EKS::Cluster/ResourceWeight" + }, + "AWS::EKS::Cluster/ServiceNodePortRange": { + "type": "structure", + "members": { + "MinPort": "Integer", + "MaxPort": "Integer" + } + }, + "AWS::EKS::Cluster/StorageConfig": { + "type": "structure", + "members": { + "BlockStorage": "AWS::EKS::Cluster/BlockStorage" + } + }, + "AWS::EKS::Cluster/Tag": { + "type": "structure", + "members": { + "Key": "String", + "Value": "String" + }, + "required": [ + "Key", + "Value" + ] + }, + "AWS::EKS::Cluster/UpgradePolicy": { + "type": "structure", + "members": { + "SupportType": "String" + } + }, + "AWS::EKS::Cluster/ZonalShiftConfig": { + "type": "structure", + "members": { + "Enabled": "Boolean" + } + }, "AWS::Events::Rule": { "type": "structure", "members": { diff --git a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationEksIntegrationTest.java b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationEksIntegrationTest.java index 12cb969dd4..5b954fb86e 100644 --- a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationEksIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationEksIntegrationTest.java @@ -206,6 +206,66 @@ class CloudFormationEksIntegrationTest { + team + "\"}" + (extraTag.isEmpty() ? "" : ", " + extraTag) + "]"); } + @Test + void aClusterIsCreatedWithItsEncryptionAndNetworkSettings() { + String stack = "cfn-eks-set-" + Long.toString(System.nanoTime(), 36); + String key = "arn:aws:kms:us-east-1:000000000000:key/11111111-2222-3333-4444-555555555555"; + String listed = "\"EncryptionConfig\": [{\"Provider\": {\"KeyArn\": \"" + key + + "\"}, \"Resources\": [\"secrets\"]}], " + NETWORK; + String bare = "\"EncryptionConfig\": [{\"Provider\": {\"KeyArn\": \"" + key + "\"}}]"; + String template = "{\"Resources\": {" + + "\"Subject\": {\"Type\": \"AWS::EKS::Cluster\", \"Properties\": {" + ROLE + listed + "}}," + + "\"Bare\": {\"Type\": \"AWS::EKS::Cluster\", \"Properties\": {" + ROLE + bare + "}}}}"; + try (CloudFormationClient client = AwsTestClients.create( + CloudFormationClient.builder(), "test", Region.US_EAST_1)) { + CfnStackWaits.createStack(client, stack, template, "CREATE_COMPLETE"); + JsonPath cluster = given().get("/clusters/" + physicalId(client, stack, "Subject")).jsonPath(); + assertEquals(key, cluster.getString("cluster.encryptionConfig[0].provider.keyArn")); + assertEquals(List.of("secrets"), cluster.getList("cluster.encryptionConfig[0].resources")); + assertEquals("172.20.0.0/16", cluster.getString("cluster.kubernetesNetworkConfig.serviceIpv4Cidr")); + assertEquals(List.of("secrets"), given().get("/clusters/" + physicalId(client, stack, "Bare")) + .jsonPath().getList("cluster.encryptionConfig[0].resources")); + } finally { + CfnStackWaits.deleteStack(stack); + } + } + + @Test + void aBlankEncryptionConfigFailsTheClusterInsteadOfCreatingItUnencrypted() { + String stack = "cfn-eks-blank-" + Long.toString(System.nanoTime(), 36); + try (CloudFormationClient client = AwsTestClients.create( + CloudFormationClient.builder(), "test", Region.US_EAST_1)) { + CfnStackWaits.createStack(client, stack, subjectStack("", "", "AWS::EKS::Cluster", + ROLE + "\"EncryptionConfig\": \"\""), "ROLLBACK_COMPLETE"); + } finally { + CfnStackWaits.deleteStack(stack); + } + } + + @Test + void changingTheServiceCidrReplacesTheClusterWithTheNewOne() { + String stack = "cfn-eks-cidr-" + Long.toString(System.nanoTime(), 36); + try (CloudFormationClient client = AwsTestClients.create( + CloudFormationClient.builder(), "test", Region.US_EAST_1)) { + CfnStackWaits.createStack(client, stack, subjectStack("", "", "AWS::EKS::Cluster", ROLE + NETWORK), + "CREATE_COMPLETE"); + String first = physicalId(client, stack, "Subject"); + createUpdateChangeSet(client, stack, "cidr", subjectStack("", "", "AWS::EKS::Cluster", + ROLE + NETWORK.replace("172.20.0.0/16", "192.168.128.0/20"))); + executeAndAwaitUpdate(client, stack, "cidr"); + String second = physicalId(client, stack, "Subject"); + assertNotEquals(first, second); + assertEquals("192.168.128.0/20", given().get("/clusters/" + second).jsonPath() + .getString("cluster.kubernetesNetworkConfig.serviceIpv4Cidr")); + } finally { + CfnStackWaits.deleteStack(stack); + } + } + + private static final String ROLE = "\"RoleArn\": \"arn:aws:iam::000000000000:role/eks-set\", "; + private static final String NETWORK = "\"KubernetesNetworkConfig\": {\"IpFamily\": \"ipv4\"," + + " \"ServiceIpv4Cidr\": \"172.20.0.0/16\"}"; + private static String cluster(String role, String team) { return subjectStack("", "", "AWS::EKS::Cluster", "\"RoleArn\": \"arn:aws:iam::000000000000:role/" + role + "\", \"Tags\": [{\"Key\": \"team\", \"Value\": \"" + team + "\"}]"); diff --git a/src/test/java/io/floci/aws/services/eks/EksServiceTest.java b/src/test/java/io/floci/aws/services/eks/EksServiceTest.java index a0f86fd9a3..3ca67ef71f 100644 --- a/src/test/java/io/floci/aws/services/eks/EksServiceTest.java +++ b/src/test/java/io/floci/aws/services/eks/EksServiceTest.java @@ -1794,6 +1794,19 @@ class EksServiceTest { .anyMatch(p -> "-1".equals(p.getIpProtocol()) && p.getUserIdGroupPairs().stream().anyMatch(u -> sgId.equals(u.getGroupId()))); assertTrue(hasSelfEgress, "Security group should have self-referencing outbound egress rule for EFA"); + + int groupsBefore = ec2Service.describeSecurityGroups("us-east-1", List.of(), List.of(), Map.of()).size(); + KubernetesNetworkConfig badFamily = new KubernetesNetworkConfig(); + badFamily.setIpFamily("ipv5"); + CreateClusterRequest bad = new CreateClusterRequest(); + bad.setName("cluster-sg-bad-family"); + bad.setRoleArn("arn:aws:iam::000000000000:role/eks-role"); + bad.setResourcesVpcConfig(vpcConfig); + bad.setKubernetesNetworkConfig(badFamily); + assertEquals("InvalidParameterException", + assertThrows(AwsException.class, () -> service.createCluster(bad)).getErrorCode()); + assertEquals(groupsBefore, + ec2Service.describeSecurityGroups("us-east-1", List.of(), List.of(), Map.of()).size()); } @Test diff --git a/src/test/resources/cloudformation/schema-surface.tsv b/src/test/resources/cloudformation/schema-surface.tsv index 17f7f0dc0b..bad924440d 100644 --- a/src/test/resources/cloudformation/schema-surface.tsv +++ b/src/test/resources/cloudformation/schema-surface.tsv @@ -71,7 +71,7 @@ AWS::Cognito::UserPoolResourceServer Identifier,Name,Scopes,UserPoolId AWS::Cognito::UserPoolUser ClientMetadata,DesiredDeliveryMediums,ForceAliasCreation,MessageAction,UserAttributes,UserPoolId,Username,ValidationData AWS::Cognito::UserPoolUserToGroupAttachment GroupName,UserPoolId,Username AWS::Config::ConfigRule Arn,ConfigRuleId Compliance,ConfigRuleName,Description,EvaluationModes,InputParameters,MaximumExecutionFrequency,Scope,Source -AWS::DSQL::Cluster CreationTime,EncryptionDetails,Endpoint,Identifier,PolicyVersion,ResourceArn,Status,VpcEndpoint,VpcEndpointServiceName DeletionProtectionEnabled,KmsEncryptionKey,MultiRegionProperties,PolicyDocument,Tags +AWS::DSQL::Cluster CreationTime,EncryptionDetails,Endpoint,Identifier,PolicyVersion,ResourceArn,Status,VpcEndpoint,VpcEndpointServiceName DeletionProtectionEnabled,KmsEncryptionKey,MetricGroups,MultiRegionProperties,PolicyDocument,Tags AWS::DynamoDB::GlobalTable Arn,StreamArn,TableId AttributeDefinitions,BillingMode,GlobalSecondaryIndexes,GlobalTableSourceArn,GlobalTableWitnesses,KeySchema,LocalSecondaryIndexes,MultiRegionConsistency,ReadOnDemandThroughputSettings,ReadProvisionedThroughputSettings,Replicas,SSESpecification,StreamSpecification,TableName,TableType,TimeToLiveSpecification,VectorIndexes,WarmThroughput,WriteOnDemandThroughputSettings,WriteProvisionedThroughputSettings AWS::DynamoDB::Table Arn,StreamArn AttributeDefinitions,BillingMode,ContributorInsightsSpecification,DeletionProtectionEnabled,GlobalSecondaryIndexes,ImportSourceSpecification,KeySchema,KinesisStreamSpecification,LocalSecondaryIndexes,OnDemandThroughput,PointInTimeRecoverySpecification,ProvisionedThroughput,ResourcePolicy,SSESpecification,StreamSpecification,TableClass,TableName,Tags,TimeToLiveSpecification,VectorIndexes,WarmThroughput AWS::EC2::EIP AllocationId,PublicIp Address,Domain,InstanceId,IpamPoolId,NetworkBorderGroup,PublicIpv4Pool,Tags,TransferAddress diff --git a/src/test/resources/cloudformation/writable-property-gaps.tsv b/src/test/resources/cloudformation/writable-property-gaps.tsv index 3258b28932..84315ec7ea 100644 --- a/src/test/resources/cloudformation/writable-property-gaps.tsv +++ b/src/test/resources/cloudformation/writable-property-gaps.tsv @@ -156,6 +156,7 @@ AWS::Cognito::UserPoolClient AuthSessionValidity accepted and ignored AWS::Cognito::UserPoolClient EnablePropagateAdditionalUserContextData accepted and ignored AWS::Cognito::UserPoolDomain Routing accepted and ignored, as the CognitoCfnProvisioner javadoc records AWS::Config::ConfigRule Compliance accepted and ignored +AWS::DSQL::Cluster MetricGroups accepted and ignored AWS::DynamoDB::GlobalTable GlobalTableSourceArn accepted and ignored AWS::DynamoDB::GlobalTable GlobalTableWitnesses accepted and ignored AWS::DynamoDB::GlobalTable MultiRegionConsistency accepted and ignored @@ -296,12 +297,10 @@ AWS::EKS::Cluster CertificateAuthority accepted and ignored AWS::EKS::Cluster ComputeConfig accepted and ignored AWS::EKS::Cluster ControlPlaneScalingConfig accepted and ignored AWS::EKS::Cluster DeletionProtection accepted and ignored -AWS::EKS::Cluster EncryptionConfig accepted and ignored AWS::EKS::Cluster Force accepted and ignored AWS::EKS::Cluster KubeApiServerConfig accepted and ignored AWS::EKS::Cluster KubeControllerManagerConfig accepted and ignored AWS::EKS::Cluster KubeSchedulerConfig accepted and ignored -AWS::EKS::Cluster KubernetesNetworkConfig accepted and ignored AWS::EKS::Cluster Logging accepted and ignored AWS::EKS::Cluster OutpostConfig accepted and ignored AWS::EKS::Cluster RemoteNetworkConfig accepted and ignored diff --git a/tools/aws/regen_cfn_property_types.py b/tools/aws/regen_cfn_property_types.py index debca8ed75..67dbb09dfc 100644 --- a/tools/aws/regen_cfn_property_types.py +++ b/tools/aws/regen_cfn_property_types.py @@ -51,7 +51,7 @@ FETCH_TIMEOUT_SECONDS = 60 # The resource types whose provisioners read their properties through CfnPropertyTypes. RESOURCE_TYPES = ["AWS::AutoScaling::LaunchConfiguration", "AWS::DSQL::Cluster", "AWS::EC2::Instance", - "AWS::EC2::LaunchTemplate", "AWS::ECS::TaskDefinition", "AWS::Events::Rule", + "AWS::EC2::LaunchTemplate", "AWS::ECS::TaskDefinition", "AWS::EKS::Cluster", "AWS::Events::Rule", "AWS::Lambda::Function", "AWS::Lambda::LayerVersion", "AWS::SES::ConfigurationSetEventDestination"] diff --git a/tools/docs/cfn_resource_types.yaml b/tools/docs/cfn_resource_types.yaml index 1bf97fe118..6a011207f9 100644 --- a/tools/docs/cfn_resource_types.yaml +++ b/tools/docs/cfn_resource_types.yaml @@ -222,7 +222,7 @@ notes: AWS::CDK::Metadata: accepted; no-op AWS::Transfer::Server: 'management plane only; Ref returns the server ARN; Arn, ServerId and State attributes supported; AS2 managed egress IPs are not modeled; Domain replacement and IdentityProviderType changes are not supported' AWS::Transfer::User: 'management plane only; Ref returns the user ARN; Arn attribute supported; Policy and PosixProfile are not supported; a ServerId or UserName change replaces the user' - AWS::EKS::Cluster: 'created with `Name`, `Version`, `RoleArn` and `Tags`, a replacement included; `EncryptionConfig` and `KubernetesNetworkConfig` are accepted and ignored on create; updated in place for `Tags`, keeping tags added outside the stack; a change to `Name`, `RoleArn`, `EncryptionConfig`, `BootstrapSelfManagedAddons`, `OutpostConfig`, `AccessConfig.BootstrapClusterCreatorAdminPermissions`, `KubernetesNetworkConfig.IpFamily` or `KubernetesNetworkConfig.ServiceIpv4Cidr` replaces the cluster, as the registry marks them create-only, and deletes the old one once the update commits; a change to `Version` is accepted with a warning and not applied, as the emulator cannot upgrade a cluster in place' + AWS::EKS::Cluster: 'created with `Name`, `Version`, `RoleArn`, `Tags`, `EncryptionConfig` and `KubernetesNetworkConfig.IpFamily` and `ServiceIpv4Cidr`, a replacement included; a change to `EncryptionConfig`, `IpFamily` or `ServiceIpv4Cidr` replaces the cluster with the new value applied; `ElasticLoadBalancing` and `ServiceIpv6Cidr` are accepted and ignored; updated in place for `Tags`, keeping tags added outside the stack; a change to `Name`, `RoleArn`, `EncryptionConfig`, `BootstrapSelfManagedAddons`, `OutpostConfig`, `AccessConfig.BootstrapClusterCreatorAdminPermissions`, `KubernetesNetworkConfig.IpFamily` or `KubernetesNetworkConfig.ServiceIpv4Cidr` replaces the cluster, as the registry marks them create-only, and deletes the old one once the update commits; a change to `Version` is accepted with a warning and not applied, as the emulator cannot upgrade a cluster in place' AWS::EKS::Nodegroup: 'created with `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets` and `Tags`; updated in place for `Tags`, keeping tags added outside the stack; a change to `ClusterName`, `NodegroupName`, `NodeRole`, `Subnets`, `AmiType`, `CapacityType`, `DiskSize`, `InstanceTypes` or `RemoteAccess` replaces the nodegroup, as the registry marks them create-only, and deletes the old one once the update commits; `ScalingConfig`, `Labels`, `Taints`, `UpdateConfig`, `Version`, `ReleaseVersion`, `ForceUpdateEnabled`, `LaunchTemplate`, `NodeRepairConfig` and `WarmPoolConfig` are accepted and not applied, whether changed or dropped, with a warning, as the emulator cannot update a nodegroup in place' AWS::IAM::User: 'template `LoginProfile` and `PermissionsBoundary` are ignored; an API-created login profile is removed on delete' AWS::KMS::Key: 'created with `Description`, `KeyPolicy`, `KeySpec`, `KeyUsage`, `Origin`, `MultiRegion`, `Enabled`, `EnableKeyRotation` and `Tags`; updated in place for `Description`, `KeyPolicy`, `Enabled`, `EnableKeyRotation` and `Tags`, keeping tags added outside the stack; a template that drops `Description`, `Enabled` or `EnableKeyRotation` clears the description, enables the key and turns rotation off, a dropped `KeyPolicy` keeps the current policy, and one the stack never declared keeps the value set outside it; a rotation change on a key that stays disabled fails, as AWS raises `DisabledException`; a change to `KeySpec`, `KeyUsage`, `Origin` or `MultiRegion` fails the update, as on AWS, and the stack rolls back'