Skip to content

Commit f5e8949

Browse files
committed
Update Magic Modules
1 parent fe6a966 commit f5e8949

14 files changed

+844
-3
lines changed

rules/magicmodules/api_definition.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var APIDefinition = map[string]string{
3838
"google_compute_instance_group_membership": "compute.googleapis.com",
3939
"google_compute_instance_group_named_port": "compute.googleapis.com",
4040
"google_compute_instance_settings": "compute.googleapis.com",
41+
"google_compute_interconnect": "compute.googleapis.com",
4142
"google_compute_interconnect_attachment": "compute.googleapis.com",
4243
"google_compute_managed_ssl_certificate": "compute.googleapis.com",
4344
"google_compute_network": "compute.googleapis.com",
@@ -198,7 +199,10 @@ var APIDefinition = map[string]string{
198199
"google_data_catalog_taxonomy": "datacatalog.googleapis.com",
199200
"google_data_fusion_instance": "datafusion.googleapis.com",
200201
"google_data_pipeline_pipeline": "datapipelines.googleapis.com",
202+
"google_dataplex_aspect_type": "dataplex.googleapis.com",
201203
"google_dataplex_datascan": "dataplex.googleapis.com",
204+
"google_dataplex_entry_group": "dataplex.googleapis.com",
205+
"google_dataplex_entry_type": "dataplex.googleapis.com",
202206
"google_dataplex_task": "dataplex.googleapis.com",
203207
"google_dataproc_autoscaling_policy": "dataproc.googleapis.com",
204208
"google_datastore_index": "datastore.googleapis.com",
@@ -281,6 +285,7 @@ var APIDefinition = map[string]string{
281285
"google_identity_platform_tenant_oauth_idp_config": "identitytoolkit.googleapis.com",
282286
"google_integration_connectors_connection": "connectors.googleapis.com",
283287
"google_integration_connectors_endpoint_attachment": "connectors.googleapis.com",
288+
"google_integration_connectors_managed_zone": "connectors.googleapis.com",
284289
"google_integrations_auth_config": "integrations.googleapis.com",
285290
"google_integrations_client": "integrations.googleapis.com",
286291
"google_kms_crypto_key": "cloudkms.googleapis.com",
@@ -296,6 +301,7 @@ var APIDefinition = map[string]string{
296301
"google_logging_organization_settings": "logging.googleapis.com",
297302
"google_looker_instance": "looker.googleapis.com",
298303
"google_memcache_instance": "memcache.googleapis.com",
304+
"google_dataproc_metastore_federation": "metastore.googleapis.com",
299305
"google_dataproc_metastore_service": "metastore.googleapis.com",
300306
"google_migration_center_group": "migrationcenter.googleapis.com",
301307
"google_migration_center_preference_set": "migrationcenter.googleapis.com",
@@ -323,13 +329,20 @@ var APIDefinition = map[string]string{
323329
"google_network_connectivity_service_connection_policy": "networkconnectivity.googleapis.com",
324330
"google_network_management_connectivity_test_resource": "networkmanagement.googleapis.com",
325331
"google_network_security_address_group": "networksecurity.googleapis.com",
332+
"google_network_security_firewall_endpoint": "networksecurity.googleapis.com",
333+
"google_network_security_firewall_endpoint_association": "networksecurity.googleapis.com",
326334
"google_network_security_gateway_security_policy": "networksecurity.googleapis.com",
327335
"google_network_security_gateway_security_policy_rule": "networksecurity.googleapis.com",
336+
"google_network_security_security_profile": "networksecurity.googleapis.com",
337+
"google_network_security_security_profile_group": "networksecurity.googleapis.com",
338+
"google_network_security_tls_inspection_policy": "networksecurity.googleapis.com",
328339
"google_network_security_url_lists": "networksecurity.googleapis.com",
329340
"google_network_services_edge_cache_keyset": "networkservices.googleapis.com",
330341
"google_network_services_edge_cache_origin": "networkservices.googleapis.com",
331342
"google_network_services_edge_cache_service": "networkservices.googleapis.com",
332343
"google_network_services_gateway": "networkservices.googleapis.com",
344+
"google_network_services_lb_route_extension": "networkservices.googleapis.com",
345+
"google_network_services_lb_traffic_extension": "networkservices.googleapis.com",
333346
"google_notebooks_environment": "notebooks.googleapis.com",
334347
"google_notebooks_instance": "notebooks.googleapis.com",
335348
"google_notebooks_location": "notebooks.googleapis.com",
@@ -340,6 +353,7 @@ var APIDefinition = map[string]string{
340353
"google_privateca_ca_pool": "privateca.googleapis.com",
341354
"google_privateca_certificate": "privateca.googleapis.com",
342355
"google_privateca_certificate_authority": "privateca.googleapis.com",
356+
"google_privateca_certificate_template": "privateca.googleapis.com",
343357
"google_public_ca_external_account_key": "publicca.googleapis.com",
344358
"google_pubsub_schema": "pubsub.googleapis.com",
345359
"google_pubsub_subscription": "pubsub.googleapis.com",
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package magicmodules
16+
17+
import (
18+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
19+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleComputeInterconnectInvalidInterconnectTypeRule checks the pattern is valid
24+
type GoogleComputeInterconnectInvalidInterconnectTypeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleComputeInterconnectInvalidInterconnectTypeRule returns new rule with default attributes
32+
func NewGoogleComputeInterconnectInvalidInterconnectTypeRule() *GoogleComputeInterconnectInvalidInterconnectTypeRule {
33+
return &GoogleComputeInterconnectInvalidInterconnectTypeRule{
34+
resourceType: "google_compute_interconnect",
35+
attributeName: "interconnect_type",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleComputeInterconnectInvalidInterconnectTypeRule) Name() string {
41+
return "google_compute_interconnect_invalid_interconnect_type"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleComputeInterconnectInvalidInterconnectTypeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleComputeInterconnectInvalidInterconnectTypeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleComputeInterconnectInvalidInterconnectTypeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleComputeInterconnectInvalidInterconnectTypeRule) Check(runner tflint.Runner) error {
61+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
62+
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}},
63+
}, nil)
64+
if err != nil {
65+
return err
66+
}
67+
68+
for _, resource := range resources.Blocks {
69+
attribute, exists := resource.Body.Attributes[r.attributeName]
70+
if !exists {
71+
continue
72+
}
73+
74+
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
75+
validateFunc := validation.StringInSlice([]string{"DEDICATED", "PARTNER", "IT_PRIVATE"}, false)
76+
77+
_, errors := validateFunc(val, r.attributeName)
78+
for _, err := range errors {
79+
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil {
80+
return err
81+
}
82+
}
83+
return nil
84+
}, nil)
85+
if err != nil {
86+
return err
87+
}
88+
}
89+
90+
return nil
91+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package magicmodules
16+
17+
import (
18+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
19+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleComputeInterconnectInvalidLinkTypeRule checks the pattern is valid
24+
type GoogleComputeInterconnectInvalidLinkTypeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleComputeInterconnectInvalidLinkTypeRule returns new rule with default attributes
32+
func NewGoogleComputeInterconnectInvalidLinkTypeRule() *GoogleComputeInterconnectInvalidLinkTypeRule {
33+
return &GoogleComputeInterconnectInvalidLinkTypeRule{
34+
resourceType: "google_compute_interconnect",
35+
attributeName: "link_type",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleComputeInterconnectInvalidLinkTypeRule) Name() string {
41+
return "google_compute_interconnect_invalid_link_type"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleComputeInterconnectInvalidLinkTypeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleComputeInterconnectInvalidLinkTypeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleComputeInterconnectInvalidLinkTypeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleComputeInterconnectInvalidLinkTypeRule) Check(runner tflint.Runner) error {
61+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
62+
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}},
63+
}, nil)
64+
if err != nil {
65+
return err
66+
}
67+
68+
for _, resource := range resources.Blocks {
69+
attribute, exists := resource.Body.Attributes[r.attributeName]
70+
if !exists {
71+
continue
72+
}
73+
74+
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
75+
validateFunc := validation.StringInSlice([]string{"LINK_TYPE_ETHERNET_10G_LR", "LINK_TYPE_ETHERNET_100G_LR"}, false)
76+
77+
_, errors := validateFunc(val, r.attributeName)
78+
for _, err := range errors {
79+
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil {
80+
return err
81+
}
82+
}
83+
return nil
84+
}, nil)
85+
if err != nil {
86+
return err
87+
}
88+
}
89+
90+
return nil
91+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package magicmodules
16+
17+
import (
18+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
19+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
20+
)
21+
22+
// GoogleComputeInterconnectInvalidNameRule checks the pattern is valid
23+
type GoogleComputeInterconnectInvalidNameRule struct {
24+
tflint.DefaultRule
25+
26+
resourceType string
27+
attributeName string
28+
}
29+
30+
// NewGoogleComputeInterconnectInvalidNameRule returns new rule with default attributes
31+
func NewGoogleComputeInterconnectInvalidNameRule() *GoogleComputeInterconnectInvalidNameRule {
32+
return &GoogleComputeInterconnectInvalidNameRule{
33+
resourceType: "google_compute_interconnect",
34+
attributeName: "name",
35+
}
36+
}
37+
38+
// Name returns the rule name
39+
func (r *GoogleComputeInterconnectInvalidNameRule) Name() string {
40+
return "google_compute_interconnect_invalid_name"
41+
}
42+
43+
// Enabled returns whether the rule is enabled by default
44+
func (r *GoogleComputeInterconnectInvalidNameRule) Enabled() bool {
45+
return true
46+
}
47+
48+
// Severity returns the rule severity
49+
func (r *GoogleComputeInterconnectInvalidNameRule) Severity() tflint.Severity {
50+
return tflint.ERROR
51+
}
52+
53+
// Link returns the rule reference link
54+
func (r *GoogleComputeInterconnectInvalidNameRule) Link() string {
55+
return ""
56+
}
57+
58+
// Check checks the pattern is valid
59+
func (r *GoogleComputeInterconnectInvalidNameRule) Check(runner tflint.Runner) error {
60+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
61+
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}},
62+
}, nil)
63+
if err != nil {
64+
return err
65+
}
66+
67+
for _, resource := range resources.Blocks {
68+
attribute, exists := resource.Body.Attributes[r.attributeName]
69+
if !exists {
70+
continue
71+
}
72+
73+
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
74+
validateFunc := validateRegexp(`^[a-z]([-a-z0-9]*[a-z0-9])?$`)
75+
76+
_, errors := validateFunc(val, r.attributeName)
77+
for _, err := range errors {
78+
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil {
79+
return err
80+
}
81+
}
82+
return nil
83+
}, nil)
84+
if err != nil {
85+
return err
86+
}
87+
}
88+
89+
return nil
90+
}

0 commit comments

Comments
 (0)