@@ -12,10 +12,10 @@ import (
1212)
1313
1414const (
15- // policiesResourceName is the name of the resource
16- policiesResourceName = "policy"
17- // featuresResourceName is the name of the policies per feature
18- featuresResourceName = "features"
15+ // fieldGKEPoliciesPolicy is the name of the resource
16+ fieldGKEPoliciesPolicy = "policy"
17+ // fieldGKEPoliciesFeatures is the name of the policies per feature
18+ fieldGKEPoliciesFeatures = "features"
1919 loadBalancersNetworkEndpointGroupFeature = "load_balancers_network_endpoint_group"
2020 loadBalancersTargetBackendPoolsFeature = "load_balancers_target_backend_pools"
2121 loadBalancersUnmanagedInstanceGroupsFeature = "load_balancers_unmanaged_instance_groups"
@@ -26,7 +26,7 @@ func dataSourceGKEPolicies() *schema.Resource {
2626 ReadContext : dataSourceGKEPoliciesRead ,
2727 Description : "Data source for retrieving GKE policies" ,
2828 Schema : map [string ]* schema.Schema {
29- featuresResourceName : {
29+ fieldGKEPoliciesFeatures : {
3030 Description : "Provide a list of GCP feature names to include the necessary policies for them to work." ,
3131 Type : schema .TypeList ,
3232 ForceNew : true ,
@@ -40,7 +40,7 @@ func dataSourceGKEPolicies() *schema.Resource {
4040 }, false ),
4141 },
4242 },
43- policiesResourceName : {
43+ fieldGKEPoliciesPolicy : {
4444 Type : schema .TypeList ,
4545 Computed : true ,
4646 Elem : & schema.Schema {Type : schema .TypeString },
@@ -51,7 +51,7 @@ func dataSourceGKEPolicies() *schema.Resource {
5151
5252func dataSourceGKEPoliciesRead (_ context.Context , data * schema.ResourceData , _ interface {}) diag.Diagnostics {
5353 // add policies per specified features
54- features , ok := data .Get (featuresResourceName ).([]interface {})
54+ features , ok := data .Get (fieldGKEPoliciesFeatures ).([]interface {})
5555 if ! ok {
5656 return diag .FromErr (fmt .Errorf ("failed to retrieve features" ))
5757 }
@@ -94,8 +94,8 @@ func dataSourceGKEPoliciesRead(_ context.Context, data *schema.ResourceData, _ i
9494 allPolicies = append (allPolicies , policy )
9595 }
9696
97- if err := data .Set (policiesResourceName , allPolicies ); err != nil {
98- return diag .FromErr (fmt .Errorf ("setting %s policy: %w" , policiesResourceName , err ))
97+ if err := data .Set (fieldGKEPoliciesPolicy , allPolicies ); err != nil {
98+ return diag .FromErr (fmt .Errorf ("setting %s policy: %w" , fieldGKEPoliciesPolicy , err ))
9999 }
100100 data .SetId ("gke" )
101101
0 commit comments