<commit_before>package awsrules

import (
	"fmt"
	"log"
	"sort"
	"strings"

	hcl "github.com/hashicorp/hcl/v2"
	"github.com/terraform-linters/tflint/tflint"
)

// AwsResourceMissingTagsRule checks whether the resource is tagged correctly
type AwsResourceMissingTagsRule struct {
	resourceTypes []string
}

type awsResourceTagsRuleConfig struct {
	Tags []string `hcl:"tags"`
}

// NewAwsResourceMissingTagsRule returns new rules for all resources that support tags
func NewAwsResourceMissingTagsRule() *AwsResourceMissingTagsRule {
	resourceTypes := []string{
		"aws_accessanalyzer_analyzer",
		"aws_acm_certificate",
		"aws_acmpca_certificate_authority",
		"aws_alb",
		"aws_alb_target_group",
		"aws_ami",
		"aws_ami_copy",
		"aws_ami_from_instance",
		"aws_api_gateway_api_key",
		"aws_api_gateway_client_certificate",
		"aws_api_gateway_domain_name",
		"aws_api_gateway_rest_api",
		"aws_api_gateway_stage",
		"aws_api_gateway_usage_plan",
		"aws_api_gateway_vpc_link",
		"aws_appmesh_mesh",
		"aws_appmesh_route",
		"aws_appmesh_virtual_node",
		"aws_appmesh_virtual_router",
		"aws_appmesh_virtual_service",
		"aws_appsync_graphql_api",
		"aws_athena_workgroup",
		"aws_autoscaling_group",
		"aws_backup_plan",
		"aws_backup_vault",
		"aws_cloudformation_stack",
		"aws_cloudformation_stack_set",
		"aws_cloudfront_distribution",
		"aws_cloudhsm_v2_cluster",
		"aws_cloudtrail",
		"aws_cloudwatch_event_rule",
		"aws_cloudwatch_log_group",
		"aws_cloudwatch_metric_alarm",
		"aws_codebuild_project",
		"aws_codecommit_repository",
		"aws_codepipeline",
		"aws_codepipeline_webhook",
		"aws_codestarnotifications_notification_rule",
		"aws_cognito_identity_pool",
		"aws_cognito_user_pool",
		"aws_config_aggregate_authorization",
		"aws_config_config_rule",
		"aws_config_configuration_aggregator",
		"aws_customer_gateway",
		"aws_datapipeline_pipeline",
		"aws_datasync_agent",
		"aws_datasync_location_efs",
		"aws_datasync_location_nfs",
		"aws_datasync_location_s3",
		"aws_datasync_location_smb",
		"aws_datasync_task",
		"aws_dax_cluster",
		"aws_db_cluster_snapshot",
		"aws_db_event_subscription",
		"aws_db_instance",
		"aws_db_option_group",
		"aws_db_parameter_group",
		"aws_db_security_group",
		"aws_db_snapshot",
		"aws_db_subnet_group",
		"aws_default_network_acl",
		"aws_default_route_table",
		"aws_default_security_group",
		"aws_default_subnet",
		"aws_default_vpc",
		"aws_default_vpc_dhcp_options",
		"aws_directory_service_directory",
		"aws_dlm_lifecycle_policy",
		"aws_dms_endpoint",
		"aws_dms_replication_instance",
		"aws_dms_replication_subnet_group",
		"aws_dms_replication_task",
		"aws_docdb_cluster",
		"aws_docdb_cluster_instance",
		"aws_docdb_cluster_parameter_group",
		"aws_docdb_subnet_group",
		"aws_dx_connection",
		"aws_dx_hosted_private_virtual_interface_accepter",
		"aws_dx_hosted_public_virtual_interface_accepter",
		"aws_dx_hosted_transit_virtual_interface_accepter",
		"aws_dx_lag",
		"aws_dx_private_virtual_interface",
		"aws_dx_public_virtual_interface",
		"aws_dx_transit_virtual_interface",
		"aws_dynamodb_table",
		"aws_ebs_snapshot",
		"aws_ebs_snapshot_copy",
		"aws_ebs_volume",
		"aws_ec2_capacity_reservation",
		"aws_ec2_client_vpn_endpoint",
		"aws_ec2_fleet",
		"aws_ec2_transit_gateway",
		"aws_ec2_transit_gateway_route_table",
		"aws_ec2_transit_gateway_vpc_attachment",
		"aws_ec2_transit_gateway_vpc_attachment_accepter",
		"aws_ecr_repository",
		"aws_ecs_capacity_provider",
		"aws_ecs_cluster",
		"aws_ecs_service",
		"aws_ecs_task_definition",
		"aws_efs_file_system",
		"aws_eip",
		"aws_eks_cluster",
		"aws_eks_fargate_profile",
		"aws_eks_node_group",
		"aws_elastic_beanstalk_application",
		"aws_elastic_beanstalk_application_version",
		"aws_elastic_beanstalk_environment",
		"aws_elasticache_cluster",
		"aws_elasticache_replication_group",
		"aws_elasticsearch_domain",
		"aws_elb",
		"aws_emr_cluster",
		"aws_fsx_lustre_file_system",
		"aws_fsx_windows_file_system",
		"aws_gamelift_alias",
		"aws_gamelift_build",
		"aws_gamelift_fleet",
		"aws_gamelift_game_session_queue",
		"aws_glacier_vault",
		"aws_glue_crawler",
		"aws_glue_job",
		"aws_glue_trigger",
		"aws_iam_role",
		"aws_iam_user",
		"aws_inspector_resource_group",
		"aws_instance",
		"aws_internet_gateway",
		"aws_key_pair",
		"aws_kinesis_analytics_application",
		"aws_kinesis_firehose_delivery_stream",
		"aws_kinesis_stream",
		"aws_kms_external_key",
		"aws_kms_key",
		"aws_lambda_function",
		"aws_launch_template",
		"aws_lb",
		"aws_lb_target_group",
		"aws_licensemanager_license_configuration",
		"aws_lightsail_instance",
		"aws_media_convert_queue",
		"aws_media_package_channel",
		"aws_media_store_container",
		"aws_mq_broker",
		"aws_mq_configuration",
		"aws_msk_cluster",
		"aws_nat_gateway",
		"aws_neptune_cluster",<commit_msg>go run ./tags-gen<commit_after>package awsrules

import (
	"fmt"
	"log"
	"sort"
	"strings"

	hcl "github.com/hashicorp/hcl/v2"
	"github.com/terraform-linters/tflint/tflint"
)

// AwsResourceMissingTagsRule checks whether the resource is tagged correctly
type AwsResourceMissingTagsRule struct {
	resourceTypes []string
}

type awsResourceTagsRuleConfig struct {
	Tags []string `hcl:"tags"`
}

// NewAwsResourceMissingTagsRule returns new rules for all resources that support tags
func NewAwsResourceMissingTagsRule() *AwsResourceMissingTagsRule {
	resourceTypes := []string{
		"aws_accessanalyzer_analyzer",
		"aws_acm_certificate",
		"aws_acmpca_certificate_authority",
		"aws_alb",
		"aws_alb_target_group",
		"aws_ami",
		"aws_ami_copy",
		"aws_ami_from_instance",
		"aws_api_gateway_api_key",
		"aws_api_gateway_client_certificate",
		"aws_api_gateway_domain_name",
		"aws_api_gateway_rest_api",
		"aws_api_gateway_stage",
		"aws_api_gateway_usage_plan",
		"aws_api_gateway_vpc_link",
		"aws_apigatewayv2_api",
		"aws_appmesh_mesh",
		"aws_appmesh_route",
		"aws_appmesh_virtual_node",
		"aws_appmesh_virtual_router",
		"aws_appmesh_virtual_service",
		"aws_appsync_graphql_api",
		"aws_athena_workgroup",
		"aws_autoscaling_group",
		"aws_backup_plan",
		"aws_backup_vault",
		"aws_cloud9_environment_ec2",
		"aws_cloudformation_stack",
		"aws_cloudformation_stack_set",
		"aws_cloudfront_distribution",
		"aws_cloudhsm_v2_cluster",
		"aws_cloudtrail",
		"aws_cloudwatch_event_rule",
		"aws_cloudwatch_log_group",
		"aws_cloudwatch_metric_alarm",
		"aws_codebuild_project",
		"aws_codecommit_repository",
		"aws_codepipeline",
		"aws_codepipeline_webhook",
		"aws_codestarnotifications_notification_rule",
		"aws_cognito_identity_pool",
		"aws_cognito_user_pool",
		"aws_config_aggregate_authorization",
		"aws_config_config_rule",
		"aws_config_configuration_aggregator",
		"aws_customer_gateway",
		"aws_datapipeline_pipeline",
		"aws_datasync_agent",
		"aws_datasync_location_efs",
		"aws_datasync_location_nfs",
		"aws_datasync_location_s3",
		"aws_datasync_location_smb",
		"aws_datasync_task",
		"aws_dax_cluster",
		"aws_db_cluster_snapshot",
		"aws_db_event_subscription",
		"aws_db_instance",
		"aws_db_option_group",
		"aws_db_parameter_group",
		"aws_db_security_group",
		"aws_db_snapshot",
		"aws_db_subnet_group",
		"aws_default_network_acl",
		"aws_default_route_table",
		"aws_default_security_group",
		"aws_default_subnet",
		"aws_default_vpc",
		"aws_default_vpc_dhcp_options",
		"aws_directory_service_directory",
		"aws_dlm_lifecycle_policy",
		"aws_dms_endpoint",
		"aws_dms_replication_instance",
		"aws_dms_replication_subnet_group",
		"aws_dms_replication_task",
		"aws_docdb_cluster",
		"aws_docdb_cluster_instance",
		"aws_docdb_cluster_parameter_group",
		"aws_docdb_subnet_group",
		"aws_dx_connection",
		"aws_dx_hosted_private_virtual_interface_accepter",
		"aws_dx_hosted_public_virtual_interface_accepter",
		"aws_dx_hosted_transit_virtual_interface_accepter",
		"aws_dx_lag",
		"aws_dx_private_virtual_interface",
		"aws_dx_public_virtual_interface",
		"aws_dx_transit_virtual_interface",
		"aws_dynamodb_table",
		"aws_ebs_snapshot",
		"aws_ebs_snapshot_copy",
		"aws_ebs_volume",
		"aws_ec2_capacity_reservation",
		"aws_ec2_client_vpn_endpoint",
		"aws_ec2_fleet",
		"aws_ec2_traffic_mirror_filter",
		"aws_ec2_traffic_mirror_session",
		"aws_ec2_traffic_mirror_target",
		"aws_ec2_transit_gateway",
		"aws_ec2_transit_gateway_route_table",
		"aws_ec2_transit_gateway_vpc_attachment",
		"aws_ec2_transit_gateway_vpc_attachment_accepter",
		"aws_ecr_repository",
		"aws_ecs_capacity_provider",
		"aws_ecs_cluster",
		"aws_ecs_service",
		"aws_ecs_task_definition",
		"aws_efs_file_system",
		"aws_eip",
		"aws_eks_cluster",
		"aws_eks_fargate_profile",
		"aws_eks_node_group",
		"aws_elastic_beanstalk_application",
		"aws_elastic_beanstalk_application_version",
		"aws_elastic_beanstalk_environment",
		"aws_elasticache_cluster",
		"aws_elasticache_replication_group",
		"aws_elasticsearch_domain",
		"aws_elb",
		"aws_emr_cluster",
		"aws_flow_log",
		"aws_fsx_lustre_file_system",
		"aws_fsx_windows_file_system",
		"aws_gamelift_alias",
		"aws_gamelift_build",
		"aws_gamelift_fleet",
		"aws_gamelift_game_session_queue",
		"aws_glacier_vault",
		"aws_globalaccelerator_accelerator",
		"aws_glue_crawler",
		"aws_glue_job",
		"aws_glue_trigger",
		"aws_iam_role",
		"aws_iam_user",
		"aws_inspector_resource_group",
		"aws_instance",
		"aws_internet_gateway",
		"aws_key_pair",
		"aws_kinesis_analytics_application",
		"aws_kinesis_firehose_delivery_stream",
		"aws_kinesis_stream",
		"aws_kms_external_key",
		"aws_kms_key",
		"aws_lambda_function",
		"aws_launch_template",
		"aws_lb",
		"aws_lb_target_group",
		"aws_licensemanager_license_configuration",
		"aws_lightsail_instance",
		"aws_media_convert_queue",
		"aws_media_package_channel",
		"aws_media_store_container",
		"aws_mq_broker",
		"aws_mq_configuration",
		"aws_msk_cluster",
		"aws_nat_gateway",
		"aws_neptune_cluster",
{'fraction_non_alphanumeric': 0.10322056283653358, 'fraction_numerical': 0.002641471096210505, 'mean_word_length': 8.157209302325581, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3423230', 'n_tokens_mistral': 4292, 'n_tokens_neox': 3956, 'n_words': 392}