From 4db554f6ad4ec68b0fd14086de828fadc38d8e54 Mon Sep 17 00:00:00 2001 From: Kazuma Watanabe Date: Sun, 15 Sep 2024 13:11:34 +0000 Subject: [PATCH] Remove rules for dropped resources in AzureRM provider v4 --- docs/README.md | 14 +-- ...gration_runtime_managed_invalid_edition.md | 44 -------- ...on_runtime_managed_invalid_license_type.md | 44 -------- ...nvalid_max_parallel_executions_per_node.md | 42 -------- ...runtime_managed_invalid_number_of_nodes.md | 42 -------- ...db_firewall_rule_invalid_end_ip_address.md | 42 -------- ..._firewall_rule_invalid_start_ip_address.md | 42 -------- .../azurerm_mariadb_server_invalid_version.md | 44 -------- ...ql_firewall_rule_invalid_end_ip_address.md | 42 -------- ..._firewall_rule_invalid_start_ip_address.md | 42 -------- .../azurerm_mysql_server_invalid_version.md | 45 -------- ...zurerm_sql_database_invalid_create_mode.md | 52 --------- ...late_deployment_invalid_deployment_mode.md | 44 -------- ...gration_runtime_managed_invalid_edition.go | 92 ---------------- ...on_runtime_managed_invalid_license_type.go | 92 ---------------- ...nvalid_max_parallel_executions_per_node.go | 82 -------------- ...runtime_managed_invalid_number_of_nodes.go | 82 -------------- ...db_firewall_rule_invalid_end_ip_address.go | 84 --------------- ..._firewall_rule_invalid_start_ip_address.go | 84 --------------- .../azurerm_mariadb_server_invalid_version.go | 92 ---------------- ...ql_firewall_rule_invalid_end_ip_address.go | 84 --------------- ..._firewall_rule_invalid_start_ip_address.go | 84 --------------- .../azurerm_mysql_server_invalid_version.go | 93 ---------------- ...zurerm_sql_database_invalid_create_mode.go | 100 ------------------ ...late_deployment_invalid_deployment_mode.go | 92 ---------------- rules/apispec/generated_rules_test.go | 18 ++-- rules/apispec/provider.go | 12 --- ...ta_factory_integration_runtime_managed.hcl | 9 -- .../azurerm_mariadb_firewall_rule.hcl | 8 -- .../mappings/azurerm_mariadb_server.hcl | 9 -- .../mappings/azurerm_mysql_firewall_rule.hcl | 8 -- .../mappings/azurerm_mysql_server.hcl | 9 -- .../mappings/azurerm_sql_database.hcl | 17 --- .../mappings/azurerm_template_deployment.hcl | 5 - 34 files changed, 10 insertions(+), 1685 deletions(-) delete mode 100644 docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_edition.md delete mode 100644 docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_license_type.md delete mode 100644 docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.md delete mode 100644 docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.md delete mode 100644 docs/rules/azurerm_mariadb_firewall_rule_invalid_end_ip_address.md delete mode 100644 docs/rules/azurerm_mariadb_firewall_rule_invalid_start_ip_address.md delete mode 100644 docs/rules/azurerm_mariadb_server_invalid_version.md delete mode 100644 docs/rules/azurerm_mysql_firewall_rule_invalid_end_ip_address.md delete mode 100644 docs/rules/azurerm_mysql_firewall_rule_invalid_start_ip_address.md delete mode 100644 docs/rules/azurerm_mysql_server_invalid_version.md delete mode 100644 docs/rules/azurerm_sql_database_invalid_create_mode.md delete mode 100644 docs/rules/azurerm_template_deployment_invalid_deployment_mode.md delete mode 100644 rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_edition.go delete mode 100644 rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_license_type.go delete mode 100644 rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.go delete mode 100644 rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.go delete mode 100644 rules/apispec/azurerm_mariadb_firewall_rule_invalid_end_ip_address.go delete mode 100644 rules/apispec/azurerm_mariadb_firewall_rule_invalid_start_ip_address.go delete mode 100644 rules/apispec/azurerm_mariadb_server_invalid_version.go delete mode 100644 rules/apispec/azurerm_mysql_firewall_rule_invalid_end_ip_address.go delete mode 100644 rules/apispec/azurerm_mysql_firewall_rule_invalid_start_ip_address.go delete mode 100644 rules/apispec/azurerm_mysql_server_invalid_version.go delete mode 100644 rules/apispec/azurerm_sql_database_invalid_create_mode.go delete mode 100644 rules/apispec/azurerm_template_deployment_invalid_deployment_mode.go delete mode 100644 tools/apispec-rule-gen/mappings/azurerm_data_factory_integration_runtime_managed.hcl delete mode 100644 tools/apispec-rule-gen/mappings/azurerm_mariadb_firewall_rule.hcl delete mode 100644 tools/apispec-rule-gen/mappings/azurerm_mariadb_server.hcl delete mode 100644 tools/apispec-rule-gen/mappings/azurerm_mysql_firewall_rule.hcl delete mode 100644 tools/apispec-rule-gen/mappings/azurerm_mysql_server.hcl delete mode 100644 tools/apispec-rule-gen/mappings/azurerm_sql_database.hcl delete mode 100644 tools/apispec-rule-gen/mappings/azurerm_template_deployment.hcl diff --git a/docs/README.md b/docs/README.md index 4a1d13fd..385ed453 100644 --- a/docs/README.md +++ b/docs/README.md @@ -16,7 +16,7 @@ This documentation describes a list of rules available by enabling this ruleset. ## API Specification Rules -These are the rules that warn against invalid values generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). Currently, 228 rules are available. +These are the rules that warn against invalid values generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). Currently, 216 rules are available. |Rule|Enabled by default| | --- | --- | @@ -87,10 +87,6 @@ These are the rules that warn against invalid values generated from [azure-rest- |[azurerm_data_factory_dataset_postgresql_invalid_name](rules/azurerm_data_factory_dataset_postgresql_invalid_name.md)|✔| |[azurerm_data_factory_dataset_sql_server_table_invalid_linked_service_name](rules/azurerm_data_factory_dataset_sql_server_table_invalid_linked_service_name.md)|✔| |[azurerm_data_factory_dataset_sql_server_table_invalid_name](rules/azurerm_data_factory_dataset_sql_server_table_invalid_name.md)|✔| -|[azurerm_data_factory_integration_runtime_managed_invalid_edition](rules/azurerm_data_factory_integration_runtime_managed_invalid_edition.md)|✔| -|[azurerm_data_factory_integration_runtime_managed_invalid_license_type](rules/azurerm_data_factory_integration_runtime_managed_invalid_license_type.md)|✔| -|[azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node](rules/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.md)|✔| -|[azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes](rules/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.md)|✔| |[azurerm_data_factory_invalid_name](rules/azurerm_data_factory_invalid_name.md)|✔| |[azurerm_data_factory_invalid_resource_group_name](rules/azurerm_data_factory_invalid_resource_group_name.md)|✔| |[azurerm_data_factory_linked_service_data_lake_storage_gen2_invalid_name](rules/azurerm_data_factory_linked_service_data_lake_storage_gen2_invalid_name.md)|✔| @@ -172,15 +168,9 @@ These are the rules that warn against invalid values generated from [azure-rest- |[azurerm_managed_disk_invalid_os_type](rules/azurerm_managed_disk_invalid_os_type.md)|✔| |[azurerm_managed_disk_invalid_storage_account_type](rules/azurerm_managed_disk_invalid_storage_account_type.md)|✔| |[azurerm_maps_account_invalid_sku_name](rules/azurerm_maps_account_invalid_sku_name.md)|✔| -|[azurerm_mariadb_firewall_rule_invalid_end_ip_address](rules/azurerm_mariadb_firewall_rule_invalid_end_ip_address.md)|✔| -|[azurerm_mariadb_firewall_rule_invalid_start_ip_address](rules/azurerm_mariadb_firewall_rule_invalid_start_ip_address.md)|✔| -|[azurerm_mariadb_server_invalid_version](rules/azurerm_mariadb_server_invalid_version.md)|✔| |[azurerm_monitor_scheduled_query_rules_alert_invalid_severity](rules/azurerm_monitor_scheduled_query_rules_alert_invalid_severity.md)|✔| |[azurerm_mssql_virtual_machine_invalid_sql_connectivity_type](rules/azurerm_mssql_virtual_machine_invalid_sql_connectivity_type.md)|✔| |[azurerm_mssql_virtual_machine_invalid_sql_license_type](rules/azurerm_mssql_virtual_machine_invalid_sql_license_type.md)|✔| -|[azurerm_mysql_firewall_rule_invalid_end_ip_address](rules/azurerm_mysql_firewall_rule_invalid_end_ip_address.md)|✔| -|[azurerm_mysql_firewall_rule_invalid_start_ip_address](rules/azurerm_mysql_firewall_rule_invalid_start_ip_address.md)|✔| -|[azurerm_mysql_server_invalid_version](rules/azurerm_mysql_server_invalid_version.md)|✔| |[azurerm_nat_gateway_invalid_sku_name](rules/azurerm_nat_gateway_invalid_sku_name.md)|✔| |[azurerm_netapp_account_invalid_name](rules/azurerm_netapp_account_invalid_name.md)|✔| |[azurerm_netapp_pool_invalid_account_name](rules/azurerm_netapp_pool_invalid_account_name.md)|✔| @@ -222,7 +212,6 @@ These are the rules that warn against invalid values generated from [azure-rest- |[azurerm_servicebus_subscription_rule_invalid_filter_type](rules/azurerm_servicebus_subscription_rule_invalid_filter_type.md)|✔| |[azurerm_servicebus_topic_invalid_status](rules/azurerm_servicebus_topic_invalid_status.md)|✔| |[azurerm_shared_image_invalid_os_type](rules/azurerm_shared_image_invalid_os_type.md)|✔| -|[azurerm_sql_database_invalid_create_mode](rules/azurerm_sql_database_invalid_create_mode.md)|✔| |[azurerm_storage_account_invalid_access_tier](rules/azurerm_storage_account_invalid_access_tier.md)|✔| |[azurerm_storage_account_invalid_account_kind](rules/azurerm_storage_account_invalid_account_kind.md)|✔| |[azurerm_storage_account_invalid_resource_group_name](rules/azurerm_storage_account_invalid_resource_group_name.md)|✔| @@ -230,7 +219,6 @@ These are the rules that warn against invalid values generated from [azure-rest- |[azurerm_stream_analytics_job_invalid_compatibility_level](rules/azurerm_stream_analytics_job_invalid_compatibility_level.md)|✔| |[azurerm_stream_analytics_job_invalid_events_out_of_order_policy](rules/azurerm_stream_analytics_job_invalid_events_out_of_order_policy.md)|✔| |[azurerm_stream_analytics_job_invalid_output_error_policy](rules/azurerm_stream_analytics_job_invalid_output_error_policy.md)|✔| -|[azurerm_template_deployment_invalid_deployment_mode](rules/azurerm_template_deployment_invalid_deployment_mode.md)|✔| |[azurerm_traffic_manager_profile_invalid_profile_status](rules/azurerm_traffic_manager_profile_invalid_profile_status.md)|✔| |[azurerm_traffic_manager_profile_invalid_traffic_routing_method](rules/azurerm_traffic_manager_profile_invalid_traffic_routing_method.md)|✔| |[azurerm_virtual_machine_data_disk_attachment_invalid_caching](rules/azurerm_virtual_machine_data_disk_attachment_invalid_caching.md)|✔| diff --git a/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_edition.md b/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_edition.md deleted file mode 100644 index adea72f1..00000000 --- a/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_edition.md +++ /dev/null @@ -1,44 +0,0 @@ - - -# azurerm_data_factory_integration_runtime_managed_invalid_edition - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -Allowed values are: -- Standard -- Enterprise - -## Example - -```hcl -resource "azurerm_data_factory_integration_runtime_managed" "foo" { - edition = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." is an invalid value as edition (azurerm_data_factory_integration_runtime_managed_invalid_edition) - - on template.tf line 2: - 2: edition = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_edition.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/entityTypes/IntegrationRuntime.json diff --git a/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_license_type.md b/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_license_type.md deleted file mode 100644 index 76768a6e..00000000 --- a/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_license_type.md +++ /dev/null @@ -1,44 +0,0 @@ - - -# azurerm_data_factory_integration_runtime_managed_invalid_license_type - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -Allowed values are: -- BasePrice -- LicenseIncluded - -## Example - -```hcl -resource "azurerm_data_factory_integration_runtime_managed" "foo" { - license_type = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." is an invalid value as license_type (azurerm_data_factory_integration_runtime_managed_invalid_license_type) - - on template.tf line 2: - 2: license_type = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_license_type.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/entityTypes/IntegrationRuntime.json diff --git a/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.md b/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.md deleted file mode 100644 index f28621a7..00000000 --- a/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.md +++ /dev/null @@ -1,42 +0,0 @@ - - -# azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -The rule requires the value to be 1 or higher. - -## Example - -```hcl -resource "azurerm_data_factory_integration_runtime_managed" "foo" { - max_parallel_executions_per_node = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: max_parallel_executions_per_node must be 1 or higher (azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node) - - on template.tf line 2: - 2: max_parallel_executions_per_node = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/entityTypes/IntegrationRuntime.json diff --git a/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.md b/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.md deleted file mode 100644 index 57eaf8c1..00000000 --- a/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.md +++ /dev/null @@ -1,42 +0,0 @@ - - -# azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -The rule requires the value to be 1 or higher. - -## Example - -```hcl -resource "azurerm_data_factory_integration_runtime_managed" "foo" { - number_of_nodes = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: number_of_nodes must be 1 or higher (azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes) - - on template.tf line 2: - 2: number_of_nodes = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/entityTypes/IntegrationRuntime.json diff --git a/docs/rules/azurerm_mariadb_firewall_rule_invalid_end_ip_address.md b/docs/rules/azurerm_mariadb_firewall_rule_invalid_end_ip_address.md deleted file mode 100644 index 3c45532b..00000000 --- a/docs/rules/azurerm_mariadb_firewall_rule_invalid_end_ip_address.md +++ /dev/null @@ -1,42 +0,0 @@ - - -# azurerm_mariadb_firewall_rule_invalid_end_ip_address - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -In this rule, the string must match the regular expression `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$``. - -## Example - -```hcl -resource "azurerm_mariadb_firewall_rule" "foo" { - end_ip_address = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." does not match valid pattern ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (azurerm_mariadb_firewall_rule_invalid_end_ip_address) - - on template.tf line 2: - 2: end_ip_address = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_mariadb_firewall_rule_invalid_end_ip_address.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/mariadb.json diff --git a/docs/rules/azurerm_mariadb_firewall_rule_invalid_start_ip_address.md b/docs/rules/azurerm_mariadb_firewall_rule_invalid_start_ip_address.md deleted file mode 100644 index 921c65be..00000000 --- a/docs/rules/azurerm_mariadb_firewall_rule_invalid_start_ip_address.md +++ /dev/null @@ -1,42 +0,0 @@ - - -# azurerm_mariadb_firewall_rule_invalid_start_ip_address - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -In this rule, the string must match the regular expression `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$``. - -## Example - -```hcl -resource "azurerm_mariadb_firewall_rule" "foo" { - start_ip_address = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." does not match valid pattern ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (azurerm_mariadb_firewall_rule_invalid_start_ip_address) - - on template.tf line 2: - 2: start_ip_address = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_mariadb_firewall_rule_invalid_start_ip_address.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/mariadb.json diff --git a/docs/rules/azurerm_mariadb_server_invalid_version.md b/docs/rules/azurerm_mariadb_server_invalid_version.md deleted file mode 100644 index a5462adf..00000000 --- a/docs/rules/azurerm_mariadb_server_invalid_version.md +++ /dev/null @@ -1,44 +0,0 @@ - - -# azurerm_mariadb_server_invalid_version - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -Allowed values are: -- 10.2 -- 10.3 - -## Example - -```hcl -resource "azurerm_mariadb_server" "foo" { - version = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." is an invalid value as version (azurerm_mariadb_server_invalid_version) - - on template.tf line 2: - 2: version = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_mariadb_server_invalid_version.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/mariadb.json diff --git a/docs/rules/azurerm_mysql_firewall_rule_invalid_end_ip_address.md b/docs/rules/azurerm_mysql_firewall_rule_invalid_end_ip_address.md deleted file mode 100644 index 7de9ae91..00000000 --- a/docs/rules/azurerm_mysql_firewall_rule_invalid_end_ip_address.md +++ /dev/null @@ -1,42 +0,0 @@ - - -# azurerm_mysql_firewall_rule_invalid_end_ip_address - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -In this rule, the string must match the regular expression `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$``. - -## Example - -```hcl -resource "azurerm_mysql_firewall_rule" "foo" { - end_ip_address = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." does not match valid pattern ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (azurerm_mysql_firewall_rule_invalid_end_ip_address) - - on template.tf line 2: - 2: end_ip_address = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_mysql_firewall_rule_invalid_end_ip_address.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/mysql.json diff --git a/docs/rules/azurerm_mysql_firewall_rule_invalid_start_ip_address.md b/docs/rules/azurerm_mysql_firewall_rule_invalid_start_ip_address.md deleted file mode 100644 index 311af5e9..00000000 --- a/docs/rules/azurerm_mysql_firewall_rule_invalid_start_ip_address.md +++ /dev/null @@ -1,42 +0,0 @@ - - -# azurerm_mysql_firewall_rule_invalid_start_ip_address - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -In this rule, the string must match the regular expression `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$``. - -## Example - -```hcl -resource "azurerm_mysql_firewall_rule" "foo" { - start_ip_address = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." does not match valid pattern ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ (azurerm_mysql_firewall_rule_invalid_start_ip_address) - - on template.tf line 2: - 2: start_ip_address = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_mysql_firewall_rule_invalid_start_ip_address.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/mysql.json diff --git a/docs/rules/azurerm_mysql_server_invalid_version.md b/docs/rules/azurerm_mysql_server_invalid_version.md deleted file mode 100644 index f0cb1e61..00000000 --- a/docs/rules/azurerm_mysql_server_invalid_version.md +++ /dev/null @@ -1,45 +0,0 @@ - - -# azurerm_mysql_server_invalid_version - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -Allowed values are: -- 5.6 -- 5.7 -- 8.0 - -## Example - -```hcl -resource "azurerm_mysql_server" "foo" { - version = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." is an invalid value as version (azurerm_mysql_server_invalid_version) - - on template.tf line 2: - 2: version = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_mysql_server_invalid_version.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/mysql.json diff --git a/docs/rules/azurerm_sql_database_invalid_create_mode.md b/docs/rules/azurerm_sql_database_invalid_create_mode.md deleted file mode 100644 index efd6f1e9..00000000 --- a/docs/rules/azurerm_sql_database_invalid_create_mode.md +++ /dev/null @@ -1,52 +0,0 @@ - - -# azurerm_sql_database_invalid_create_mode - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -Allowed values are: -- Default -- Copy -- Secondary -- OnlineSecondary -- PointInTimeRestore -- Restore -- Recovery -- RestoreExternalBackup -- RestoreExternalBackupSecondary -- RestoreLongTermRetentionBackup - -## Example - -```hcl -resource "azurerm_sql_database" "foo" { - create_mode = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." is an invalid value as create_mode (azurerm_sql_database_invalid_create_mode) - - on template.tf line 2: - 2: create_mode = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_sql_database_invalid_create_mode.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/sql/resource-manager/Microsoft.Sql/preview/2017-03-01-preview/databases.json diff --git a/docs/rules/azurerm_template_deployment_invalid_deployment_mode.md b/docs/rules/azurerm_template_deployment_invalid_deployment_mode.md deleted file mode 100644 index 133cb091..00000000 --- a/docs/rules/azurerm_template_deployment_invalid_deployment_mode.md +++ /dev/null @@ -1,44 +0,0 @@ - - -# azurerm_template_deployment_invalid_deployment_mode - -Warns about values that appear to be invalid based on [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). - -Allowed values are: -- Incremental -- Complete - -## Example - -```hcl -resource "azurerm_template_deployment" "foo" { - deployment_mode = ... // invalid value -} -``` - -``` -$ tflint -1 issue(s) found: - -Error: "..." is an invalid value as deployment_mode (azurerm_template_deployment_invalid_deployment_mode) - - on template.tf line 2: - 2: deployment_mode = ... // invalid value - -Reference: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/v0.1.0/docs/rules/azurerm_template_deployment_invalid_deployment_mode.md - -``` - -## Why - -Requests containing invalid values will return an error when calling the API by `terraform apply`. - -## How to Fix - -Replace the warned value with a valid value. - -## Source - -This rule is automatically generated from [azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs). If you are uncertain about the warning, check the following API schema referenced by this rule. - -https://github.com/Azure/azure-rest-api-specs/tree/master/specification/resources/resource-manager/Microsoft.Resources/stable/2020-06-01/resources.json diff --git a/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_edition.go b/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_edition.go deleted file mode 100644 index 3d4356d9..00000000 --- a/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_edition.go +++ /dev/null @@ -1,92 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule checks the pattern is valid -type AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - enum []string -} - -// NewAzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule returns new rule with default attributes -func NewAzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule() *AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule { - return &AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule{ - resourceType: "azurerm_data_factory_integration_runtime_managed", - attributeName: "edition", - enum: []string{ - "Standard", - "Enterprise", - }, - } -} - -// Name returns the rule name -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule) Name() string { - return "azurerm_data_factory_integration_runtime_managed_invalid_edition" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - found := false - for _, item := range r.enum { - if item == val { - found = true - } - } - if !found { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" is an invalid value as edition`, truncateLongMessage(val)), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_license_type.go b/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_license_type.go deleted file mode 100644 index 3f6f0f9d..00000000 --- a/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_license_type.go +++ /dev/null @@ -1,92 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule checks the pattern is valid -type AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - enum []string -} - -// NewAzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule returns new rule with default attributes -func NewAzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule() *AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule { - return &AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule{ - resourceType: "azurerm_data_factory_integration_runtime_managed", - attributeName: "license_type", - enum: []string{ - "BasePrice", - "LicenseIncluded", - }, - } -} - -// Name returns the rule name -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule) Name() string { - return "azurerm_data_factory_integration_runtime_managed_invalid_license_type" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - found := false - for _, item := range r.enum { - if item == val { - found = true - } - } - if !found { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" is an invalid value as license_type`, truncateLongMessage(val)), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.go b/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.go deleted file mode 100644 index 84d33fdd..00000000 --- a/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule checks the pattern is valid -type AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - min int -} - -// NewAzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule returns new rule with default attributes -func NewAzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule() *AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule { - return &AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule{ - resourceType: "azurerm_data_factory_integration_runtime_managed", - attributeName: "max_parallel_executions_per_node", - min: 1, - } -} - -// Name returns the rule name -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule) Name() string { - return "azurerm_data_factory_integration_runtime_managed_invalid_max_parallel_executions_per_node" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val int) error { - if val < r.min { - runner.EmitIssue( - r, - "max_parallel_executions_per_node must be 1 or higher", - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.go b/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.go deleted file mode 100644 index d98b443b..00000000 --- a/rules/apispec/azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule checks the pattern is valid -type AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - min int -} - -// NewAzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule returns new rule with default attributes -func NewAzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule() *AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule { - return &AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule{ - resourceType: "azurerm_data_factory_integration_runtime_managed", - attributeName: "number_of_nodes", - min: 1, - } -} - -// Name returns the rule name -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule) Name() string { - return "azurerm_data_factory_integration_runtime_managed_invalid_number_of_nodes" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val int) error { - if val < r.min { - runner.EmitIssue( - r, - "number_of_nodes must be 1 or higher", - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_mariadb_firewall_rule_invalid_end_ip_address.go b/rules/apispec/azurerm_mariadb_firewall_rule_invalid_end_ip_address.go deleted file mode 100644 index 9cf0289a..00000000 --- a/rules/apispec/azurerm_mariadb_firewall_rule_invalid_end_ip_address.go +++ /dev/null @@ -1,84 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - "regexp" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermMariadbFirewallRuleInvalidEndIPAddressRule checks the pattern is valid -type AzurermMariadbFirewallRuleInvalidEndIPAddressRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - pattern *regexp.Regexp -} - -// NewAzurermMariadbFirewallRuleInvalidEndIPAddressRule returns new rule with default attributes -func NewAzurermMariadbFirewallRuleInvalidEndIPAddressRule() *AzurermMariadbFirewallRuleInvalidEndIPAddressRule { - return &AzurermMariadbFirewallRuleInvalidEndIPAddressRule{ - resourceType: "azurerm_mariadb_firewall_rule", - attributeName: "end_ip_address", - pattern: regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`), - } -} - -// Name returns the rule name -func (r *AzurermMariadbFirewallRuleInvalidEndIPAddressRule) Name() string { - return "azurerm_mariadb_firewall_rule_invalid_end_ip_address" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermMariadbFirewallRuleInvalidEndIPAddressRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermMariadbFirewallRuleInvalidEndIPAddressRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermMariadbFirewallRuleInvalidEndIPAddressRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermMariadbFirewallRuleInvalidEndIPAddressRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - if !r.pattern.MatchString(val) { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_mariadb_firewall_rule_invalid_start_ip_address.go b/rules/apispec/azurerm_mariadb_firewall_rule_invalid_start_ip_address.go deleted file mode 100644 index c252cf82..00000000 --- a/rules/apispec/azurerm_mariadb_firewall_rule_invalid_start_ip_address.go +++ /dev/null @@ -1,84 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - "regexp" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermMariadbFirewallRuleInvalidStartIPAddressRule checks the pattern is valid -type AzurermMariadbFirewallRuleInvalidStartIPAddressRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - pattern *regexp.Regexp -} - -// NewAzurermMariadbFirewallRuleInvalidStartIPAddressRule returns new rule with default attributes -func NewAzurermMariadbFirewallRuleInvalidStartIPAddressRule() *AzurermMariadbFirewallRuleInvalidStartIPAddressRule { - return &AzurermMariadbFirewallRuleInvalidStartIPAddressRule{ - resourceType: "azurerm_mariadb_firewall_rule", - attributeName: "start_ip_address", - pattern: regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`), - } -} - -// Name returns the rule name -func (r *AzurermMariadbFirewallRuleInvalidStartIPAddressRule) Name() string { - return "azurerm_mariadb_firewall_rule_invalid_start_ip_address" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermMariadbFirewallRuleInvalidStartIPAddressRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermMariadbFirewallRuleInvalidStartIPAddressRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermMariadbFirewallRuleInvalidStartIPAddressRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermMariadbFirewallRuleInvalidStartIPAddressRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - if !r.pattern.MatchString(val) { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_mariadb_server_invalid_version.go b/rules/apispec/azurerm_mariadb_server_invalid_version.go deleted file mode 100644 index e56bfcce..00000000 --- a/rules/apispec/azurerm_mariadb_server_invalid_version.go +++ /dev/null @@ -1,92 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermMariadbServerInvalidVersionRule checks the pattern is valid -type AzurermMariadbServerInvalidVersionRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - enum []string -} - -// NewAzurermMariadbServerInvalidVersionRule returns new rule with default attributes -func NewAzurermMariadbServerInvalidVersionRule() *AzurermMariadbServerInvalidVersionRule { - return &AzurermMariadbServerInvalidVersionRule{ - resourceType: "azurerm_mariadb_server", - attributeName: "version", - enum: []string{ - "10.2", - "10.3", - }, - } -} - -// Name returns the rule name -func (r *AzurermMariadbServerInvalidVersionRule) Name() string { - return "azurerm_mariadb_server_invalid_version" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermMariadbServerInvalidVersionRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermMariadbServerInvalidVersionRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermMariadbServerInvalidVersionRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermMariadbServerInvalidVersionRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - found := false - for _, item := range r.enum { - if item == val { - found = true - } - } - if !found { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" is an invalid value as version`, truncateLongMessage(val)), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_mysql_firewall_rule_invalid_end_ip_address.go b/rules/apispec/azurerm_mysql_firewall_rule_invalid_end_ip_address.go deleted file mode 100644 index a28183de..00000000 --- a/rules/apispec/azurerm_mysql_firewall_rule_invalid_end_ip_address.go +++ /dev/null @@ -1,84 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - "regexp" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermMysqlFirewallRuleInvalidEndIPAddressRule checks the pattern is valid -type AzurermMysqlFirewallRuleInvalidEndIPAddressRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - pattern *regexp.Regexp -} - -// NewAzurermMysqlFirewallRuleInvalidEndIPAddressRule returns new rule with default attributes -func NewAzurermMysqlFirewallRuleInvalidEndIPAddressRule() *AzurermMysqlFirewallRuleInvalidEndIPAddressRule { - return &AzurermMysqlFirewallRuleInvalidEndIPAddressRule{ - resourceType: "azurerm_mysql_firewall_rule", - attributeName: "end_ip_address", - pattern: regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`), - } -} - -// Name returns the rule name -func (r *AzurermMysqlFirewallRuleInvalidEndIPAddressRule) Name() string { - return "azurerm_mysql_firewall_rule_invalid_end_ip_address" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermMysqlFirewallRuleInvalidEndIPAddressRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermMysqlFirewallRuleInvalidEndIPAddressRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermMysqlFirewallRuleInvalidEndIPAddressRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermMysqlFirewallRuleInvalidEndIPAddressRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - if !r.pattern.MatchString(val) { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_mysql_firewall_rule_invalid_start_ip_address.go b/rules/apispec/azurerm_mysql_firewall_rule_invalid_start_ip_address.go deleted file mode 100644 index de022ad1..00000000 --- a/rules/apispec/azurerm_mysql_firewall_rule_invalid_start_ip_address.go +++ /dev/null @@ -1,84 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - "regexp" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermMysqlFirewallRuleInvalidStartIPAddressRule checks the pattern is valid -type AzurermMysqlFirewallRuleInvalidStartIPAddressRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - pattern *regexp.Regexp -} - -// NewAzurermMysqlFirewallRuleInvalidStartIPAddressRule returns new rule with default attributes -func NewAzurermMysqlFirewallRuleInvalidStartIPAddressRule() *AzurermMysqlFirewallRuleInvalidStartIPAddressRule { - return &AzurermMysqlFirewallRuleInvalidStartIPAddressRule{ - resourceType: "azurerm_mysql_firewall_rule", - attributeName: "start_ip_address", - pattern: regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`), - } -} - -// Name returns the rule name -func (r *AzurermMysqlFirewallRuleInvalidStartIPAddressRule) Name() string { - return "azurerm_mysql_firewall_rule_invalid_start_ip_address" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermMysqlFirewallRuleInvalidStartIPAddressRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermMysqlFirewallRuleInvalidStartIPAddressRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermMysqlFirewallRuleInvalidStartIPAddressRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermMysqlFirewallRuleInvalidStartIPAddressRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - if !r.pattern.MatchString(val) { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_mysql_server_invalid_version.go b/rules/apispec/azurerm_mysql_server_invalid_version.go deleted file mode 100644 index b01b749b..00000000 --- a/rules/apispec/azurerm_mysql_server_invalid_version.go +++ /dev/null @@ -1,93 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermMysqlServerInvalidVersionRule checks the pattern is valid -type AzurermMysqlServerInvalidVersionRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - enum []string -} - -// NewAzurermMysqlServerInvalidVersionRule returns new rule with default attributes -func NewAzurermMysqlServerInvalidVersionRule() *AzurermMysqlServerInvalidVersionRule { - return &AzurermMysqlServerInvalidVersionRule{ - resourceType: "azurerm_mysql_server", - attributeName: "version", - enum: []string{ - "5.6", - "5.7", - "8.0", - }, - } -} - -// Name returns the rule name -func (r *AzurermMysqlServerInvalidVersionRule) Name() string { - return "azurerm_mysql_server_invalid_version" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermMysqlServerInvalidVersionRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermMysqlServerInvalidVersionRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermMysqlServerInvalidVersionRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermMysqlServerInvalidVersionRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - found := false - for _, item := range r.enum { - if item == val { - found = true - } - } - if !found { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" is an invalid value as version`, truncateLongMessage(val)), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_sql_database_invalid_create_mode.go b/rules/apispec/azurerm_sql_database_invalid_create_mode.go deleted file mode 100644 index cd56ffda..00000000 --- a/rules/apispec/azurerm_sql_database_invalid_create_mode.go +++ /dev/null @@ -1,100 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermSQLDatabaseInvalidCreateModeRule checks the pattern is valid -type AzurermSQLDatabaseInvalidCreateModeRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - enum []string -} - -// NewAzurermSQLDatabaseInvalidCreateModeRule returns new rule with default attributes -func NewAzurermSQLDatabaseInvalidCreateModeRule() *AzurermSQLDatabaseInvalidCreateModeRule { - return &AzurermSQLDatabaseInvalidCreateModeRule{ - resourceType: "azurerm_sql_database", - attributeName: "create_mode", - enum: []string{ - "Default", - "Copy", - "Secondary", - "OnlineSecondary", - "PointInTimeRestore", - "Restore", - "Recovery", - "RestoreExternalBackup", - "RestoreExternalBackupSecondary", - "RestoreLongTermRetentionBackup", - }, - } -} - -// Name returns the rule name -func (r *AzurermSQLDatabaseInvalidCreateModeRule) Name() string { - return "azurerm_sql_database_invalid_create_mode" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermSQLDatabaseInvalidCreateModeRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermSQLDatabaseInvalidCreateModeRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermSQLDatabaseInvalidCreateModeRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermSQLDatabaseInvalidCreateModeRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - found := false - for _, item := range r.enum { - if item == val { - found = true - } - } - if !found { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" is an invalid value as create_mode`, truncateLongMessage(val)), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/azurerm_template_deployment_invalid_deployment_mode.go b/rules/apispec/azurerm_template_deployment_invalid_deployment_mode.go deleted file mode 100644 index 9437fa28..00000000 --- a/rules/apispec/azurerm_template_deployment_invalid_deployment_mode.go +++ /dev/null @@ -1,92 +0,0 @@ -// This file generated by `tools/apispec-rule-gen/main.go`. DO NOT EDIT - -package apispec - -import ( - "fmt" - - "github.com/terraform-linters/tflint-plugin-sdk/hclext" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" - "github.com/terraform-linters/tflint-ruleset-azurerm/project" -) - -// AzurermTemplateDeploymentInvalidDeploymentModeRule checks the pattern is valid -type AzurermTemplateDeploymentInvalidDeploymentModeRule struct { - tflint.DefaultRule - - resourceType string - attributeName string - enum []string -} - -// NewAzurermTemplateDeploymentInvalidDeploymentModeRule returns new rule with default attributes -func NewAzurermTemplateDeploymentInvalidDeploymentModeRule() *AzurermTemplateDeploymentInvalidDeploymentModeRule { - return &AzurermTemplateDeploymentInvalidDeploymentModeRule{ - resourceType: "azurerm_template_deployment", - attributeName: "deployment_mode", - enum: []string{ - "Incremental", - "Complete", - }, - } -} - -// Name returns the rule name -func (r *AzurermTemplateDeploymentInvalidDeploymentModeRule) Name() string { - return "azurerm_template_deployment_invalid_deployment_mode" -} - -// Enabled returns whether the rule is enabled by default -func (r *AzurermTemplateDeploymentInvalidDeploymentModeRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *AzurermTemplateDeploymentInvalidDeploymentModeRule) Severity() tflint.Severity { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *AzurermTemplateDeploymentInvalidDeploymentModeRule) Link() string { - return project.ReferenceLink(r.Name()) -} - -// Check checks the pattern is valid -func (r *AzurermTemplateDeploymentInvalidDeploymentModeRule) Check(runner tflint.Runner) error { - resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ - Attributes: []hclext.AttributeSchema{ - {Name: r.attributeName}, - }, - }, nil) - if err != nil { - return err - } - - for _, resource := range resources.Blocks { - attribute, exists := resource.Body.Attributes[r.attributeName] - if !exists { - continue - } - err := runner.EvaluateExpr(attribute.Expr, func (val string) error { - found := false - for _, item := range r.enum { - if item == val { - found = true - } - } - if !found { - runner.EmitIssue( - r, - fmt.Sprintf(`"%s" is an invalid value as deployment_mode`, truncateLongMessage(val)), - attribute.Expr.Range(), - ) - } - return nil - }, nil) - if err != nil { - return err - } - } - - return nil -} diff --git a/rules/apispec/generated_rules_test.go b/rules/apispec/generated_rules_test.go index 16c9d13f..cbffc1fd 100644 --- a/rules/apispec/generated_rules_test.go +++ b/rules/apispec/generated_rules_test.go @@ -65,17 +65,17 @@ func Test_generatedPatternRule(t *testing.T) { { Name: "invalid", Content: ` -resource "azurerm_mysql_firewall_rule" "main" { - start_ip_address = "192.168.0.256" +resource "azurerm_cosmosdb_mongo_database" "main" { + account_name = "-admin" }`, Expected: helper.Issues{ { - Rule: NewAzurermMysqlFirewallRuleInvalidStartIPAddressRule(), - Message: `"192.168.0.256" does not match valid pattern ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`, + Rule: NewAzurermCosmosdbMongoDatabaseInvalidAccountNameRule(), + Message: `"-admin" does not match valid pattern ^[a-z0-9]+(-[a-z0-9]+)*`, Range: hcl.Range{ Filename: "resource.tf", - Start: hcl.Pos{Line: 3, Column: 24}, - End: hcl.Pos{Line: 3, Column: 39}, + Start: hcl.Pos{Line: 3, Column: 20}, + End: hcl.Pos{Line: 3, Column: 28}, }, }, }, @@ -83,14 +83,14 @@ resource "azurerm_mysql_firewall_rule" "main" { { Name: "valid", Content: ` -resource "azurerm_mysql_firewall_rule" "main" { - start_ip_address = "192.168.0.1" +resource "azurerm_cosmosdb_mongo_database" "main" { + account_name = "admin-" }`, Expected: helper.Issues{}, }, } - rule := NewAzurermMysqlFirewallRuleInvalidStartIPAddressRule() + rule := NewAzurermCosmosdbMongoDatabaseInvalidAccountNameRule() for _, tc := range cases { runner := helper.TestRunner(t, map[string]string{"resource.tf": tc.Content}) diff --git a/rules/apispec/provider.go b/rules/apispec/provider.go index d4b4be34..9df476ca 100644 --- a/rules/apispec/provider.go +++ b/rules/apispec/provider.go @@ -77,10 +77,6 @@ var Rules = []tflint.Rule{ NewAzurermDataFactoryDatasetPostgresqlInvalidNameRule(), NewAzurermDataFactoryDatasetSQLServerTableInvalidLinkedServiceNameRule(), NewAzurermDataFactoryDatasetSQLServerTableInvalidNameRule(), - NewAzurermDataFactoryIntegrationRuntimeManagedInvalidEditionRule(), - NewAzurermDataFactoryIntegrationRuntimeManagedInvalidLicenseTypeRule(), - NewAzurermDataFactoryIntegrationRuntimeManagedInvalidMaxParallelExecutionsPerNodeRule(), - NewAzurermDataFactoryIntegrationRuntimeManagedInvalidNumberOfNodesRule(), NewAzurermDataFactoryInvalidNameRule(), NewAzurermDataFactoryInvalidResourceGroupNameRule(), NewAzurermDataFactoryLinkedServiceDataLakeStorageGen2InvalidNameRule(), @@ -162,15 +158,9 @@ var Rules = []tflint.Rule{ NewAzurermManagedDiskInvalidOSTypeRule(), NewAzurermManagedDiskInvalidStorageAccountTypeRule(), NewAzurermMapsAccountInvalidSkuNameRule(), - NewAzurermMariadbFirewallRuleInvalidEndIPAddressRule(), - NewAzurermMariadbFirewallRuleInvalidStartIPAddressRule(), - NewAzurermMariadbServerInvalidVersionRule(), NewAzurermMonitorScheduledQueryRulesAlertInvalidSeverityRule(), NewAzurermMssqlVirtualMachineInvalidSQLConnectivityTypeRule(), NewAzurermMssqlVirtualMachineInvalidSQLLicenseTypeRule(), - NewAzurermMysqlFirewallRuleInvalidEndIPAddressRule(), - NewAzurermMysqlFirewallRuleInvalidStartIPAddressRule(), - NewAzurermMysqlServerInvalidVersionRule(), NewAzurermNatGatewayInvalidSkuNameRule(), NewAzurermNetappAccountInvalidNameRule(), NewAzurermNetappPoolInvalidAccountNameRule(), @@ -202,7 +192,6 @@ var Rules = []tflint.Rule{ NewAzurermRedisCacheInvalidSubnetIDRule(), NewAzurermRelayNamespaceInvalidSkuNameRule(), NewAzurermRouteInvalidNextHopTypeRule(), - NewAzurermSQLDatabaseInvalidCreateModeRule(), NewAzurermSearchServiceInvalidPartitionCountRule(), NewAzurermSearchServiceInvalidReplicaCountRule(), NewAzurermSearchServiceInvalidSkuRule(), @@ -220,7 +209,6 @@ var Rules = []tflint.Rule{ NewAzurermStreamAnalyticsJobInvalidCompatibilityLevelRule(), NewAzurermStreamAnalyticsJobInvalidEventsOutOfOrderPolicyRule(), NewAzurermStreamAnalyticsJobInvalidOutputErrorPolicyRule(), - NewAzurermTemplateDeploymentInvalidDeploymentModeRule(), NewAzurermTrafficManagerProfileInvalidProfileStatusRule(), NewAzurermTrafficManagerProfileInvalidTrafficRoutingMethodRule(), NewAzurermVirtualMachineDataDiskAttachmentInvalidCachingRule(), diff --git a/tools/apispec-rule-gen/mappings/azurerm_data_factory_integration_runtime_managed.hcl b/tools/apispec-rule-gen/mappings/azurerm_data_factory_integration_runtime_managed.hcl deleted file mode 100644 index f5561ecd..00000000 --- a/tools/apispec-rule-gen/mappings/azurerm_data_factory_integration_runtime_managed.hcl +++ /dev/null @@ -1,9 +0,0 @@ -mapping "azurerm_data_factory_integration_runtime_managed" { - import_path = "azure-rest-api-specs/specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/entityTypes/IntegrationRuntime.json" - - node_size = IntegrationRuntimeComputeProperties.nodeSize - number_of_nodes = IntegrationRuntimeComputeProperties.numberOfNodes - max_parallel_executions_per_node = IntegrationRuntimeComputeProperties.maxParallelExecutionsPerNode - edition = IntegrationRuntimeSsisProperties.edition - license_type = IntegrationRuntimeSsisProperties.licenseType -} \ No newline at end of file diff --git a/tools/apispec-rule-gen/mappings/azurerm_mariadb_firewall_rule.hcl b/tools/apispec-rule-gen/mappings/azurerm_mariadb_firewall_rule.hcl deleted file mode 100644 index dffd4587..00000000 --- a/tools/apispec-rule-gen/mappings/azurerm_mariadb_firewall_rule.hcl +++ /dev/null @@ -1,8 +0,0 @@ -mapping "azurerm_mariadb_firewall_rule" { - import_path = "azure-rest-api-specs/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/mariadb.json" - - name = FirewallRuleNameParameter - server_name = ServerNameParameter - start_ip_address = FirewallRuleProperties.startIpAddress - end_ip_address = FirewallRuleProperties.endIpAddress -} \ No newline at end of file diff --git a/tools/apispec-rule-gen/mappings/azurerm_mariadb_server.hcl b/tools/apispec-rule-gen/mappings/azurerm_mariadb_server.hcl deleted file mode 100644 index 56d8a241..00000000 --- a/tools/apispec-rule-gen/mappings/azurerm_mariadb_server.hcl +++ /dev/null @@ -1,9 +0,0 @@ -mapping "azurerm_mariadb_server" { - import_path = "azure-rest-api-specs/specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/mariadb.json" - - name = ServerNameParameter - sku_name = Sku.name - administrator_login = ServerPropertiesForDefaultCreate.administratorLogin - administrator_login_password = ServerPropertiesForDefaultCreate.administratorLoginPassword - version = ServerVersion -} \ No newline at end of file diff --git a/tools/apispec-rule-gen/mappings/azurerm_mysql_firewall_rule.hcl b/tools/apispec-rule-gen/mappings/azurerm_mysql_firewall_rule.hcl deleted file mode 100644 index b096e531..00000000 --- a/tools/apispec-rule-gen/mappings/azurerm_mysql_firewall_rule.hcl +++ /dev/null @@ -1,8 +0,0 @@ -mapping "azurerm_mysql_firewall_rule" { - import_path = "azure-rest-api-specs/specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/mysql.json" - - name = FirewallRuleNameParameter - server_name = ServerNameParameter - start_ip_address = FirewallRuleProperties.startIpAddress - end_ip_address = FirewallRuleProperties.endIpAddress -} diff --git a/tools/apispec-rule-gen/mappings/azurerm_mysql_server.hcl b/tools/apispec-rule-gen/mappings/azurerm_mysql_server.hcl deleted file mode 100644 index 16881937..00000000 --- a/tools/apispec-rule-gen/mappings/azurerm_mysql_server.hcl +++ /dev/null @@ -1,9 +0,0 @@ -mapping "azurerm_mysql_server" { - import_path = "azure-rest-api-specs/specification/mysql/resource-manager/Microsoft.DBforMySQL/legacy/stable/2017-12-01/mysql.json" - - name = ServerNameParameter - sku_name = Sku.name - administrator_login = ServerPropertiesForDefaultCreate.administratorLogin - administrator_login_password = ServerPropertiesForDefaultCreate.administratorLoginPassword - version = ServerVersion -} diff --git a/tools/apispec-rule-gen/mappings/azurerm_sql_database.hcl b/tools/apispec-rule-gen/mappings/azurerm_sql_database.hcl deleted file mode 100644 index 8531f63c..00000000 --- a/tools/apispec-rule-gen/mappings/azurerm_sql_database.hcl +++ /dev/null @@ -1,17 +0,0 @@ -mapping "azurerm_sql_database" { - import_path = "azure-rest-api-specs/specification/sql/resource-manager/Microsoft.Sql/preview/2017-03-01-preview/databases.json" - - server_name = ServerNameParameter - create_mode = DatabaseProperties.createMode - source_database_id = DatabaseProperties.sourceDatabaseId - restore_point_in_time = DatabaseProperties.restorePointInTime - edition = any - collation = DatabaseProperties.collation - max_size_bytes = DatabaseProperties.maxSizeBytes - requested_service_objective_id = any - requested_service_objective_name = any - source_database_deletion_date = DatabaseProperties.sourceDatabaseDeletionDate - elastic_pool_name = any - read_scale = any - zone_redundant = DatabaseProperties.zoneRedundant -} \ No newline at end of file diff --git a/tools/apispec-rule-gen/mappings/azurerm_template_deployment.hcl b/tools/apispec-rule-gen/mappings/azurerm_template_deployment.hcl deleted file mode 100644 index a4f91b97..00000000 --- a/tools/apispec-rule-gen/mappings/azurerm_template_deployment.hcl +++ /dev/null @@ -1,5 +0,0 @@ -mapping "azurerm_template_deployment" { - import_path = "azure-rest-api-specs/specification/resources/resource-manager/Microsoft.Resources/stable/2020-06-01/resources.json" - - deployment_mode = DeploymentProperties.mode -}