From ceab332ce75fb7e0a195623a841e138e146060e4 Mon Sep 17 00:00:00 2001 From: Alper Rifat Ulucinar Date: Tue, 14 May 2024 14:43:38 +0300 Subject: [PATCH] Replace config.Resource.OverrideFieldNames usages with config.Resource.PreviousVersions for the prevention of the type name conflicts in the generated multi-versioned CRDs. - config.Resource.OverrideFieldNames is being deprecated in favor of config.Resource.PreviousVersions. Signed-off-by: Alper Rifat Ulucinar --- .../zz_frontdoorfirewallpolicy_types.go | 90 +++++++- apis/network/v1beta1/zz_generated.deepcopy.go | 192 +++++++++++++++++- config/apimanagement/config.go | 28 --- config/keyvault/config.go | 9 - config/network/config.go | 67 ------ config/registry.go | 1 + config/servicebus/config.go | 6 - config/storage/config.go | 12 -- config/storagecache/config.go | 6 - go.mod | 2 +- go.sum | 2 - 11 files changed, 272 insertions(+), 143 deletions(-) diff --git a/apis/network/v1beta1/zz_frontdoorfirewallpolicy_types.go b/apis/network/v1beta1/zz_frontdoorfirewallpolicy_types.go index 40d4b228e..329f8f3dc 100755 --- a/apis/network/v1beta1/zz_frontdoorfirewallpolicy_types.go +++ b/apis/network/v1beta1/zz_frontdoorfirewallpolicy_types.go @@ -376,10 +376,49 @@ type MatchConditionParameters struct { Transforms []*string `json:"transforms,omitempty" tf:"transforms,omitempty"` } +type OverrideExclusionInitParameters struct { + + // The request variable to compare with. Possible values are Cookies, PostArgs, QueryString, RemoteAddr, RequestBody, RequestHeader, RequestMethod, RequestUri, or SocketAddr. + MatchVariable *string `json:"matchVariable,omitempty" tf:"match_variable,omitempty"` + + // Comparison type to use for matching with the variable value. Possible values are Any, BeginsWith, Contains, EndsWith, Equal, GeoMatch, GreaterThan, GreaterThanOrEqual, IPMatch, LessThan, LessThanOrEqual or RegEx. + Operator *string `json:"operator,omitempty" tf:"operator,omitempty"` + + // Match against a specific key if the match_variable is QueryString, PostArgs, RequestHeader or Cookies. + Selector *string `json:"selector,omitempty" tf:"selector,omitempty"` +} + +type OverrideExclusionObservation struct { + + // The request variable to compare with. Possible values are Cookies, PostArgs, QueryString, RemoteAddr, RequestBody, RequestHeader, RequestMethod, RequestUri, or SocketAddr. + MatchVariable *string `json:"matchVariable,omitempty" tf:"match_variable,omitempty"` + + // Comparison type to use for matching with the variable value. Possible values are Any, BeginsWith, Contains, EndsWith, Equal, GeoMatch, GreaterThan, GreaterThanOrEqual, IPMatch, LessThan, LessThanOrEqual or RegEx. + Operator *string `json:"operator,omitempty" tf:"operator,omitempty"` + + // Match against a specific key if the match_variable is QueryString, PostArgs, RequestHeader or Cookies. + Selector *string `json:"selector,omitempty" tf:"selector,omitempty"` +} + +type OverrideExclusionParameters struct { + + // The request variable to compare with. Possible values are Cookies, PostArgs, QueryString, RemoteAddr, RequestBody, RequestHeader, RequestMethod, RequestUri, or SocketAddr. + // +kubebuilder:validation:Optional + MatchVariable *string `json:"matchVariable" tf:"match_variable,omitempty"` + + // Comparison type to use for matching with the variable value. Possible values are Any, BeginsWith, Contains, EndsWith, Equal, GeoMatch, GreaterThan, GreaterThanOrEqual, IPMatch, LessThan, LessThanOrEqual or RegEx. + // +kubebuilder:validation:Optional + Operator *string `json:"operator" tf:"operator,omitempty"` + + // Match against a specific key if the match_variable is QueryString, PostArgs, RequestHeader or Cookies. + // +kubebuilder:validation:Optional + Selector *string `json:"selector" tf:"selector,omitempty"` +} + type OverrideInitParameters struct { // One or more exclusion blocks as defined below. - Exclusion []ManagedRuleExclusionInitParameters `json:"exclusion,omitempty" tf:"exclusion,omitempty"` + Exclusion []OverrideExclusionInitParameters `json:"exclusion,omitempty" tf:"exclusion,omitempty"` // One or more rule blocks as defined below. If none are specified, all of the rules in the group will be disabled. Rule []OverrideRuleInitParameters `json:"rule,omitempty" tf:"rule,omitempty"` @@ -391,7 +430,7 @@ type OverrideInitParameters struct { type OverrideObservation struct { // One or more exclusion blocks as defined below. - Exclusion []ManagedRuleExclusionObservation `json:"exclusion,omitempty" tf:"exclusion,omitempty"` + Exclusion []OverrideExclusionObservation `json:"exclusion,omitempty" tf:"exclusion,omitempty"` // One or more rule blocks as defined below. If none are specified, all of the rules in the group will be disabled. Rule []OverrideRuleObservation `json:"rule,omitempty" tf:"rule,omitempty"` @@ -404,7 +443,7 @@ type OverrideParameters struct { // One or more exclusion blocks as defined below. // +kubebuilder:validation:Optional - Exclusion []ManagedRuleExclusionParameters `json:"exclusion,omitempty" tf:"exclusion,omitempty"` + Exclusion []OverrideExclusionParameters `json:"exclusion,omitempty" tf:"exclusion,omitempty"` // One or more rule blocks as defined below. If none are specified, all of the rules in the group will be disabled. // +kubebuilder:validation:Optional @@ -424,7 +463,7 @@ type OverrideRuleInitParameters struct { Enabled *bool `json:"enabled,omitempty" tf:"enabled,omitempty"` // One or more exclusion blocks as defined below. - Exclusion []ManagedRuleExclusionInitParameters `json:"exclusion,omitempty" tf:"exclusion,omitempty"` + Exclusion []RuleExclusionInitParameters `json:"exclusion,omitempty" tf:"exclusion,omitempty"` // Identifier for the managed rule. RuleID *string `json:"ruleId,omitempty" tf:"rule_id,omitempty"` @@ -439,7 +478,7 @@ type OverrideRuleObservation struct { Enabled *bool `json:"enabled,omitempty" tf:"enabled,omitempty"` // One or more exclusion blocks as defined below. - Exclusion []ManagedRuleExclusionObservation `json:"exclusion,omitempty" tf:"exclusion,omitempty"` + Exclusion []RuleExclusionObservation `json:"exclusion,omitempty" tf:"exclusion,omitempty"` // Identifier for the managed rule. RuleID *string `json:"ruleId,omitempty" tf:"rule_id,omitempty"` @@ -457,13 +496,52 @@ type OverrideRuleParameters struct { // One or more exclusion blocks as defined below. // +kubebuilder:validation:Optional - Exclusion []ManagedRuleExclusionParameters `json:"exclusion,omitempty" tf:"exclusion,omitempty"` + Exclusion []RuleExclusionParameters `json:"exclusion,omitempty" tf:"exclusion,omitempty"` // Identifier for the managed rule. // +kubebuilder:validation:Optional RuleID *string `json:"ruleId" tf:"rule_id,omitempty"` } +type RuleExclusionInitParameters struct { + + // The request variable to compare with. Possible values are Cookies, PostArgs, QueryString, RemoteAddr, RequestBody, RequestHeader, RequestMethod, RequestUri, or SocketAddr. + MatchVariable *string `json:"matchVariable,omitempty" tf:"match_variable,omitempty"` + + // Comparison type to use for matching with the variable value. Possible values are Any, BeginsWith, Contains, EndsWith, Equal, GeoMatch, GreaterThan, GreaterThanOrEqual, IPMatch, LessThan, LessThanOrEqual or RegEx. + Operator *string `json:"operator,omitempty" tf:"operator,omitempty"` + + // Match against a specific key if the match_variable is QueryString, PostArgs, RequestHeader or Cookies. + Selector *string `json:"selector,omitempty" tf:"selector,omitempty"` +} + +type RuleExclusionObservation struct { + + // The request variable to compare with. Possible values are Cookies, PostArgs, QueryString, RemoteAddr, RequestBody, RequestHeader, RequestMethod, RequestUri, or SocketAddr. + MatchVariable *string `json:"matchVariable,omitempty" tf:"match_variable,omitempty"` + + // Comparison type to use for matching with the variable value. Possible values are Any, BeginsWith, Contains, EndsWith, Equal, GeoMatch, GreaterThan, GreaterThanOrEqual, IPMatch, LessThan, LessThanOrEqual or RegEx. + Operator *string `json:"operator,omitempty" tf:"operator,omitempty"` + + // Match against a specific key if the match_variable is QueryString, PostArgs, RequestHeader or Cookies. + Selector *string `json:"selector,omitempty" tf:"selector,omitempty"` +} + +type RuleExclusionParameters struct { + + // The request variable to compare with. Possible values are Cookies, PostArgs, QueryString, RemoteAddr, RequestBody, RequestHeader, RequestMethod, RequestUri, or SocketAddr. + // +kubebuilder:validation:Optional + MatchVariable *string `json:"matchVariable" tf:"match_variable,omitempty"` + + // Comparison type to use for matching with the variable value. Possible values are Any, BeginsWith, Contains, EndsWith, Equal, GeoMatch, GreaterThan, GreaterThanOrEqual, IPMatch, LessThan, LessThanOrEqual or RegEx. + // +kubebuilder:validation:Optional + Operator *string `json:"operator" tf:"operator,omitempty"` + + // Match against a specific key if the match_variable is QueryString, PostArgs, RequestHeader or Cookies. + // +kubebuilder:validation:Optional + Selector *string `json:"selector" tf:"selector,omitempty"` +} + // FrontdoorFirewallPolicySpec defines the desired state of FrontdoorFirewallPolicy type FrontdoorFirewallPolicySpec struct { v1.ResourceSpec `json:",inline"` diff --git a/apis/network/v1beta1/zz_generated.deepcopy.go b/apis/network/v1beta1/zz_generated.deepcopy.go index a3de54997..91b766554 100644 --- a/apis/network/v1beta1/zz_generated.deepcopy.go +++ b/apis/network/v1beta1/zz_generated.deepcopy.go @@ -28788,12 +28788,102 @@ func (in *O365PolicyParameters) DeepCopy() *O365PolicyParameters { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OverrideExclusionInitParameters) DeepCopyInto(out *OverrideExclusionInitParameters) { + *out = *in + if in.MatchVariable != nil { + in, out := &in.MatchVariable, &out.MatchVariable + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OverrideExclusionInitParameters. +func (in *OverrideExclusionInitParameters) DeepCopy() *OverrideExclusionInitParameters { + if in == nil { + return nil + } + out := new(OverrideExclusionInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OverrideExclusionObservation) DeepCopyInto(out *OverrideExclusionObservation) { + *out = *in + if in.MatchVariable != nil { + in, out := &in.MatchVariable, &out.MatchVariable + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OverrideExclusionObservation. +func (in *OverrideExclusionObservation) DeepCopy() *OverrideExclusionObservation { + if in == nil { + return nil + } + out := new(OverrideExclusionObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OverrideExclusionParameters) DeepCopyInto(out *OverrideExclusionParameters) { + *out = *in + if in.MatchVariable != nil { + in, out := &in.MatchVariable, &out.MatchVariable + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OverrideExclusionParameters. +func (in *OverrideExclusionParameters) DeepCopy() *OverrideExclusionParameters { + if in == nil { + return nil + } + out := new(OverrideExclusionParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OverrideInitParameters) DeepCopyInto(out *OverrideInitParameters) { *out = *in if in.Exclusion != nil { in, out := &in.Exclusion, &out.Exclusion - *out = make([]ManagedRuleExclusionInitParameters, len(*in)) + *out = make([]OverrideExclusionInitParameters, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -28827,7 +28917,7 @@ func (in *OverrideObservation) DeepCopyInto(out *OverrideObservation) { *out = *in if in.Exclusion != nil { in, out := &in.Exclusion, &out.Exclusion - *out = make([]ManagedRuleExclusionObservation, len(*in)) + *out = make([]OverrideExclusionObservation, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -28861,7 +28951,7 @@ func (in *OverrideParameters) DeepCopyInto(out *OverrideParameters) { *out = *in if in.Exclusion != nil { in, out := &in.Exclusion, &out.Exclusion - *out = make([]ManagedRuleExclusionParameters, len(*in)) + *out = make([]OverrideExclusionParameters, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -28905,7 +28995,7 @@ func (in *OverrideRuleInitParameters) DeepCopyInto(out *OverrideRuleInitParamete } if in.Exclusion != nil { in, out := &in.Exclusion, &out.Exclusion - *out = make([]ManagedRuleExclusionInitParameters, len(*in)) + *out = make([]RuleExclusionInitParameters, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -28942,7 +29032,7 @@ func (in *OverrideRuleObservation) DeepCopyInto(out *OverrideRuleObservation) { } if in.Exclusion != nil { in, out := &in.Exclusion, &out.Exclusion - *out = make([]ManagedRuleExclusionObservation, len(*in)) + *out = make([]RuleExclusionObservation, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -28979,7 +29069,7 @@ func (in *OverrideRuleParameters) DeepCopyInto(out *OverrideRuleParameters) { } if in.Exclusion != nil { in, out := &in.Exclusion, &out.Exclusion - *out = make([]ManagedRuleExclusionParameters, len(*in)) + *out = make([]RuleExclusionParameters, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -41309,6 +41399,96 @@ func (in *RuleActionParameters) DeepCopy() *RuleActionParameters { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleExclusionInitParameters) DeepCopyInto(out *RuleExclusionInitParameters) { + *out = *in + if in.MatchVariable != nil { + in, out := &in.MatchVariable, &out.MatchVariable + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleExclusionInitParameters. +func (in *RuleExclusionInitParameters) DeepCopy() *RuleExclusionInitParameters { + if in == nil { + return nil + } + out := new(RuleExclusionInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleExclusionObservation) DeepCopyInto(out *RuleExclusionObservation) { + *out = *in + if in.MatchVariable != nil { + in, out := &in.MatchVariable, &out.MatchVariable + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleExclusionObservation. +func (in *RuleExclusionObservation) DeepCopy() *RuleExclusionObservation { + if in == nil { + return nil + } + out := new(RuleExclusionObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RuleExclusionParameters) DeepCopyInto(out *RuleExclusionParameters) { + *out = *in + if in.MatchVariable != nil { + in, out := &in.MatchVariable, &out.MatchVariable + *out = new(string) + **out = **in + } + if in.Operator != nil { + in, out := &in.Operator, &out.Operator + *out = new(string) + **out = **in + } + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleExclusionParameters. +func (in *RuleExclusionParameters) DeepCopy() *RuleExclusionParameters { + if in == nil { + return nil + } + out := new(RuleExclusionParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RuleGroupInitParameters) DeepCopyInto(out *RuleGroupInitParameters) { *out = *in diff --git a/config/apimanagement/config.go b/config/apimanagement/config.go index cafd7c7a1..c37f7a2ed 100644 --- a/config/apimanagement/config.go +++ b/config/apimanagement/config.go @@ -104,34 +104,6 @@ func Configure(p *config.Provider) { p.AddResourceConfigurator("azurerm_api_management_api_release", func(r *config.Resource) { r.TerraformCustomDiff = apiIdCustomDiff }) - p.AddResourceConfigurator("azurerm_api_management_certificate", func(r *config.Resource) { - r.OverrideFieldNames["CertificateParameters"] = "CertificateParameters_2" - r.OverrideFieldNames["CertificateInitParameters"] = "CertificateInitParameters_2" - r.OverrideFieldNames["CertificateObservation"] = "CertificateObservation_2" - }) - p.AddResourceConfigurator("azurerm_api_management_custom_domain", func(r *config.Resource) { - r.OverrideFieldNames["DeveloperPortalParameters"] = "CustomDomainDeveloperPortalParameters" - r.OverrideFieldNames["DeveloperPortalInitParameters"] = "CustomDomainDeveloperPortalInitParameters" - r.OverrideFieldNames["DeveloperPortalObservation"] = "CustomDomainDeveloperPortalObservation" - - r.OverrideFieldNames["ManagementParameters"] = "CustomDomainManagementParameters" - r.OverrideFieldNames["ManagementInitParameters"] = "CustomDomainManagementInitParameters" - r.OverrideFieldNames["ManagementObservation"] = "CustomDomainManagementObservation" - - r.OverrideFieldNames["PortalParameters"] = "CustomDomainPortalParameters" - r.OverrideFieldNames["PortalInitParameters"] = "CustomDomainPortalInitParameters" - r.OverrideFieldNames["PortalObservation"] = "CustomDomainPortalObservation" - - r.OverrideFieldNames["ScmParameters"] = "CustomDomainScmParameters" - r.OverrideFieldNames["ScmInitParameters"] = "CustomDomainScmInitParameters" - r.OverrideFieldNames["ScmObservation"] = "CustomDomainScmObservation" - }) - - p.AddResourceConfigurator("azurerm_api_management_policy", func(r *config.Resource) { - r.OverrideFieldNames["PolicyParameters"] = "PolicyParameters_2" - r.OverrideFieldNames["PolicyInitParameters"] = "PolicyInitParameters_2" - r.OverrideFieldNames["PolicyObservation"] = "PolicyObservation_2" - }) } func apiIdCustomDiff(diff *terraform.InstanceDiff, state *terraform.InstanceState, resourceConfig *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { //nolint:gocyclo diff --git a/config/keyvault/config.go b/config/keyvault/config.go index d6a201404..5add01fcc 100644 --- a/config/keyvault/config.go +++ b/config/keyvault/config.go @@ -64,9 +64,6 @@ func Configure(p *config.Provider) { TerraformName: "azurerm_key_vault", Extractor: rconfig.ExtractResourceIDFuncPath, } - r.OverrideFieldNames["AccessPolicyParameters"] = "AccessPolicyParameters_2" - r.OverrideFieldNames["AccessPolicyInitParameters"] = "AccessPolicyInitParameters_2" - r.OverrideFieldNames["AccessPolicyObservation"] = "AccessPolicyObservation_2" }) p.AddResourceConfigurator("azurerm_key_vault_managed_storage_account_sas_token_definition", func(r *config.Resource) { @@ -75,10 +72,4 @@ func Configure(p *config.Provider) { Extractor: rconfig.ExtractResourceIDFuncPath, } }) - - p.AddResourceConfigurator("azurerm_key_vault_certificate_contacts", func(r *config.Resource) { - r.OverrideFieldNames["ContactParameters"] = "CertificateContactsContactParameters" - r.OverrideFieldNames["ContactInitParameters"] = "CertificateContactsContactInitParameters" - r.OverrideFieldNames["ContactObservation"] = "CertificateContactsContactObservation" - }) } diff --git a/config/network/config.go b/config/network/config.go index 4f29e5164..9a6d0f5d6 100644 --- a/config/network/config.go +++ b/config/network/config.go @@ -24,10 +24,6 @@ func Configure(p *config.Provider) { TerraformName: "azurerm_public_ip", Extractor: rconfig.ExtractResourceIDFuncPath, } - - r.OverrideFieldNames["IPConfigurationInitParameters"] = "NetworkInterfaceIPConfigurationInitParameters" - r.OverrideFieldNames["IPConfigurationParameters"] = "NetworkInterfaceIPConfigurationParameters" - r.OverrideFieldNames["IPConfigurationObservation"] = "NetworkInterfaceIPConfigurationObservation" }) p.AddResourceConfigurator("azurerm_lb", func(r *config.Resource) { @@ -37,9 +33,6 @@ func Configure(p *config.Provider) { TerraformName: "azurerm_public_ip", Extractor: rconfig.ExtractResourceIDFuncPath, } - r.OverrideFieldNames["FrontendIPConfigurationParameters"] = "LoadBalancerFrontendIPConfigurationParameters" - r.OverrideFieldNames["FrontendIPConfigurationInitParameters"] = "LoadBalancerFrontendIPConfigurationInitParameters" - r.OverrideFieldNames["FrontendIPConfigurationObservation"] = "LoadBalancerFrontendIPConfigurationObservation" }) p.AddResourceConfigurator("azurerm_lb_backend_address_pool", func(r *config.Resource) { @@ -88,10 +81,6 @@ func Configure(p *config.Provider) { TerraformName: "azurerm_lb", Extractor: rconfig.ExtractResourceIDFuncPath, } - - r.OverrideFieldNames["FrontendIPConfigurationInitParameters"] = "LoadBalancerOutboundRuleFrontendIPConfigurationInitParameters" - r.OverrideFieldNames["FrontendIPConfigurationParameters"] = "LoadBalancerOutboundRuleFrontendIPConfigurationParameters" - r.OverrideFieldNames["FrontendIPConfigurationObservation"] = "LoadBalancerOutboundRuleFrontendIPConfigurationObservation" }) p.AddResourceConfigurator("azurerm_lb_probe", func(r *config.Resource) { @@ -539,14 +528,6 @@ func Configure(p *config.Provider) { Extractor: rconfig.ExtractResourceIDFuncPath, } r.UseAsync = true - r.OverrideFieldNames["VirtualHubParameters"] = "VirtualHubParameters_2" - r.OverrideFieldNames["VirtualHubInitParameters"] = "VirtualHubInitParameters_2" - r.OverrideFieldNames["VirtualHubObservation"] = "VirtualHubObservation_2" - - r.OverrideFieldNames["RouteInitParameters"] = "VirtualHubRouteInitParameters" - r.OverrideFieldNames["RouteParameters"] = "VirtualHubRouteParameters" - r.OverrideFieldNames["RouteObservation"] = "VirtualHubRouteObservation" - }) p.AddResourceConfigurator("azurerm_frontdoor", func(r *config.Resource) { @@ -593,18 +574,6 @@ func Configure(p *config.Provider) { r.Kind = "SubnetServiceEndpointStoragePolicy" }) - p.AddResourceConfigurator("azurerm_route_table", func(r *config.Resource) { - r.OverrideFieldNames["RouteInitParameters"] = "RouteTableRouteInitParameters" - r.OverrideFieldNames["RouteParameters"] = "RouteTableRouteParameters" - r.OverrideFieldNames["RouteObservation"] = "RouteTableRouteObservation" - }) - - p.AddResourceConfigurator("azurerm_virtual_hub_route_table", func(r *config.Resource) { - r.OverrideFieldNames["RouteInitParameters"] = "VirtualHubRouteTableRouteInitParameters" - r.OverrideFieldNames["RouteParameters"] = "VirtualHubRouteTableRouteParameters" - r.OverrideFieldNames["RouteObservation"] = "VirtualHubRouteTableRouteObservation" - }) - p.AddResourceConfigurator("azurerm_subnet_route_table_association", func(r *config.Resource) { r.Kind = "SubnetRouteTableAssociation" r.References["subnet_id"] = config.Reference{ @@ -639,40 +608,4 @@ func Configure(p *config.Provider) { return diff, nil } }) - - p.AddResourceConfigurator("azurerm_frontdoor_firewall_policy", func(r *config.Resource) { - r.OverrideFieldNames["ExclusionParameters"] = "ManagedRuleExclusionParameters" - r.OverrideFieldNames["ExclusionInitParameters"] = "ManagedRuleExclusionInitParameters" - r.OverrideFieldNames["ExclusionObservation"] = "ManagedRuleExclusionObservation" - }) - - p.AddResourceConfigurator("azurerm_route", func(r *config.Resource) { - r.OverrideFieldNames["RouteParameters"] = "RouteParameters_2" - r.OverrideFieldNames["RouteInitParameters"] = "RouteInitParameters_2" - r.OverrideFieldNames["RouteObservation"] = "RouteObservation_2" - }) - - p.AddResourceConfigurator("azurerm_route_map", func(r *config.Resource) { - r.OverrideFieldNames["ActionParameters"] = "RuleActionParameters" - r.OverrideFieldNames["ActionInitParameters"] = "RuleActionInitParameters" - r.OverrideFieldNames["ActionObservation"] = "RuleActionObservation" - }) - - p.AddResourceConfigurator("azurerm_traffic_manager_azure_endpoint", func(r *config.Resource) { - r.OverrideFieldNames["SubnetParameters"] = "TrafficManagerAzureEndpointSubnetParameters" - r.OverrideFieldNames["SubnetInitParameters"] = "TrafficManagerAzureEndpointSubnetInitParameters" - r.OverrideFieldNames["SubnetObservation"] = "TrafficManagerAzureEndpointSubnetObservation" - }) - - p.AddResourceConfigurator("azurerm_traffic_manager_external_endpoint", func(r *config.Resource) { - r.OverrideFieldNames["SubnetInitParameters"] = "TrafficManagerExternalEndpointSubnetInitParameters" - r.OverrideFieldNames["SubnetParameters"] = "TrafficManagerExternalEndpointSubnetParameters" - r.OverrideFieldNames["SubnetObservation"] = "TrafficManagerExternalEndpointSubnetObservation" - }) - - p.AddResourceConfigurator("azurerm_traffic_manager_nested_endpoint", func(r *config.Resource) { - r.OverrideFieldNames["SubnetInitParameters"] = "TrafficManagerNestedEndpointSubnetInitParameters" - r.OverrideFieldNames["SubnetParameters"] = "TrafficManagerNestedEndpointSubnetParameters" - r.OverrideFieldNames["SubnetObservation"] = "TrafficManagerNestedEndpointSubnetObservation" - }) } diff --git a/config/registry.go b/config/registry.go index 6f43c191b..8b7d61fa9 100644 --- a/config/registry.go +++ b/config/registry.go @@ -193,6 +193,7 @@ func bumpVersionsWithEmbeddedLists(pc *ujconfig.Provider) { continue } r.Version = "v1beta2" + r.PreviousVersions = []string{"v1beta1"} // we would like to set the storage version to v1beta1 to facilitate // downgrades. r.SetCRDStorageVersion("v1beta1") diff --git a/config/servicebus/config.go b/config/servicebus/config.go index d906bf2b9..6e3e88f80 100644 --- a/config/servicebus/config.go +++ b/config/servicebus/config.go @@ -16,10 +16,4 @@ func Configure(p *config.Provider) { // https://github.com/kubernetes/kubernetes/pull/108382 r.Kind = "ServiceBusNamespace" }) - - p.AddResourceConfigurator("azurerm_servicebus_namespace_network_rule_set", func(r *config.Resource) { - r.OverrideFieldNames["NetworkRulesParameters"] = "NamespaceNetworkRuleSetNetworkRulesParameters" - r.OverrideFieldNames["NetworkRulesInitParameters"] = "NamespaceNetworkRuleSetNetworkRulesInitParameters" - r.OverrideFieldNames["NetworkRulesObservation"] = "NamespaceNetworkRuleSetNetworkRulesObservation" - }) } diff --git a/config/storage/config.go b/config/storage/config.go index eb9df020e..c3a4dfb4a 100644 --- a/config/storage/config.go +++ b/config/storage/config.go @@ -42,16 +42,4 @@ func Configure(p *config.Provider) { p.AddResourceConfigurator("azurerm_storage_management_policy", func(r *config.Resource) { r.ExternalName.IdentifierFields = common.RemoveIndex(r.ExternalName.IdentifierFields, "storage_account_id") }) - - p.AddResourceConfigurator("azurerm_storage_account_network_rules", func(r *config.Resource) { - r.OverrideFieldNames["PrivateLinkAccessParameters"] = "AccountNetworkRulesPrivateLinkAccessParameters" - r.OverrideFieldNames["PrivateLinkAccessInitParameters"] = "AccountNetworkRulesPrivateLinkAccessInitParameters" - r.OverrideFieldNames["PrivateLinkAccessObservation"] = "AccountNetworkRulesPrivateLinkAccessObservation" - }) - - p.AddResourceConfigurator("azurerm_storage_object_replication", func(r *config.Resource) { - r.OverrideFieldNames["RulesParameters"] = "ObjectReplicationRulesParameters" - r.OverrideFieldNames["RulesInitParameters"] = "ObjectReplicationRulesInitParameters" - r.OverrideFieldNames["RulesObservation"] = "ObjectReplicationRulesObservation" - }) } diff --git a/config/storagecache/config.go b/config/storagecache/config.go index 783a0f771..d86c0cbd4 100644 --- a/config/storagecache/config.go +++ b/config/storagecache/config.go @@ -13,10 +13,4 @@ func Configure(p *config.Provider) { p.AddResourceConfigurator("azurerm_hpc_cache_nfs_target", func(r *config.Resource) { delete(r.References, "target_host_name") }) - - p.AddResourceConfigurator("azurerm_hpc_cache_access_policy", func(r *config.Resource) { - r.OverrideFieldNames["AccessRuleParameters"] = "HPCCacheAccessPolicyAccessRuleParameters" - r.OverrideFieldNames["AccessRuleInitParameters"] = "HPCCacheAccessPolicyAccessRuleInitParameters" - r.OverrideFieldNames["AccessRuleObservation"] = "HPCCacheAccessPolicyAccessRuleObservation" - }) } diff --git a/go.mod b/go.mod index 2247464f8..6eabd87d3 100644 --- a/go.mod +++ b/go.mod @@ -169,4 +169,4 @@ replace github.com/hashicorp/terraform-provider-azurerm => github.com/upbound/te replace github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 -replace github.com/crossplane/upjet => github.com/ulucinar/upbound-upjet v0.0.0-20240510150048-94634891cc5a +replace github.com/crossplane/upjet => ../upjet diff --git a/go.sum b/go.sum index 90a45ec83..37c9ef8ac 100644 --- a/go.sum +++ b/go.sum @@ -356,8 +356,6 @@ github.com/tombuildsstuff/giovanni v0.20.0 h1:IM/I/iNWMXnPYwcSq8uxV7TKDlv7Nejq0b github.com/tombuildsstuff/giovanni v0.20.0/go.mod h1:66KVLYma2whJhEdxPSPL3GQHkulhK+C5CluKfHGfPF4= github.com/tombuildsstuff/kermit v0.20240122.1123108 h1:icQaxsv/ANv/KC4Sr0V1trrWA/XIL+3QAVBDpiSTgj8= github.com/tombuildsstuff/kermit v0.20240122.1123108/go.mod h1:T3YBVFhRV4qA7SbnRaNE6eapIMpKDA9rG/V7Ocsjlno= -github.com/ulucinar/upbound-upjet v0.0.0-20240510150048-94634891cc5a h1:KNFeHy6dvZvY8ZS+OqYI216nJamQNh5Kem1h3KM0pXQ= -github.com/ulucinar/upbound-upjet v0.0.0-20240510150048-94634891cc5a/go.mod h1:3pDVtCgyBc5f2Zx4K5HEPxxhjndmOc5CHCJNpIivK/g= github.com/upbound/terraform-provider-azurerm v0.0.0-20240311113236-25a51734d3da h1:Rj/LhOVcK8IOSIBYk7L6LZpuOHsXkkit+JrV4nNmi9o= github.com/upbound/terraform-provider-azurerm v0.0.0-20240311113236-25a51734d3da/go.mod h1:GCUoUr4wIRHz+ZYmDI3Y1oE0M64rqJcr3oY60wwJdVc= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=