Skip to content

Commit

Permalink
Use new group override generation script
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Bush <[email protected]>
  • Loading branch information
mbbush committed Jul 17, 2024
1 parent 3a69d9a commit 1e919bb
Showing 1 changed file with 41 additions and 13 deletions.
54 changes: 41 additions & 13 deletions config/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ func ReplaceGroupWords(group string, count int) GroupKindCalculator {
// GroupMap contains all overrides we'd like to make to the default group search.
// It's written with data from TF Provider AWS repo service grouping in here:
// https://github.com/hashicorp/terraform-provider-aws/tree/main/internal/service
// which is itself based on the AWS Go SDK.
//
// At the end, all of them are based on grouping of the AWS Go SDK.
// The initial grouping is calculated based on folder grouping of AWS TF Provider
// which is based on Go SDK. Here is the script used to fetch that list:
// https://gist.github.com/muvaf/8d61365ffc1df7757864422ba16d7819
// The map is generated by using the shell and python scripts in the `scripts` directory.
var GroupMap = map[string]GroupKindCalculator{
"aws_alb_listener_certificate": ReplaceGroupWords("elbv2", 0),
"aws_alb_listener_rule": ReplaceGroupWords("elbv2", 0),
Expand Down Expand Up @@ -98,25 +96,28 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_cloudwatch_event_bus_policy": ReplaceGroupWords("cloudwatchevents", 2),
"aws_cloudwatch_event_bus": ReplaceGroupWords("cloudwatchevents", 2),
"aws_cloudwatch_event_connection": ReplaceGroupWords("cloudwatchevents", 2),
"aws_cloudwatch_event_endpoint": ReplaceGroupWords("cloudwatchevents", 2),
"aws_cloudwatch_event_permission": ReplaceGroupWords("cloudwatchevents", 2),
"aws_cloudwatch_event_rule": ReplaceGroupWords("cloudwatchevents", 2),
"aws_cloudwatch_event_target": ReplaceGroupWords("cloudwatchevents", 2),
"aws_cloudwatch_log_data_protection_policy": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_log_destination_policy": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_log_destination": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_log_group": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_log_metric_filter": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_log_resource_policy": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_log_stream": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_log_subscription_filter": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_query_definition": ReplaceGroupWords("cloudwatchlogs", 2),
"aws_cloudwatch_query_definition": ReplaceGroupWords("cloudwatchlogs", 1),
"aws_codedeploy_app": ReplaceGroupWords("deploy", 1),
"aws_codedeploy_deployment_config": ReplaceGroupWords("deploy", 1),
"aws_codedeploy_deployment_group": ReplaceGroupWords("deploy", 1),
"aws_codepipeline": ReplaceGroupWords("codepipeline", 0),
"aws_cognito_identity_pool_provider_principal_tag": ReplaceGroupWords("cognitoidentity", 0),
"aws_cognito_identity_pool_provider_principal_tag": ReplaceGroupWords("cognitoidentity", 2),
"aws_cognito_identity_pool_roles_attachment": ReplaceGroupWords("cognitoidentity", 2),
"aws_cognito_identity_pool": ReplaceGroupWords("cognitoidentity", 2),
"aws_cognito_identity_provider": ReplaceGroupWords("cognitoidp", 1),
"aws_cognito_managed_user_pool_client": ReplaceGroupWords("cognitoidp", 1),
"aws_cognito_resource_server": ReplaceGroupWords("cognitoidp", 1),
"aws_cognito_risk_configuration": ReplaceGroupWords("cognitoidp", 1),
"aws_cognito_user_group": ReplaceGroupWords("cognitoidp", 1),
Expand All @@ -134,13 +135,15 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_config_conformance_pack": ReplaceGroupWords("configservice", 1),
"aws_config_delivery_channel": ReplaceGroupWords("configservice", 1),
"aws_config_organization_conformance_pack": ReplaceGroupWords("configservice", 1),
"aws_config_organization_custom_policy_rule": ReplaceGroupWords("configservice", 1),
"aws_config_organization_custom_rule": ReplaceGroupWords("configservice", 1),
"aws_config_organization_managed_rule": ReplaceGroupWords("configservice", 1),
"aws_config_remediation_configuration": ReplaceGroupWords("configservice", 1),
"aws_config_retention_configuration": ReplaceGroupWords("configservice", 1),
"aws_customer_gateway": ReplaceGroupWords("ec2", 0),
"aws_db_cluster_snapshot": ReplaceGroupWords("rds", 1),
"aws_db_event_subscription": ReplaceGroupWords("rds", 1),
"aws_db_instance_automated_backups_replication": ReplaceGroupWords("rds", 0),
"aws_db_instance_automated_backups_replication": ReplaceGroupWords("rds", 1),
"aws_db_instance_role_association": ReplaceGroupWords("rds", 1),
"aws_db_instance": ReplaceGroupWords("rds", 1),
"aws_db_option_group": ReplaceGroupWords("rds", 1),
Expand All @@ -149,7 +152,7 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_db_proxy_endpoint": ReplaceGroupWords("rds", 1),
"aws_db_proxy_target": ReplaceGroupWords("rds", 1),
"aws_db_proxy": ReplaceGroupWords("rds", 1),
"aws_db_snapshot_copy": ReplaceGroupWords("rds", 0),
"aws_db_snapshot_copy": ReplaceGroupWords("rds", 1),
"aws_db_snapshot": ReplaceGroupWords("rds", 1),
"aws_db_subnet_group": ReplaceGroupWords("rds", 1),
"aws_default_network_acl": ReplaceGroupWords("ec2", 0),
Expand All @@ -161,8 +164,11 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_directory_service_conditional_forwarder": ReplaceGroupWords("ds", 2),
"aws_directory_service_directory": ReplaceGroupWords("ds", 2),
"aws_directory_service_log_subscription": ReplaceGroupWords("ds", 2),
"aws_directory_service_radius_settings": ReplaceGroupWords("ds", 2),
"aws_directory_service_region": ReplaceGroupWords("ds", 2),
"aws_directory_service_shared_directory_accepter": ReplaceGroupWords("ds", 2),
"aws_directory_service_shared_directory": ReplaceGroupWords("ds", 2),
"aws_directory_service_trust": ReplaceGroupWords("ds", 2),
"aws_dx_bgp_peer": ReplaceGroupWords("directconnect", 1),
"aws_dx_connection_association": ReplaceGroupWords("directconnect", 1),
"aws_dx_connection_confirmation": ReplaceGroupWords("directconnect", 1),
Expand All @@ -178,11 +184,13 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_dx_hosted_transit_virtual_interface_accepter": ReplaceGroupWords("directconnect", 1),
"aws_dx_hosted_transit_virtual_interface": ReplaceGroupWords("directconnect", 1),
"aws_dx_lag": ReplaceGroupWords("directconnect", 1),
"aws_dx_macsec_key_association": ReplaceGroupWords("directconnect", 0),
"aws_dx_private_virtual_interface": ReplaceGroupWords("directconnect", 1),
"aws_dx_public_virtual_interface": ReplaceGroupWords("directconnect", 1),
"aws_dx_transit_virtual_interface": ReplaceGroupWords("directconnect", 1),
"aws_ebs_default_kms_key": ReplaceGroupWords("ec2", 0),
"aws_ebs_encryption_by_default": ReplaceGroupWords("ec2", 0),
"aws_ebs_fast_snapshot_restore": ReplaceGroupWords("ec2", 0),
"aws_ebs_snapshot_copy": ReplaceGroupWords("ec2", 0),
"aws_ebs_snapshot_import": ReplaceGroupWords("ec2", 0),
"aws_ebs_snapshot": ReplaceGroupWords("ec2", 0),
Expand Down Expand Up @@ -212,6 +220,8 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_lb_ssl_negotiation_policy": ReplaceGroupWords("elb", 0),
"aws_lb_target_group_attachment": ReplaceGroupWords("elbv2", 0),
"aws_lb_target_group": ReplaceGroupWords("elbv2", 0),
"aws_lb_trust_store_revocation": ReplaceGroupWords("elbv2", 0),
"aws_lb_trust_store": ReplaceGroupWords("elbv2", 0),
"aws_lb": ReplaceGroupWords("elbv2", 0),
"aws_lex_bot_alias": ReplaceGroupWords("lexmodels", 1),
"aws_lex_bot": ReplaceGroupWords("lexmodels", 1),
Expand All @@ -225,10 +235,13 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_media_package_channel": ReplaceGroupWords("mediapackage", 2),
"aws_media_store_container_policy": ReplaceGroupWords("mediastore", 2),
"aws_media_store_container": ReplaceGroupWords("mediastore", 2),
"aws_msk_cluster_policy": ReplaceGroupWords("kafka", 1),
"aws_msk_cluster": ReplaceGroupWords("kafka", 1),
"aws_msk_configuration": ReplaceGroupWords("kafka", 1),
"aws_msk_replicator": ReplaceGroupWords("kafka", 1),
"aws_msk_scram_secret_association": ReplaceGroupWords("kafka", 1),
"aws_msk_serverless_cluster": ReplaceGroupWords("kafka", 1),
"aws_msk_vpc_connection": ReplaceGroupWords("kafka", 1),
"aws_mskconnect_connector": ReplaceGroupWords("kafkaconnect", 1),
"aws_mskconnect_custom_plugin": ReplaceGroupWords("kafkaconnect", 1),
"aws_mskconnect_worker_configuration": ReplaceGroupWords("kafkaconnect", 1),
Expand All @@ -242,11 +255,9 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_placement_group": ReplaceGroupWords("ec2", 0),
"aws_prometheus_alert_manager_definition": ReplaceGroupWords("amp", 1),
"aws_prometheus_rule_group_namespace": ReplaceGroupWords("amp", 1),
"aws_prometheus_scraper": ReplaceGroupWords("amp", 1),
"aws_prometheus_workspace": ReplaceGroupWords("amp", 1),
"aws_proxy_protocol_policy": ReplaceGroupWords("elb", 0),
"aws_route_table_association": ReplaceGroupWords("ec2", 0),
"aws_route_table": ReplaceGroupWords("ec2", 0),
"aws_route": ReplaceGroupWords("ec2", 0),
"aws_route53_resolver_dnssec_config": ReplaceGroupWords("route53resolver", 2),
"aws_route53_resolver_endpoint": ReplaceGroupWords("route53resolver", 2),
"aws_route53_resolver_firewall_config": ReplaceGroupWords("route53resolver", 2),
Expand All @@ -258,6 +269,9 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_route53_resolver_query_log_config": ReplaceGroupWords("route53resolver", 2),
"aws_route53_resolver_rule_association": ReplaceGroupWords("route53resolver", 2),
"aws_route53_resolver_rule": ReplaceGroupWords("route53resolver", 2),
"aws_route_table_association": ReplaceGroupWords("ec2", 0),
"aws_route_table": ReplaceGroupWords("ec2", 0),
"aws_route": ReplaceGroupWords("ec2", 0),
"aws_s3_access_point": ReplaceGroupWords("s3control", 1),
"aws_s3_account_public_access_block": ReplaceGroupWords("s3control", 1),
"aws_security_group_rule": ReplaceGroupWords("ec2", 0),
Expand All @@ -273,6 +287,12 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_spot_fleet_request": ReplaceGroupWords("ec2", 0),
"aws_spot_instance_request": ReplaceGroupWords("ec2", 0),
"aws_subnet": ReplaceGroupWords("ec2", 0),
"aws_verifiedaccess_endpoint": ReplaceGroupWords("ec2", 0),
"aws_verifiedaccess_group": ReplaceGroupWords("ec2", 0),
"aws_verifiedaccess_instance_logging_configuration": ReplaceGroupWords("ec2", 0),
"aws_verifiedaccess_instance_trust_provider_attachment": ReplaceGroupWords("ec2", 0),
"aws_verifiedaccess_instance": ReplaceGroupWords("ec2", 0),
"aws_verifiedaccess_trust_provider": ReplaceGroupWords("ec2", 0),
"aws_volume_attachment": ReplaceGroupWords("ec2", 0),
"aws_vpc_dhcp_options_association": ReplaceGroupWords("ec2", 0),
"aws_vpc_dhcp_options": ReplaceGroupWords("ec2", 0),
Expand All @@ -290,15 +310,17 @@ var GroupMap = map[string]GroupKindCalculator{
"aws_vpc_ipam_pool_cidr": ReplaceGroupWords("ec2", 0),
"aws_vpc_ipam_pool": ReplaceGroupWords("ec2", 0),
"aws_vpc_ipam_preview_next_cidr": ReplaceGroupWords("ec2", 0),
"aws_vpc_ipam_resource_discovery_association": ReplaceGroupWords("ec2", 0),
"aws_vpc_ipam_resource_discovery": ReplaceGroupWords("ec2", 0),
"aws_vpc_ipam_scope": ReplaceGroupWords("ec2", 0),
"aws_vpc_ipam": ReplaceGroupWords("ec2", 0),
"aws_vpc_security_group_egress_rule": ReplaceGroupWords("ec2", 0),
"aws_vpc_security_group_ingress_rule": ReplaceGroupWords("ec2", 0),
"aws_vpc_ipv4_cidr_block_association": ReplaceGroupWords("ec2", 0),
"aws_vpc_ipv6_cidr_block_association": ReplaceGroupWords("ec2", 0),
"aws_vpc_peering_connection_accepter": ReplaceGroupWords("ec2", 0),
"aws_vpc_peering_connection_options": ReplaceGroupWords("ec2", 0),
"aws_vpc_peering_connection": ReplaceGroupWords("ec2", 0),
"aws_vpc_security_group_egress_rule": ReplaceGroupWords("ec2", 0),
"aws_vpc_security_group_ingress_rule": ReplaceGroupWords("ec2", 0),
"aws_vpc": ReplaceGroupWords("ec2", 0),
"aws_vpn_connection_route": ReplaceGroupWords("ec2", 0),
"aws_vpn_connection": ReplaceGroupWords("ec2", 0),
Expand All @@ -313,4 +335,10 @@ var KindMap = map[string]string{
"aws_cloudformation_type": "CloudFormationType",
"aws_cloudtrail": "Trail",
"aws_config_configuration_recorder_status": "AWSConfigurationRecorderStatus",
// These would be better unmodified, but they were given non-standard names due to a bug in the
// handwritten GroupMap, and renaming them now would be a breaking change.
"aws_cloudwatch_query_definition": "Definition",
"aws_cognito_identity_pool_provider_principal_tag": "CognitoIdentityPoolProviderPrincipalTag",
"aws_db_instance_automated_backups_replication": "DBInstanceAutomatedBackupsReplication",
"aws_db_snapshot_copy": "DBSnapshotCopy",
}

0 comments on commit 1e919bb

Please sign in to comment.