From 98158aacff7b4fa2f787e532cb2b84f1b772d502 Mon Sep 17 00:00:00 2001 From: Jackson Price <59149601+jprice8@users.noreply.github.com> Date: Tue, 1 Dec 2026 21:45:19 -0600 Subject: [PATCH] feat(cloudformation): provision CodeDeploy deployment configurations (#9940) Co-authored-by: Andre Kurait Signed-off-by: Jackson Price --- docs/services/cloudformation.md | 2 +- docs/services/codedeploy.md | 13 ++ pom.xml | 6 + .../CodeDeployCfnProvisioner.java | 146 ++++++++++-- .../codedeploy/CodeDeployService.java | 37 ++- .../create-only-properties.json | 7 + ...DeployDeploymentConfigIntegrationTest.java | 58 +++++ ...loymentConfigLifecycleIntegrationTest.java | 217 ++++++++++++++++++ ...loyDeploymentConfigCfnProvisionerTest.java | 151 ++++++++++++ .../codedeploy/CodeDeployIntegrationTest.java | 78 +++++++ .../cloudformation/schema-surface.tsv | 3 +- .../supported-resource-types.tsv | 1 + .../cloudformation/writable-property-gaps.tsv | 1 + 13 files changed, 698 insertions(+), 22 deletions(-) create mode 100644 src/test/java/io/floci/aws/services/cloudformation/CloudFormationCodeDeployDeploymentConfigIntegrationTest.java create mode 100644 src/test/java/io/floci/aws/services/cloudformation/CloudFormationCodeDeployDeploymentConfigLifecycleIntegrationTest.java create mode 100644 src/test/java/io/floci/aws/services/cloudformation/provisioners/CodeDeployDeploymentConfigCfnProvisionerTest.java diff --git a/docs/services/cloudformation.md b/docs/services/cloudformation.md index 8ebc449f87..869e077e89 100644 --- a/docs/services/cloudformation.md +++ b/docs/services/cloudformation.md @@ -251,7 +251,7 @@ cross-resource references. | Step Functions | `StateMachine` | | CodePipeline | `Pipeline`, `CustomActionType`, `Webhook` | | CodeBuild | `Project` | -| CodeDeploy | `Application` | +| CodeDeploy | `Application`, `DeploymentConfig` | | Batch | `ComputeEnvironment`, `JobQueue`, `JobDefinition` | | Cognito | `UserPool` (`ProviderURL` is the local issuer of the tokens Floci mints, `/`; `EnabledMfas` is applied with `SetUserPoolMfaConfig`, as on AWS, and once `SMS_MFA` is on only `MfaConfiguration: OFF` turns it off), `UserPoolClient`, `UserPoolDomain`, `UserPoolGroup`, `UserPoolIdentityProvider` (Ref returns the ProviderName; changing only `ProviderType` is refused, as on AWS, because the name is always the template's and the replacement would need the same address), `UserPoolResourceServer`, `UserPoolUser`, `UserPoolUserToGroupAttachment` | | Verified Permissions | `PolicyStore`, `PolicyTemplate`, `Policy` | diff --git a/docs/services/codedeploy.md b/docs/services/codedeploy.md index 9ab8a2bd80..499041d1a9 100644 --- a/docs/services/codedeploy.md +++ b/docs/services/codedeploy.md @@ -53,6 +53,19 @@ existing application storage and region visibility. | `DeleteDeploymentConfig` | Custom configs only; built-ins cannot be deleted | | `ListDeploymentConfigs` | Returns all configs including all 17 pre-seeded built-ins | +CloudFormation provisions `AWS::CodeDeploy::DeploymentConfig` through these +APIs. `Ref` returns the configuration name. The resource supports +`ComputePlatform`, `MinimumHealthyHosts`, `TrafficRoutingConfig`, and +`ZonalConfig`, including per-zone host counts and monitoring durations. + +CodeDeploy accepts canary and linear steps from 1 through 99 percent. +CloudFormation uses the same replacement decision in the change set and the +stack update. An unchanged resource keeps its name and identity. A change +to a create-only property replaces an unnamed configuration, while a configuration +with an explicit `DeploymentConfigName` requires a new name. Stack rollback +restores the previous configuration and removes the attempted replacement. +Stack deletion removes the owned configuration. + ### Deployment Execution | Operation | Notes | diff --git a/pom.xml b/pom.xml index c0a5477646..6b0e361626 100644 --- a/pom.xml +++ b/pom.xml @@ -120,6 +120,12 @@ com.google.api.grpc proto-google-common-protos + + software.amazon.awssdk + codedeploy + ${aws.sdk.version} + test + software.amazon.awssdk quicksight diff --git a/src/main/java/io/floci/aws/services/cloudformation/provisioners/CodeDeployCfnProvisioner.java b/src/main/java/io/floci/aws/services/cloudformation/provisioners/CodeDeployCfnProvisioner.java index 4d0bd81fe8..72702cffc2 100644 --- a/src/main/java/io/floci/aws/services/cloudformation/provisioners/CodeDeployCfnProvisioner.java +++ b/src/main/java/io/floci/aws/services/cloudformation/provisioners/CodeDeployCfnProvisioner.java @@ -12,20 +12,20 @@ import jakarta.inject.Inject; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.function.UnaryOperator; -/** - * CloudFormation provisioning for {@code AWS::CodeDeploy::Application}. Previously unhandled, so - * the type fell through to the generic stub: the stack reported CREATE_COMPLETE and no application - * existed in CodeDeploy (issue #8626). {@code Ref} is the application name; the registry schema - * declares no {@code Fn::GetAtt} attributes. - */ +/** Provisions CodeDeploy applications and deployment configurations. Both use the name for Ref. */ @ApplicationScoped public class CodeDeployCfnProvisioner implements CfnResourceProvisioner { private static final String TYPE = "AWS::CodeDeploy::Application"; + private static final String CONFIG = "AWS::CodeDeploy::DeploymentConfig"; + private static final int CONFIG_NAME_MAX_LENGTH = 100; + private static final String UNCHANGED_CONFIG_ATTR = "__FlociCodeDeployUnchangedConfiguration"; private static final int APPLICATION_NAME_MAX_LENGTH = 100; private static final ObjectMapper MAPPER = new ObjectMapper(); /** The tags an in-place update is about to change, for {@link #rollbackUpdate} to put back. */ @@ -33,6 +33,25 @@ public class CodeDeployCfnProvisioner implements CfnResourceProvisioner { /** The tag keys the template that provisioned the application set: the next update drops the ones it omits. */ static final String TAG_KEYS_ATTR = "__FlociCodeDeployTagKeys"; + private static final Map> CONFIG_MEMBERS = Map.of( + "MinimumHealthyHosts", Set.of("Type", "Value"), + "MinimumHealthyHostsPerZone", Set.of("Type", "Value"), + "TrafficRoutingConfig", Set.of("Type", "TimeBasedCanary", "TimeBasedLinear"), + "TimeBasedCanary", Set.of("CanaryInterval", "CanaryPercentage"), + "TimeBasedLinear", Set.of("LinearInterval", "LinearPercentage"), + "ZonalConfig", Set.of("FirstZoneMonitorDurationInSeconds", "MonitorDurationInSeconds", + "MinimumHealthyHostsPerZone")); + private static final Map> CONFIG_REQUIRED = Map.of( + "MinimumHealthyHosts", List.of("Type", "Value"), + "MinimumHealthyHostsPerZone", List.of("Type", "Value"), + "TrafficRoutingConfig", List.of("Type"), + "TimeBasedCanary", List.of("CanaryPercentage", "CanaryInterval"), + "TimeBasedLinear", List.of("LinearInterval", "LinearPercentage")); + private static final Set CONFIG_INTEGER_FIELDS = Set.of( + "Value", "CanaryInterval", "CanaryPercentage", "LinearInterval", "LinearPercentage"); + private static final Set CONFIG_LONG_FIELDS = Set.of( + "FirstZoneMonitorDurationInSeconds", "MonitorDurationInSeconds"); + private final CodeDeployService codeDeployService; @Inject @@ -42,7 +61,7 @@ public class CodeDeployCfnProvisioner implements CfnResourceProvisioner { @Override public Set resourceTypes() { - return Set.of(TYPE); + return Set.of(TYPE, CONFIG); } @Override @@ -57,26 +76,34 @@ public class CodeDeployCfnProvisioner implements CfnResourceProvisioner { @Override public UpdateCleanupResult completeUpdate(StackResource resource) { - resource.getAttributes().remove(SNAPSHOT_ATTR); + clearUpdateSnapshot(resource); return ReplacementCleanup.complete(resource, this::delete); } @Override public void clearUpdate(StackResource resource) { - resource.getAttributes().remove(SNAPSHOT_ATTR); + clearUpdateSnapshot(resource); ReplacementCleanup.clear(resource); } + private static void clearUpdateSnapshot(StackResource resource) { + resource.getAttributes().remove(SNAPSHOT_ATTR); + resource.getAttributes().remove(UNCHANGED_CONFIG_ATTR); + } + /** * A replacement or a stub migration is undone through the cleanup record, and an in-place update - * from the tag snapshot taken before it. The snapshot is spent only once the restore succeeded, - * so one that throws leaves it for ContinueUpdateRollback to retry. + * from the tag snapshot taken before it. An unchanged deployment configuration has no backing + * changes to undo. The tag snapshot survives a failed restore for ContinueUpdateRollback to retry. */ @Override public boolean rollbackUpdate(StackResource resource) { if (ReplacementCleanup.rollback(resource, this::delete)) { return true; } + if (CONFIG.equals(resource.getResourceType())) { + return resource.getAttributes().remove(UNCHANGED_CONFIG_ATTR) != null; + } JsonNode snapshot = CfnRollback.updateSnapshot(resource, SNAPSHOT_ATTR); if (snapshot == null) { return false; @@ -94,12 +121,21 @@ public class CodeDeployCfnProvisioner implements CfnResourceProvisioner { @Override public void provision(StackResource r, JsonNode props, ProvisionContext ctx) { - // A snapshot describes the update in flight; one an earlier update left behind is stale. - r.getAttributes().remove(SNAPSHOT_ATTR); + clearUpdateSnapshot(r); if (ctx.isUpdate()) { ReplacementCleanup.endRollbackRetry(r); } Map attributesBefore = new HashMap<>(r.getAttributes()); + if (CONFIG.equals(r.getResourceType())) { + provisionConfiguration(r, props, ctx); + } else { + provisionApplication(r, props, ctx, attributesBefore); + } + ReplacementCleanup.record(r, ctx, attributesBefore); + } + + private void provisionApplication(StackResource r, JsonNode props, ProvisionContext ctx, + Map attributesBefore) { String explicitName = ctx.resolveOptionalWritten(props, "ApplicationName"); boolean hasExplicitName = explicitName != null; String priorPhysicalId = ctx.priorPhysicalId(); @@ -139,7 +175,83 @@ public class CodeDeployCfnProvisioner implements CfnResourceProvisioner { // The type has no Arn attribute; a rollback puts the stub's back from the cleanup record. r.getAttributes().remove("Arn"); } - ReplacementCleanup.record(r, ctx, attributesBefore); + } + + private void provisionConfiguration(StackResource resource, JsonNode props, ProvisionContext ctx) { + JsonNode resolved = props == null ? MAPPER.createObjectNode() : ctx.engine().resolveNodeOmittingNoValue(props); + String explicitName = ctx.resolveOptionalWritten(resolved, "DeploymentConfigName"); + if (explicitName != null && (explicitName.isBlank() || explicitName.length() > CONFIG_NAME_MAX_LENGTH)) { + throw invalid("DeploymentConfigName must be nonblank and at most 100 characters"); + } + String platform = ctx.resolveOrDefault(resolved, "ComputePlatform", "Server"); + Map hosts = configurationObject(resolved, "MinimumHealthyHosts", "#"); + Map traffic = configurationObject(resolved, "TrafficRoutingConfig", "#"); + Map zones = configurationObject(resolved, "ZonalConfig", "#"); + boolean stub = CfnResourceDispatcher.isStub(ctx.priorPhysicalId(), resource.getAttributes()); + String name = ctx.changes(CONFIG, props, explicitName, resource.getLogicalId(), CONFIG_NAME_MAX_LENGTH, + false, UnaryOperator.identity(), stub).name(); + if (ctx.reusesPriorEntity(name) && !stub) { + codeDeployService.getDeploymentConfig(ctx.region(), name); + resource.getAttributes().put(UNCHANGED_CONFIG_ATTR, "true"); + return; + } + codeDeployService.createDeploymentConfig(ctx.region(), name, hosts, platform, traffic, zones); + resource.setPhysicalId(name); + if (stub) { + resource.getAttributes().remove("Arn"); + } + } + + /** CodeDeploy uses lower-camel member names and 64-bit integers for zone monitoring durations. */ + private static Map configurationObject(JsonNode parent, String property, String parentPath) { + JsonNode value = parent.get(property); + if (value == null || value.isNull()) { + return null; + } + if (!value.isObject()) { + throw invalid(property + " must be an object"); + } + String path = parentPath + "/" + property; + for (String required : CONFIG_REQUIRED.getOrDefault(property, List.of())) { + if (!value.hasNonNull(required)) { + throw CfnPropertyTypes.modelValidation(path + ": required key [" + required + "] not found)"); + } + } + Map result = new LinkedHashMap<>(); + for (Map.Entry member : value.properties()) { + String key = member.getKey(); + if (!CONFIG_MEMBERS.get(property).contains(key)) { + throw invalid(property + " does not support " + key); + } + if (!member.getValue().isNull()) { + String apiName = Character.toLowerCase(key.charAt(0)) + key.substring(1); + Object apiValue = CONFIG_MEMBERS.containsKey(key) + ? configurationObject(value, key, path) : configurationValue(member.getValue(), key); + result.put(apiName, apiValue); + } + } + return result; + } + + private static Object configurationValue(JsonNode value, String property) { + if (value.isContainerNode() || value.isNull()) { + throw invalid(property + " must be a scalar"); + } + try { + if (CONFIG_INTEGER_FIELDS.contains(property)) { + return Integer.parseInt(value.asText()); + } + if (CONFIG_LONG_FIELDS.contains(property)) { + return Long.parseLong(value.asText()); + } + } catch (NumberFormatException invalidNumber) { + throw invalid(property + " must be a valid integer"); + } + return value.asText(); + } + + private static AwsException invalid(String message) { + return new AwsException("ValidationError", message, 400); } /** @@ -193,6 +305,12 @@ public class CodeDeployCfnProvisioner implements CfnResourceProvisioner { @Override public void delete(String resourceType, String physicalId, String region) { + if (CONFIG.equals(resourceType)) { + CfnDeletes.safeDelete("CodeDeploy deployment configuration", physicalId, + () -> codeDeployService.deleteDeploymentConfig(region, physicalId), + "DeploymentConfigDoesNotExistException"); + return; + } CfnDeletes.safeDelete("CodeDeploy application", physicalId, () -> codeDeployService.deleteApplication(region, physicalId), "ApplicationDoesNotExistException"); } diff --git a/src/main/java/io/floci/aws/services/codedeploy/CodeDeployService.java b/src/main/java/io/floci/aws/services/codedeploy/CodeDeployService.java index dec7b0aeb7..f7dfa0f562 100644 --- a/src/main/java/io/floci/aws/services/codedeploy/CodeDeployService.java +++ b/src/main/java/io/floci/aws/services/codedeploy/CodeDeployService.java @@ -553,11 +553,11 @@ public class CodeDeployService { // ---- Deployment Configs ---- - public DeploymentConfig createDeploymentConfig(String region, String name, - Map minimumHealthyHosts, - String computePlatform, - Map trafficRoutingConfig, - Map zonalConfig) { + public synchronized DeploymentConfig createDeploymentConfig(String region, String name, + Map minimumHealthyHosts, + String computePlatform, + Map trafficRoutingConfig, + Map zonalConfig) { Map store = deploymentConfigsFor(region); if (store.containsKey(name)) { throw new AwsException("DeploymentConfigAlreadyExistsException", @@ -567,6 +567,10 @@ public class CodeDeployService { throw new AwsException("InvalidDeploymentConfigNameException", "Cannot create a deployment configuration starting with 'CodeDeployDefault.'", 400); } + if (trafficRoutingConfig != null) { + validateTrafficStep(trafficRoutingConfig.get("timeBasedCanary"), "canaryPercentage", "canaryInterval"); + validateTrafficStep(trafficRoutingConfig.get("timeBasedLinear"), "linearPercentage", "linearInterval"); + } DeploymentConfig cfg = new DeploymentConfig(); cfg.setDeploymentConfigId(UUID.randomUUID().toString()); cfg.setDeploymentConfigName(name); @@ -580,6 +584,27 @@ public class CodeDeployService { return cfg; } + private static void validateTrafficStep(Object step, String percentageField, String intervalField) { + if (step == null) { + return; + } + if (!(step instanceof Map fields)) { + throw invalidTrafficRouting("A traffic shift must be an object"); + } + Object percentage = fields.get(percentageField); + if (percentage != null && (!(percentage instanceof Integer value) || value < 1 || value > 99)) { + throw invalidTrafficRouting(percentageField + " must be between 1 and 99"); + } + Object interval = fields.get(intervalField); + if (interval != null && (!(interval instanceof Integer value) || value < 0)) { + throw invalidTrafficRouting(intervalField + " must be a nonnegative integer"); + } + } + + private static AwsException invalidTrafficRouting(String message) { + return new AwsException("InvalidTrafficRoutingConfigurationException", message, 400); + } + public DeploymentConfig getDeploymentConfig(String region, String name) { DeploymentConfig cfg = deploymentConfigsFor(region).get(name); if (cfg == null) { @@ -589,7 +614,7 @@ public class CodeDeployService { return cfg; } - public void deleteDeploymentConfig(String region, String name) { + public synchronized void deleteDeploymentConfig(String region, String name) { if (name.startsWith("CodeDeployDefault.")) { throw new AwsException("InvalidDeploymentConfigNameException", "Cannot delete a built-in deployment configuration.", 400); diff --git a/src/main/resources/cloudformation/create-only-properties.json b/src/main/resources/cloudformation/create-only-properties.json index f2815513a9..bfa8cf9814 100644 --- a/src/main/resources/cloudformation/create-only-properties.json +++ b/src/main/resources/cloudformation/create-only-properties.json @@ -244,6 +244,13 @@ "ApplicationName", "ComputePlatform" ], + "AWS::CodeDeploy::DeploymentConfig": [ + "DeploymentConfigName", + "MinimumHealthyHosts", + "ComputePlatform", + "ZonalConfig", + "TrafficRoutingConfig" + ], "AWS::CodePipeline::CustomActionType": [ "Category", "ConfigurationProperties", diff --git a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCodeDeployDeploymentConfigIntegrationTest.java b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCodeDeployDeploymentConfigIntegrationTest.java new file mode 100644 index 0000000000..e2d0b66fa1 --- /dev/null +++ b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCodeDeployDeploymentConfigIntegrationTest.java @@ -0,0 +1,58 @@ +package io.floci.aws.services.cloudformation; + +import io.floci.aws.testing.AwsTestClients; +import io.floci.aws.testing.CfnStackWaits; +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.cloudformation.CloudFormationClient; +import software.amazon.awssdk.services.cloudformation.model.Stack; +import software.amazon.awssdk.services.codedeploy.CodeDeployClient; +import software.amazon.awssdk.services.codedeploy.model.DeploymentConfigDoesNotExistException; +import software.amazon.awssdk.services.codedeploy.model.DeploymentConfigInfo; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@QuarkusTest +class CloudFormationCodeDeployDeploymentConfigIntegrationTest { + + @ParameterizedTest + @ValueSource(strings = {"us-east-1", "us-gov-west-1"}) + void createsARealLambdaCanaryConfigurationAndDeletesItWithTheStack(String region) { + String stack = "cfn-deployment-config-" + UUID.randomUUID(); + String name = "canary-" + UUID.randomUUID(); + try (CloudFormationClient cfn = AwsTestClients.create( + CloudFormationClient.builder(), "000000000000", Region.of(region)); + CodeDeployClient deployments = AwsTestClients.create( + CodeDeployClient.builder(), "000000000000", Region.of(region))) { + try { + Stack created = CfnStackWaits.createStack(cfn, stack, """ + {"Parameters":{"Percentage":{"Type":"Number","Default":25}}, + "Resources":{"Config":{"Type":"AWS::CodeDeploy::DeploymentConfig","Properties":{ + "DeploymentConfigName":"%s","ComputePlatform":"Lambda", + "TrafficRoutingConfig":{"Type":"TimeBasedCanary","TimeBasedCanary":{ + "CanaryPercentage":{"Ref":"Percentage"},"CanaryInterval":5}}}}}, + "Outputs":{"Config":{"Value":{"Ref":"Config"}}}} + """.formatted(name), "CREATE_COMPLETE"); + DeploymentConfigInfo config = deployments.getDeploymentConfig(request -> request.deploymentConfigName(name)) + .deploymentConfigInfo(); + assertEquals(name, CfnStackWaits.output(created, "Config")); + assertEquals(name, config.deploymentConfigName()); + assertNotNull(config.deploymentConfigId()); + assertEquals("Lambda", config.computePlatformAsString()); + assertEquals("TimeBasedCanary", config.trafficRoutingConfig().typeAsString()); + assertEquals(25, config.trafficRoutingConfig().timeBasedCanary().canaryPercentage()); + assertEquals(5, config.trafficRoutingConfig().timeBasedCanary().canaryInterval()); + } finally { + CfnStackWaits.deleteStack(cfn, stack); + } + assertThrows(DeploymentConfigDoesNotExistException.class, + () -> deployments.getDeploymentConfig(request -> request.deploymentConfigName(name))); + } + } +} diff --git a/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCodeDeployDeploymentConfigLifecycleIntegrationTest.java b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCodeDeployDeploymentConfigLifecycleIntegrationTest.java new file mode 100644 index 0000000000..94ca2226c4 --- /dev/null +++ b/src/test/java/io/floci/aws/services/cloudformation/CloudFormationCodeDeployDeploymentConfigLifecycleIntegrationTest.java @@ -0,0 +1,217 @@ +package io.floci.aws.services.cloudformation; + +import io.floci.aws.testing.AwsTestClients; +import io.floci.aws.testing.CfnStackWaits; +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.cloudformation.CloudFormationClient; +import software.amazon.awssdk.services.cloudformation.model.Stack; +import software.amazon.awssdk.services.codedeploy.CodeDeployClient; +import software.amazon.awssdk.services.codedeploy.model.DeploymentConfigDoesNotExistException; +import software.amazon.awssdk.services.codedeploy.model.DeploymentConfigInfo; + +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import static io.floci.aws.services.cloudformation.CfnStackTestSupport.createUpdateChangeSet; +import static io.floci.aws.services.cloudformation.CfnStackTestSupport.replacement; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@QuarkusTest +class CloudFormationCodeDeployDeploymentConfigLifecycleIntegrationTest { + + @ParameterizedTest + @ValueSource(strings = {"us-east-1", "us-gov-west-1"}) + void generatedNamesStayStableUntilReplacementAndRollbackRemovesOnlyTheReplacement(String region) { + try (Fixture fixture = new Fixture("000000000000", region)) { + DeploymentConfigInfo original = fixture.create(canary(25)); + String quotedPercentage = canary(25).replace("\"CanaryPercentage\":25", "\"CanaryPercentage\":\"25\""); + fixture.assertReplacementPreview(quotedPercentage); + DeploymentConfigInfo quoted = fixture.update(quotedPercentage, false, "UPDATE_COMPLETE"); + assertNotEquals(original.deploymentConfigName(), quoted.deploymentConfigName()); + assertNotEquals(original.deploymentConfigId(), quoted.deploymentConfigId()); + assertEquals(25, quoted.trafficRoutingConfig().timeBasedCanary().canaryPercentage()); + fixture.assertGone(original.deploymentConfigName()); + + DeploymentConfigInfo replacement = fixture.update(""" + {"ComputePlatform":"Lambda","TrafficRoutingConfig":{"Type":"TimeBasedLinear", + "TimeBasedLinear":{"LinearPercentage":50,"LinearInterval":2}}} + """, false, "UPDATE_COMPLETE"); + assertNotEquals(quoted.deploymentConfigName(), replacement.deploymentConfigName()); + assertEquals(50, replacement.trafficRoutingConfig().timeBasedLinear().linearPercentage()); + fixture.assertGone(quoted.deploymentConfigName()); + + DeploymentConfigInfo restored = fixture.update(canary(75), true, "UPDATE_ROLLBACK_COMPLETE"); + assertEquals(replacement.deploymentConfigName(), restored.deploymentConfigName()); + assertEquals(replacement.deploymentConfigId(), restored.deploymentConfigId()); + assertEquals(Set.of(restored.deploymentConfigName()), fixture.generatedConfigurations()); + } + } + + @Test + void unchangedConfigurationRollsBackWhenADependentResourceFails() { + try (Fixture fixture = new Fixture("000000000000", "us-east-1")) { + String originalSettings = canary(25); + DeploymentConfigInfo original = fixture.create(originalSettings); + DeploymentConfigInfo restored = fixture.update(originalSettings, true, "UPDATE_ROLLBACK_COMPLETE"); + + assertEquals(original.deploymentConfigId(), restored.deploymentConfigId()); + assertEquals(Set.of(original.deploymentConfigName()), fixture.generatedConfigurations()); + } + } + + @ParameterizedTest + @ValueSource(strings = {"us-east-1", "us-gov-west-1"}) + void serverConfigurationMapsHostCountsAndZoneDurationsAndRequiresANewExplicitName(String region) { + try (Fixture fixture = new Fixture("000000000000", region)) { + String first = fixture.stack + "-named"; + String properties = """ + {"DeploymentConfigName":"%s", + "MinimumHealthyHosts":{"Type":"FLEET_PERCENT","Value":25}, + "ZonalConfig":{"FirstZoneMonitorDurationInSeconds":900, + "MonitorDurationInSeconds":"1800", + "MinimumHealthyHostsPerZone":{"Type":"HOST_COUNT","Value":"1"}}} + """.formatted(first); + DeploymentConfigInfo original = fixture.create(properties); + assertEquals("Server", original.computePlatformAsString()); + assertEquals("FLEET_PERCENT", original.minimumHealthyHosts().typeAsString()); + assertEquals(25, original.minimumHealthyHosts().value()); + assertEquals(900L, original.zonalConfig().firstZoneMonitorDurationInSeconds()); + assertEquals(1800L, original.zonalConfig().monitorDurationInSeconds()); + assertEquals("HOST_COUNT", original.zonalConfig().minimumHealthyHostsPerZone().typeAsString()); + assertEquals(1, original.zonalConfig().minimumHealthyHostsPerZone().value()); + + String changed = properties.replace("\"Value\":25", "\"Value\":50"); + DeploymentConfigInfo rejected = fixture.update(changed, false, "UPDATE_ROLLBACK_COMPLETE"); + assertEquals(original.deploymentConfigId(), rejected.deploymentConfigId()); + assertEquals(25, rejected.minimumHealthyHosts().value()); + + DeploymentConfigInfo renamed = fixture.update(changed.replace(first, first + "-next"), + false, "UPDATE_COMPLETE"); + assertEquals(first + "-next", renamed.deploymentConfigName()); + assertEquals(50, renamed.minimumHealthyHosts().value()); + fixture.assertGone(first); + } + } + + @Test + void identicalNamesInDifferentAccountsAndRegionsHaveIndependentLifecycles() { + String name = "shared-config-" + UUID.randomUUID(); + String properties = "{\"DeploymentConfigName\":\"" + name + "\"," + canary(25).substring(1); + try (Fixture first = new Fixture("111122223333", "us-east-1"); + Fixture otherAccount = new Fixture("444455556666", "us-east-1"); + Fixture otherRegion = new Fixture("111122223333", "us-gov-west-1")) { + DeploymentConfigInfo original = first.create(properties); + DeploymentConfigInfo second = otherAccount.create(properties); + DeploymentConfigInfo third = otherRegion.create(properties); + assertNotEquals(original.deploymentConfigId(), second.deploymentConfigId()); + assertNotEquals(original.deploymentConfigId(), third.deploymentConfigId()); + first.delete(); + first.assertGone(name); + assertEquals(second.deploymentConfigId(), otherAccount.get(name).deploymentConfigId()); + assertEquals(third.deploymentConfigId(), otherRegion.get(name).deploymentConfigId()); + } + } + + private static String canary(int percentage) { + return """ + {"ComputePlatform":"Lambda","TrafficRoutingConfig":{"Type":"TimeBasedCanary", + "TimeBasedCanary":{"CanaryPercentage":%d,"CanaryInterval":5}}} + """.formatted(percentage); + } + + private static final class Fixture implements AutoCloseable { + private final String stack = "cfg-" + UUID.randomUUID(); + private final CloudFormationClient cfn; + private final CodeDeployClient deployments; + private final Set names = new LinkedHashSet<>(); + private int revision; + private String cleanupId; + + private Fixture(String account, String region) { + cfn = AwsTestClients.create(CloudFormationClient.builder(), account, Region.of(region)); + deployments = AwsTestClients.create(CodeDeployClient.builder(), account, Region.of(region)); + } + + private DeploymentConfigInfo create(String properties) { + cleanupId = stack; + Stack created = CfnStackWaits.createStack(cfn, stack, template(properties, false), "CREATE_COMPLETE"); + cleanupId = created.stackId(); + return configuration(created); + } + + private DeploymentConfigInfo update(String properties, boolean failure, String expected) { + return configuration(CfnStackWaits.updateStack(cfn, stack, template(properties, failure), expected)); + } + + private void assertReplacementPreview(String properties) { + String changeSet = "preview-" + UUID.randomUUID(); + createUpdateChangeSet(cfn, stack, changeSet, template(properties, false)); + try { + assertEquals(List.of("True"), replacement(cfn, stack, changeSet, "Config")); + } finally { + cfn.deleteChangeSet(request -> request.stackName(stack).changeSetName(changeSet)); + } + } + + private String template(String properties, boolean failure) { + String dependent = failure ? """ + ,"Failure":{"Type":"AWS::CodeDeploy::Application","DependsOn":"Config", + "Properties":{"ComputePlatform":"invalid"}} + """ : ""; + return """ + {"Description":"revision-%d","Resources":{ + "Config":{"Type":"AWS::CodeDeploy::DeploymentConfig","Properties":%s}%s}, + "Outputs":{"Config":{"Value":{"Ref":"Config"}}}} + """.formatted(++revision, properties, dependent); + } + + private DeploymentConfigInfo configuration(Stack state) { + String name = CfnStackWaits.output(state, "Config"); + names.add(name); + return get(name); + } + + private DeploymentConfigInfo get(String name) { + return deployments.getDeploymentConfig(request -> request.deploymentConfigName(name)).deploymentConfigInfo(); + } + + private Set generatedConfigurations() { + Set result = new LinkedHashSet<>(); + deployments.listDeploymentConfigs().deploymentConfigsList().stream() + .filter(name -> name.startsWith(stack)).forEach(result::add); + return result; + } + + private void assertGone(String name) { + assertThrows(DeploymentConfigDoesNotExistException.class, () -> get(name)); + } + + private void delete() { + if (cleanupId != null) { + CfnStackWaits.deleteStack(cfn, cleanupId); + cleanupId = null; + } + } + + @Override + public void close() { + try { + delete(); + names.forEach(this::assertGone); + assertTrue(generatedConfigurations().isEmpty(), "A replaced configuration was orphaned"); + } finally { + deployments.close(); + cfn.close(); + } + } + } +} diff --git a/src/test/java/io/floci/aws/services/cloudformation/provisioners/CodeDeployDeploymentConfigCfnProvisionerTest.java b/src/test/java/io/floci/aws/services/cloudformation/provisioners/CodeDeployDeploymentConfigCfnProvisionerTest.java new file mode 100644 index 0000000000..ce765b4153 --- /dev/null +++ b/src/test/java/io/floci/aws/services/cloudformation/provisioners/CodeDeployDeploymentConfigCfnProvisionerTest.java @@ -0,0 +1,151 @@ +package io.floci.aws.services.cloudformation.provisioners; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.floci.aws.core.common.AwsException; +import io.floci.aws.services.cloudformation.model.StackResource; +import io.floci.aws.services.codedeploy.CodeDeployService; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; + +class CodeDeployDeploymentConfigCfnProvisionerTest { + private static final String REGION = "us-east-1"; + private final ObjectMapper mapper = new ObjectMapper(); + private final CodeDeployService service = mock(CodeDeployService.class); + private final CodeDeployCfnProvisioner provisioner = new CodeDeployCfnProvisioner(service); + + @Test + void configurationDeletionToleratesOnlyTheMissingConfigurationError() { + StackResource resource = configurationResource(); + resource.setPhysicalId("config"); + AwsException denied = new AwsException("AccessDeniedException", "not allowed", 403); + doThrow(denied).when(service).deleteDeploymentConfig(REGION, "config"); + assertSame(denied, assertThrows(AwsException.class, () -> provisioner.delete(resource, REGION))); + doThrow(new AwsException("DeploymentConfigDoesNotExistException", "already gone", 400)) + .when(service).deleteDeploymentConfig(REGION, "config"); + provisioner.delete(resource, REGION); + } + + @Test + void configurationReplacementRetriesFailedCleanupWithoutDeletingThePriorConfiguration() throws Exception { + StackResource resource = configurationResource(); + provisioner.provision(resource, mapper.readTree("{\"DeploymentConfigName\":\"old\"}"), context(null)); + provisioner.provision(resource, mapper.readTree("{\"DeploymentConfigName\":\"new\"}"), context("old")); + doThrow(new IllegalStateException("delete failed")).when(service).deleteDeploymentConfig(REGION, "new"); + assertThrows(IllegalStateException.class, () -> provisioner.rollbackUpdate(resource)); + assertEquals("old", resource.getPhysicalId()); + verify(service, never()).deleteDeploymentConfig(REGION, "old"); + doNothing().when(service).deleteDeploymentConfig(REGION, "new"); + assertTrue(provisioner.rollbackUpdate(resource)); + verify(service, times(2)).deleteDeploymentConfig(REGION, "new"); + provisioner.clearUpdate(resource); + provisioner.delete(resource, REGION); + verify(service).deleteDeploymentConfig(REGION, "old"); + } + + @Test + void rollingBackAStubMigrationRestoresTheOldRefAndDeletesOnlyTheNewConfiguration() { + String stubId = "Config-1a2b3c4d"; + StackResource resource = configurationResource(); + resource.setPhysicalId(stubId); + resource.getAttributes().put("Arn", "arn:aws:stub:::Config"); + provisioner.provision(resource, mapper.createObjectNode(), context(stubId)); + + String name = resource.getPhysicalId(); + assertNotEquals(stubId, name); + assertFalse(resource.getAttributes().containsKey("Arn")); + verify(service).createDeploymentConfig(REGION, name, null, "Server", null, null); + assertTrue(provisioner.rollbackUpdate(resource)); + verify(service).deleteDeploymentConfig(REGION, name); + verify(service, never()).deleteDeploymentConfig(REGION, stubId); + assertEquals(stubId, resource.getPhysicalId()); + assertEquals("arn:aws:stub:::Config", resource.getAttributes().get("Arn")); + } + + @Test + void configurationRejectsInvalidPropertiesBeforeCreatingAnything() throws Exception { + Map invalidProperties = Map.of( + "{\"DeploymentConfigName\":\" \"}", "DeploymentConfigName must be nonblank and at most 100 characters", + "{\"MinimumHealthyHosts\":{\"Type\":\"HOST_COUNT\",\"Value\":\"not-a-number\"}}", + "Value must be a valid integer", + "{\"TrafficRoutingConfig\":{\"Type\":\"TimeBasedCanary\",\"TimeBasedCanary\":[]}}", + "TimeBasedCanary must be an object", + "{\"TrafficRoutingConfig\":{\"Type\":\"TimeBasedLinear\",\"Extra\":true}}", + "TrafficRoutingConfig does not support Extra"); + for (Map.Entry example : invalidProperties.entrySet()) { + JsonNode parsed = mapper.readTree(example.getKey()); + AwsException error = assertThrows(AwsException.class, + () -> provisioner.provision(configurationResource(), parsed, context(null))); + assertEquals("ValidationError", error.getErrorCode()); + assertEquals(example.getValue(), error.getMessage()); + } + verifyNoInteractions(service); + } + + @Test + void missingNestedConfigurationMemberReportsItsModelPath() throws Exception { + JsonNode props = mapper.readTree(""" + {"ZonalConfig":{"MinimumHealthyHostsPerZone":{"Value":1}}} + """); + AwsException error = assertThrows(AwsException.class, + () -> provisioner.provision(configurationResource(), props, context(null))); + assertEquals("InvalidRequest", error.getErrorCode()); + assertEquals("Model validation failed (#/ZonalConfig/MinimumHealthyHostsPerZone: required key [Type] not found)", + error.getMessage()); + verifyNoInteractions(service); + } + + @Test + void rollingBackAnUnchangedUpdateLeavesThePriorConfigurationInPlace() throws Exception { + JsonNode props = mapper.readTree("{\"DeploymentConfigName\":\"config\"}"); + StackResource resource = configurationResource(); + resource.setPhysicalId("config"); + ProvisionContext update = new ProvisionContext(ProvisionContexts.passthroughEngine(), REGION, + "000000000000", "stack", "config", event -> {}, props); + provisioner.provision(resource, props, update); + assertTrue(provisioner.rollbackUpdate(resource)); + assertEquals("config", resource.getPhysicalId()); + verify(service).getDeploymentConfig(REGION, "config"); + verify(service, never()).deleteDeploymentConfig(REGION, "config"); + } + + @Test + void configurationPreservesTheSchemasInt64ZoneDuration() throws Exception { + provisioner.provision(configurationResource(), mapper.readTree(""" + {"DeploymentConfigName":"config", + "ZonalConfig":{"MonitorDurationInSeconds":"4294967296"}} + """), context(null)); + verify(service).createDeploymentConfig(eq(REGION), eq("config"), isNull(), eq("Server"), isNull(), + eq(Map.of("monitorDurationInSeconds", 4294967296L))); + } + + private ProvisionContext context(String prior) { + return new ProvisionContext(ProvisionContexts.passthroughEngine(), REGION, "000000000000", "stack", prior); + } + + private static StackResource configurationResource() { + StackResource resource = new StackResource(); + resource.setAttributes(new HashMap<>()); + resource.setLogicalId("Config"); + resource.setResourceType("AWS::CodeDeploy::DeploymentConfig"); + return resource; + } +} diff --git a/src/test/java/io/floci/aws/services/codedeploy/CodeDeployIntegrationTest.java b/src/test/java/io/floci/aws/services/codedeploy/CodeDeployIntegrationTest.java index 2d3985825b..c31e62155a 100644 --- a/src/test/java/io/floci/aws/services/codedeploy/CodeDeployIntegrationTest.java +++ b/src/test/java/io/floci/aws/services/codedeploy/CodeDeployIntegrationTest.java @@ -1,5 +1,6 @@ package io.floci.aws.services.codedeploy; +import io.floci.aws.testing.AwsTestClients; import io.floci.aws.testing.RestAssuredJsonUtils; import io.quarkus.test.junit.QuarkusTest; import org.junit.jupiter.api.BeforeAll; @@ -7,9 +8,22 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.codedeploy.CodeDeployClient; +import software.amazon.awssdk.services.codedeploy.model.DeploymentConfigAlreadyExistsException; +import software.amazon.awssdk.services.codedeploy.model.DeploymentConfigDoesNotExistException; +import software.amazon.awssdk.services.codedeploy.model.DeploymentConfigInfo; +import software.amazon.awssdk.services.codedeploy.model.InvalidTrafficRoutingConfigurationException; +import software.amazon.awssdk.services.codedeploy.model.TrafficRoutingConfig; + +import java.util.UUID; import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; @QuarkusTest @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @@ -22,6 +36,70 @@ class CodeDeployIntegrationTest { RestAssuredJsonUtils.configureAwsContentTypes(); } + @Test + void duplicateDeploymentConfigKeepsTheOriginalIdAndTrafficSettings() { + String name = "existing-config-" + UUID.randomUUID(); + TrafficRoutingConfig original = trafficStep("Canary", 25, 5); + try (CodeDeployClient client = AwsTestClients.create( + CodeDeployClient.builder(), "000000000000", Region.US_EAST_1)) { + String id = client.createDeploymentConfig(request -> request.deploymentConfigName(name) + .computePlatform("Lambda").trafficRoutingConfig(original)).deploymentConfigId(); + try { + assertThrows(DeploymentConfigAlreadyExistsException.class, + () -> client.createDeploymentConfig(request -> request.deploymentConfigName(name) + .computePlatform("Lambda").trafficRoutingConfig(trafficStep("Linear", 50, 2)))); + DeploymentConfigInfo stored = client.getDeploymentConfig(request -> request.deploymentConfigName(name)) + .deploymentConfigInfo(); + assertEquals(id, stored.deploymentConfigId()); + assertEquals(original, stored.trafficRoutingConfig()); + } finally { + client.deleteDeploymentConfig(request -> request.deploymentConfigName(name)); + } + } + } + + @ParameterizedTest + @CsvSource({"Canary,0,1", "Canary,100,1", "Linear,0,1", "Linear,100,1", "Canary,25,-1", "Linear,25,-1"}) + void invalidTrafficStepsAreRejectedByCreateDeploymentConfig(String mode, int percentage, int interval) { + String name = "invalid-steps-" + UUID.randomUUID(); + try (CodeDeployClient client = AwsTestClients.create( + CodeDeployClient.builder(), "000000000000", Region.US_EAST_1)) { + assertThrows(InvalidTrafficRoutingConfigurationException.class, + () -> client.createDeploymentConfig(request -> request.deploymentConfigName(name) + .computePlatform("Lambda").trafficRoutingConfig(trafficStep(mode, percentage, interval)))); + assertThrows(DeploymentConfigDoesNotExistException.class, + () -> client.getDeploymentConfig(request -> request.deploymentConfigName(name))); + } + } + + @ParameterizedTest + @CsvSource({"Canary,1", "Canary,99", "Linear,1", "Linear,99"}) + void createDeploymentConfigAcceptsBothPercentageLimits(String mode, int percentage) { + String name = "valid-steps-" + UUID.randomUUID(); + TrafficRoutingConfig traffic = trafficStep(mode, percentage, 0); + try (CodeDeployClient client = AwsTestClients.create( + CodeDeployClient.builder(), "000000000000", Region.US_EAST_1)) { + client.createDeploymentConfig(request -> request.deploymentConfigName(name) + .computePlatform("Lambda").trafficRoutingConfig(traffic)); + try { + assertEquals(traffic, client.getDeploymentConfig(request -> request.deploymentConfigName(name)) + .deploymentConfigInfo().trafficRoutingConfig()); + } finally { + client.deleteDeploymentConfig(request -> request.deploymentConfigName(name)); + } + } + } + + private static TrafficRoutingConfig trafficStep(String mode, int percentage, int interval) { + TrafficRoutingConfig.Builder traffic = TrafficRoutingConfig.builder().type("TimeBased" + mode); + if ("Canary".equals(mode)) { + traffic.timeBasedCanary(step -> step.canaryPercentage(percentage).canaryInterval(interval)); + } else { + traffic.timeBasedLinear(step -> step.linearPercentage(percentage).linearInterval(interval)); + } + return traffic.build(); + } + @Test @Order(1) void listDeploymentConfigsIncludesBuiltIns() { diff --git a/src/test/resources/cloudformation/schema-surface.tsv b/src/test/resources/cloudformation/schema-surface.tsv index 1fe17c46b7..17d887fdea 100644 --- a/src/test/resources/cloudformation/schema-surface.tsv +++ b/src/test/resources/cloudformation/schema-surface.tsv @@ -65,6 +65,7 @@ AWS::CloudWatch::CompositeAlarm Arn ActionConfiguration,ActionsEnabled,ActionsSu AWS::CloudWatch::Dashboard DashboardBody,DashboardName,Tags AWS::CodeBuild::Project Arn Artifacts,AutoRetryLimit,BadgeEnabled,BuildBatchConfig,Cache,ConcurrentBuildLimit,Description,EncryptionKey,Environment,FileSystemLocations,LogsConfig,Name,QueuedTimeoutInMinutes,ResourceAccessRole,SecondaryArtifacts,SecondarySourceVersions,SecondarySources,ServiceRole,Source,SourceVersion,Tags,TimeoutInMinutes,Triggers,Visibility,VpcConfig AWS::CodeDeploy::Application ApplicationName,ComputePlatform,Tags +AWS::CodeDeploy::DeploymentConfig ComputePlatform,DeploymentConfigName,MinimumHealthyHosts,TrafficRoutingConfig,ZonalConfig AWS::CodePipeline::CustomActionType Id Category,ConfigurationProperties,InputArtifactDetails,OutputArtifactDetails,Provider,Settings,Tags,Version AWS::CodePipeline::Pipeline Arn,Version ArtifactStore,ArtifactStores,DisableInboundStageTransitions,ExecutionMode,Name,PipelineType,RestartExecutionOnUpdate,RoleArn,Stages,Tags,Triggers,Variables AWS::CodePipeline::Webhook Id,Url Authentication,AuthenticationConfiguration,Filters,Name,RegisterWithThirdParty,Tags,TargetAction,TargetPipeline,TargetPipelineVersion @@ -197,7 +198,7 @@ AWS::Route53::HealthCheck HealthCheckId HealthCheckConfig,HealthCheckTags AWS::Route53::HostedZone Id,NameServers DelegationSetId,HostedZoneConfig,HostedZoneFeatures,HostedZoneTags,Name,QueryLoggingConfig,VPCs AWS::Route53::RecordSet AZAffinity,AliasTarget,CidrRoutingConfig,Comment,Failover,GeoLocation,HealthCheckId,HostedZoneId,HostedZoneName,MultiValueAnswer,Name,Region,ResourceRecords,SetIdentifier,TTL,Type,Weight AWS::Route53::RecordSetGroup Id Comment,HostedZoneId,HostedZoneName,RecordSets -AWS::S3::Bucket Arn,DomainName,DualStackDomainName,RegionalDomainName,WebsiteURL AbacStatus,AccelerateConfiguration,AccessControl,AnalyticsConfigurations,BucketEncryption,BucketName,BucketNamePrefix,BucketNamespace,CorsConfiguration,IntelligentTieringConfigurations,InventoryConfigurations,LifecycleConfiguration,LoggingConfiguration,MetadataConfiguration,MetadataTableConfiguration,MetricsConfigurations,NotificationConfiguration,ObjectLockConfiguration,ObjectLockEnabled,OwnershipControls,PublicAccessBlockConfiguration,ReplicationConfiguration,Tags,VersioningConfiguration,WebsiteConfiguration +AWS::S3::Bucket Arn,DomainName,DualStackDomainName,RegionalDomainName,WebsiteURL AbacStatus,AccelerateConfiguration,AccessControl,AnalyticsConfigurations,BucketEncryption,BucketName,BucketNamePrefix,BucketNamespace,CorsConfiguration,DefaultStorageClass,IntelligentTieringConfigurations,InventoryConfigurations,LifecycleConfiguration,LoggingConfiguration,MetadataConfiguration,MetadataTableConfiguration,MetricsConfigurations,NotificationConfiguration,ObjectLockConfiguration,ObjectLockEnabled,OwnershipControls,PublicAccessBlockConfiguration,ReplicationConfiguration,Tags,VersioningConfiguration,WebsiteConfiguration AWS::S3::BucketPolicy Bucket,PolicyDocument AWS::S3Vectors::Index CreationTime,IndexArn DataType,Dimension,DistanceMetric,EncryptionConfiguration,IndexName,MetadataConfiguration,Tags,VectorBucketArn,VectorBucketName AWS::S3Vectors::VectorBucket CreationTime,VectorBucketArn EncryptionConfiguration,Tags,VectorBucketName diff --git a/src/test/resources/cloudformation/supported-resource-types.tsv b/src/test/resources/cloudformation/supported-resource-types.tsv index 759cea17d1..92c0b94e76 100644 --- a/src/test/resources/cloudformation/supported-resource-types.tsv +++ b/src/test/resources/cloudformation/supported-resource-types.tsv @@ -66,6 +66,7 @@ AWS::CloudWatch::CompositeAlarm CloudWatchCompositeAlarmCfnProvisioner AWS::CloudWatch::Dashboard CloudWatchDashboardCfnProvisioner AWS::CodeBuild::Project CodeBuildCfnProvisioner AWS::CodeDeploy::Application CodeDeployCfnProvisioner +AWS::CodeDeploy::DeploymentConfig CodeDeployCfnProvisioner AWS::CodePipeline::CustomActionType CodePipelineCfnProvisioner AWS::CodePipeline::Pipeline CodePipelineCfnProvisioner AWS::CodePipeline::Webhook CodePipelineCfnProvisioner diff --git a/src/test/resources/cloudformation/writable-property-gaps.tsv b/src/test/resources/cloudformation/writable-property-gaps.tsv index 3280a077b6..4aaf2f733e 100644 --- a/src/test/resources/cloudformation/writable-property-gaps.tsv +++ b/src/test/resources/cloudformation/writable-property-gaps.tsv @@ -588,6 +588,7 @@ AWS::S3::Bucket AbacStatus accepted and ignored AWS::S3::Bucket AccelerateConfiguration silently dropped, as the S3CfnProvisioner javadoc records AWS::S3::Bucket AccessControl silently dropped, as the S3CfnProvisioner javadoc records AWS::S3::Bucket AnalyticsConfigurations silently dropped, as the S3CfnProvisioner javadoc records +AWS::S3::Bucket DefaultStorageClass The S3 provisioner does not apply a default storage class to the bucket. AWS::S3::Bucket IntelligentTieringConfigurations silently dropped, as the S3CfnProvisioner javadoc records AWS::S3::Bucket InventoryConfigurations silently dropped, as the S3CfnProvisioner javadoc records AWS::S3::Bucket LoggingConfiguration silently dropped, as the S3CfnProvisioner javadoc records