Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DBCluster] Support EnableHttpEndpoint for Aurora MySQL engine to support Data Api #569

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aws-rds-dbcluster/aws-rds-dbcluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
"/properties/DBClusterIdentifier": "$lowercase(DBClusterIdentifier)",
"/properties/DBClusterParameterGroupName": "$lowercase(DBClusterParameterGroupName)",
"/properties/DBSubnetGroupName": "$lowercase(DBSubnetGroupName)",
"/properties/EnableHttpEndpoint": "$lowercase($string(EngineMode)) = 'serverless' ? EnableHttpEndpoint : ($lowercase($string(Engine)) = 'aurora-postgresql' ? EnableHttpEndpoint : false )",
"/properties/EnableHttpEndpoint": "$lowercase($string(EngineMode)) = 'serverless' ? EnableHttpEndpoint : ($lowercase($string(Engine)) in ['aurora-postgresql', 'aurora-mysql'] ? EnableHttpEndpoint : false )",
"/properties/Engine": "$lowercase(Engine)",
"/properties/EngineVersion": "$join([$string(EngineVersion), \".*\"])",
"/properties/KmsKeyId": "$join([\"arn:(aws)[-]{0,1}[a-z]{0,2}[-]{0,1}[a-z]{0,3}:kms:[a-z]{2}[-]{1}[a-z]{3,10}[-]{0,1}[a-z]{0,10}[-]{1}[1-3]{1}:[0-9]{12}[:]{1}key\\/\", KmsKeyId])",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
public abstract class BaseHandlerStd extends BaseHandler<CallbackContext> {
public static final String RESOURCE_IDENTIFIER = "dbcluster";
public static final String ENGINE_AURORA_POSTGRESQL = "aurora-postgresql";
public static final String ENGINE_AURORA_MYSQL = "aurora-mysql";
private static final String MASTER_USER_SECRET_ACTIVE = "active";
protected static final String DB_CLUSTER_REQUEST_STARTED_AT = "dbcluster-request-started-at";
protected static final String DB_CLUSTER_REQUEST_IN_PROGRESS_AT = "dbcluster-request-in-progress-at";
Expand Down Expand Up @@ -729,7 +730,7 @@ protected boolean shouldSetDefaultVpcSecurityGroupIds(final ResourceModel previo
}

protected boolean shouldUpdateHttpEndpointV2(final ResourceModel previousState, final ResourceModel desiredState) {
return ENGINE_AURORA_POSTGRESQL.equalsIgnoreCase(desiredState.getEngine()) &&
return (ENGINE_AURORA_POSTGRESQL.equalsIgnoreCase(desiredState.getEngine()) || ENGINE_AURORA_MYSQL.equalsIgnoreCase(desiredState.getEngine())) &&
!EngineMode.Serverless.equals(EngineMode.fromString(desiredState.getEngineMode())) &&
ObjectUtils.notEqual(previousState.getEnableHttpEndpoint(), desiredState.getEnableHttpEndpoint());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ void testDrift_EnableHttpEndpoint_Aurora_Postgresql_Drifted() {
}).isInstanceOf(AssertionError.class);
}

@Test
void testDrift_EnableHttpEndpoint_Aurora_Mysql_Drifted() {
final ResourceModel input = ResourceModel.builder()
.enableHttpEndpoint(true)
.engine("aurora-mysql")
.build();
final ResourceModel output = ResourceModel.builder()
.enableHttpEndpoint(false)
.engine("aurora-mysql")
.build();
Assertions.assertThatThrownBy(() -> {
assertResourceNotDrifted(input, output, resourceSchema);
}).isInstanceOf(AssertionError.class);
}

@Test
void testDrift_EnableHttpEndpoint_Provisioned() {
final ResourceModel input = ResourceModel.builder()
Expand Down
Loading