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

[CustomDbEngineVersion] Add new parameters in CEV #478

Closed

Conversation

0ooopsFibby
Copy link

@0ooopsFibby 0ooopsFibby commented Oct 25, 2023

Issue #, if available: N / A

Description of changes:

Latest AWS RDS SDK has added three optional parameters for CEV model and originally required field is now no longer compulsory. This PR is to add the additional parameters to CFN accordingly.

Tests:

  • unit tests covered by default (doesn't require changes as it was generated based on model)
  • contract tests have passed locally
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{ "TypeName": "AWS::RDS::CustomDBEngineVersion", "Bucket": "jiayuwa-cfn", "Key": "aws-service-resource-cev.zip", "TestDetails":["TestCreate,test_create_list", "TestCreate,test_create_create", "TestRead,test_governance", "TestRead,test_read_return_write_only_properties", "TestRead,test_read_return_readonly_properties", "TestDelete,test_delete_read", "TestDelete,test_delete_delete", "TestDelete,test_delete_list", "TestUpdate,test_update_read", "TestUpdate,test_update_list", "TestRead,test_read_return_all_schema_properties_using_one_or_more_inputs"] }' 

test_read_input_output_negative_match from contract test doesn't apply for the API, this is because some parameters are not supposed to be used together (e.g. S3 bucket and source CEV). This particular test will fail with below if enabled.

"Invalid Inputs: not all the properties defined in the schema are specified": true

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@0ooopsFibby 0ooopsFibby marked this pull request as ready for review October 25, 2023 07:00
@@ -27,6 +27,9 @@ public static CreateCustomDbEngineVersionRequest createCustomDbEngineVersionRequ
.description(model.getDescription())
.engine(model.getEngine())
.engineVersion(model.getEngineVersion())
.sourceCustomDbEngineVersionIdentifier(model.getSourceCustomDBEngineVersionIdentifier())
.useAwsProvidedLatestImage(model.getUseAwsProvidedLatestImage())
.imageId(model.getImageId())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These attributes are returned in the DescribeDBEngine response. You should also include them in the translateFromSdk method in the Translator. This way, CFN will be aware that they have been applied.

@@ -27,6 +27,9 @@ public static CreateCustomDbEngineVersionRequest createCustomDbEngineVersionRequ
.description(model.getDescription())
.engine(model.getEngine())
.engineVersion(model.getEngineVersion())
.sourceCustomDbEngineVersionIdentifier(model.getSourceCustomDBEngineVersionIdentifier())
.useAwsProvidedLatestImage(model.getUseAwsProvidedLatestImage())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this parameter is not included in the describe response, you should designate it as a write-only parameter in the resource schema. Otherwise, it will consistently result in false drift.

However, if it is returned in the describe response, you should also include it in the translateFromSdk function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are write-only / create-only attributes. I'll add them to lists. Thanks for the reminder!

@@ -27,6 +27,9 @@ public static CreateCustomDbEngineVersionRequest createCustomDbEngineVersionRequ
.description(model.getDescription())
.engine(model.getEngine())
.engineVersion(model.getEngineVersion())
.sourceCustomDbEngineVersionIdentifier(model.getSourceCustomDBEngineVersionIdentifier())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same applies here.

Copy link
Collaborator

@moataz-mhmd moataz-mhmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm there no extra permission needed for this operation beside existing permissions.

                - "kms:CreateGrant"
                - "kms:DescribeKey"
                - "mediaimport:CreateDatabaseBinarySnapshot"
                - "rds:AddTagsToResource"
                - "rds:CreateCustomDBEngineVersion"
                - "rds:DeleteCustomDBEngineVersion"
                - "rds:DescribeDBEngineVersions"
                - "rds:ModifyCustomDBEngineVersion"
                - "rds:RemoveTagsFromResource"
                - "s3:CreateBucket"
                - "s3:GetObject"
                - "s3:GetObjectAcl"
                - "s3:GetObjectTagging"
                - "s3:ListBucket"
                - "s3:PutBucketObjectLockConfiguration"
                - "s3:PutBucketPolicy"
                - "s3:PutBucketVersioning"

Copy link
Collaborator

@moataz-mhmd moataz-mhmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you kindly confirm if all possible exceptions have been taken care of?

if the SourceCustomDBEngineVersionIdentifier or ImageId is not found or in an inappropriate state for the operation, what specific exceptions will be thrown?

Moreover, It will need to be associated with a recognized error from CloudFormation by adding it to the CreateHandler error role set, otherwise It will lead to an internal failure on the customer's end.

@0ooopsFibby
Copy link
Author

Can you kindly confirm if all possible exceptions have been taken care of?

if the SourceCustomDBEngineVersionIdentifier or ImageId is not found or in an inappropriate state for the operation, what specific exceptions will be thrown?

Moreover, It will need to be associated with a recognized error from CloudFormation by adding it to the CreateHandler error role set, otherwise It will lead to an internal failure on the customer's end.

Yes I checked exceptions that could be thrown from the latest change, all have been covered by existing CreateHandler exceptions:

  • InvalidParameterValue
  • InvalidParameterCombination
  • AccessDenied
  • KMSKeyNotAccessibleFault

@0ooopsFibby
Copy link
Author

  • "s3:GetObject"

Thanks for the reminder! I do need to add additional permissions.

@zrfr
Copy link
Collaborator

zrfr commented Jun 5, 2024

Superseded by #515

@zrfr zrfr closed this Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants