Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

add KmsMasterKeyId col to sns resource #309

Merged
merged 4 commits into from
Nov 29, 2021
Merged
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
1 change: 1 addition & 0 deletions client/mocks/builders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ func buildSnsTopics(t *testing.T, ctrl *gomock.Controller) client.Services {
"FifoTopic": "false",
"ContentBasedDeduplication": "true",
"DisplayName": "cloudquery",
"KmsMasterKeyId": "test/key",
"Owner": "owner",
"Policy": `{"stuff": 3}`,
"DeliveryPolicy": `{"stuff": 3}`,
Expand Down
1 change: 1 addition & 0 deletions docs/tables/aws_sns_topics.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ AWS SNS topic
|effective_delivery_policy|jsonb|The JSON serialization of the effective delivery policy, taking system defaults into account.|
|fifo_topic|boolean|When this is set to true, a FIFO topic is created.|
|content_based_deduplication|boolean|Enables content-based deduplication for FIFO topics.|
|kms_master_key_id|text|The ID of an AWS managed customer master key (CMK) for Amazon SNS or a custom CMK|
|arn|text|The topic's ARN.|
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ ALTER TABLE IF EXISTS "aws_directconnect_gateway_associations" RENAME COLUMN "ga
ALTER TABLE IF EXISTS "aws_directconnect_gateway_attachments" DROP COLUMN "gateway_id";

ALTER TABLE IF EXISTS "aws_elbv2_listeners" DROP COLUMN "load_balancer_cq_id";

ALTER TABLE IF EXISTS "aws_sns_topics" DROP COLUMN kms_master_key_id;
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ALTER TABLE IF EXISTS "aws_iam_password_policies" ADD COLUMN policy_exists boolean;


ALTER TABLE IF EXISTS "aws_directconnect_gateways" RENAME COLUMN "direct_connect_gateway_state" TO "state";

ALTER TABLE IF EXISTS "aws_directconnect_gateways" RENAME COLUMN "direct_connect_gateway_name" TO "name";
Expand All @@ -13,5 +12,6 @@ ALTER TABLE IF EXISTS "aws_directconnect_gateway_associations" RENAME COLUMN "di

ALTER TABLE IF EXISTS "aws_directconnect_gateway_attachments" ADD COLUMN "gateway_id" text;


ALTER TABLE IF EXISTS "aws_elbv2_listeners" ADD COLUMN "load_balancer_cq_id" uuid;

ALTER TABLE IF EXISTS "aws_sns_topics" ADD COLUMN kms_master_key_id text;
10 changes: 10 additions & 0 deletions resources/sns_topics.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ func SnsTopics() *schema.Table {
Description: "Enables content-based deduplication for FIFO topics.",
Type: schema.TypeBool,
},
{
Name: "kms_master_key_id",
Description: "The ID of an AWS managed customer master key (CMK) for Amazon SNS or a custom CMK",
Type: schema.TypeString,
},
{
Name: "arn",
Description: "The topic's ARN.",
Expand Down Expand Up @@ -172,6 +177,11 @@ func resolveTopicAttributes(ctx context.Context, meta schema.ClientMeta, resourc
return err
}
}
if p, ok := output.Attributes["KmsMasterKeyId"]; ok && p != "" {
if err := resource.Set("kms_master_key_id", p); err != nil {
return err
}
}

return nil
}