From 22f6bb8dd8940680758a80b9f436d2d7961f8845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergen=20Yal=C3=A7=C4=B1n?= Date: Wed, 3 Jan 2024 17:50:54 +0300 Subject: [PATCH] Remove the following fields from IdentifierFields slices: - azurerm_api_management_gateway.api_management_id - azurerm_resource_group_policy_assignment.resource_group_id - azurerm_container_connected_registry.container_registry_id - azurerm_container_registry_webhook.registry_name - azurerm_storage_encryption_scope.storage_account_id - azurerm_storage_management_policy.storage_account_id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergen Yalçın --- .../apimanagement/v1beta1/zz_gateway_types.go | 13 +++ .../v1beta1/zz_generated.deepcopy.go | 15 ++++ .../v1beta1/zz_generated.resolvers.go | 16 ++++ .../v1beta1/zz_generated.deepcopy.go | 15 ++++ .../v1beta1/zz_generated.resolvers.go | 16 ++++ .../zz_resourcegrouppolicyassignment_types.go | 13 +++ .../zz_containerconnectedregistry_types.go | 13 +++ .../v1beta1/zz_generated.deepcopy.go | 30 +++++++ .../v1beta1/zz_generated.resolvers.go | 32 ++++++++ .../v1beta1/zz_webhook_types.go | 12 +++ .../v1beta1/zz_encryptionscope_types.go | 13 +++ apis/storage/v1beta1/zz_generated.deepcopy.go | 30 +++++++ .../storage/v1beta1/zz_generated.resolvers.go | 32 ++++++++ .../v1beta1/zz_managementpolicy_types.go | 13 +++ config/apimanagement/config.go | 4 + config/authorization/config.go | 5 ++ config/common/common.go | 10 +++ config/containerregistry/config.go | 6 ++ config/storage/config.go | 13 ++- ...imanagement.azure.upbound.io_gateways.yaml | 80 +++++++++++++++++++ ...und.io_resourcegrouppolicyassignments.yaml | 80 +++++++++++++++++++ ...bound.io_containerconnectedregistries.yaml | 78 ++++++++++++++++++ ...nerregistry.azure.upbound.io_webhooks.yaml | 79 ++++++++++++++++++ ...age.azure.upbound.io_encryptionscopes.yaml | 78 ++++++++++++++++++ ...e.azure.upbound.io_managementpolicies.yaml | 78 ++++++++++++++++++ 25 files changed, 772 insertions(+), 2 deletions(-) diff --git a/apis/apimanagement/v1beta1/zz_gateway_types.go b/apis/apimanagement/v1beta1/zz_gateway_types.go index c9c18311d..a0214d4a2 100755 --- a/apis/apimanagement/v1beta1/zz_gateway_types.go +++ b/apis/apimanagement/v1beta1/zz_gateway_types.go @@ -19,6 +19,19 @@ import ( type GatewayInitParameters struct { + // The ID of the API Management Resource in which the gateway will be created. Changing this forces a new API Management Gateway resource to be created. + // +crossplane:generate:reference:type=github.com/upbound/provider-azure/apis/apimanagement/v1beta1.Management + // +crossplane:generate:reference:extractor=github.com/crossplane/upjet/pkg/resource.ExtractResourceID() + APIManagementID *string `json:"apiManagementId,omitempty" tf:"api_management_id,omitempty"` + + // Reference to a Management in apimanagement to populate apiManagementId. + // +kubebuilder:validation:Optional + APIManagementIDRef *v1.Reference `json:"apiManagementIdRef,omitempty" tf:"-"` + + // Selector for a Management in apimanagement to populate apiManagementId. + // +kubebuilder:validation:Optional + APIManagementIDSelector *v1.Selector `json:"apiManagementIdSelector,omitempty" tf:"-"` + // The description of the API Management Gateway. Description *string `json:"description,omitempty" tf:"description,omitempty"` diff --git a/apis/apimanagement/v1beta1/zz_generated.deepcopy.go b/apis/apimanagement/v1beta1/zz_generated.deepcopy.go index 12fe2bf42..d1f633b7f 100644 --- a/apis/apimanagement/v1beta1/zz_generated.deepcopy.go +++ b/apis/apimanagement/v1beta1/zz_generated.deepcopy.go @@ -8905,6 +8905,21 @@ func (in *GatewayAPIStatus) DeepCopy() *GatewayAPIStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GatewayInitParameters) DeepCopyInto(out *GatewayInitParameters) { *out = *in + if in.APIManagementID != nil { + in, out := &in.APIManagementID, &out.APIManagementID + *out = new(string) + **out = **in + } + if in.APIManagementIDRef != nil { + in, out := &in.APIManagementIDRef, &out.APIManagementIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.APIManagementIDSelector != nil { + in, out := &in.APIManagementIDSelector, &out.APIManagementIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.Description != nil { in, out := &in.Description, &out.Description *out = new(string) diff --git a/apis/apimanagement/v1beta1/zz_generated.resolvers.go b/apis/apimanagement/v1beta1/zz_generated.resolvers.go index de60eccce..e4bbef624 100644 --- a/apis/apimanagement/v1beta1/zz_generated.resolvers.go +++ b/apis/apimanagement/v1beta1/zz_generated.resolvers.go @@ -816,6 +816,22 @@ func (mg *Gateway) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.APIManagementID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.APIManagementIDRef = rsp.ResolvedReference + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.APIManagementID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.APIManagementIDRef, + Selector: mg.Spec.InitProvider.APIManagementIDSelector, + To: reference.To{ + List: &ManagementList{}, + Managed: &Management{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.APIManagementID") + } + mg.Spec.InitProvider.APIManagementID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.APIManagementIDRef = rsp.ResolvedReference + return nil } diff --git a/apis/authorization/v1beta1/zz_generated.deepcopy.go b/apis/authorization/v1beta1/zz_generated.deepcopy.go index d9290ba93..93c935be5 100644 --- a/apis/authorization/v1beta1/zz_generated.deepcopy.go +++ b/apis/authorization/v1beta1/zz_generated.deepcopy.go @@ -1171,6 +1171,21 @@ func (in *ResourceGroupPolicyAssignmentInitParameters) DeepCopyInto(out *Resourc *out = new(v1.Selector) (*in).DeepCopyInto(*out) } + if in.ResourceGroupID != nil { + in, out := &in.ResourceGroupID, &out.ResourceGroupID + *out = new(string) + **out = **in + } + if in.ResourceGroupIDRef != nil { + in, out := &in.ResourceGroupIDRef, &out.ResourceGroupIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ResourceGroupIDSelector != nil { + in, out := &in.ResourceGroupIDSelector, &out.ResourceGroupIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.ResourceSelectors != nil { in, out := &in.ResourceSelectors, &out.ResourceSelectors *out = make([]ResourceSelectorsInitParameters, len(*in)) diff --git a/apis/authorization/v1beta1/zz_generated.resolvers.go b/apis/authorization/v1beta1/zz_generated.resolvers.go index 7fe811e7c..084c230a9 100644 --- a/apis/authorization/v1beta1/zz_generated.resolvers.go +++ b/apis/authorization/v1beta1/zz_generated.resolvers.go @@ -111,6 +111,22 @@ func (mg *ResourceGroupPolicyAssignment) ResolveReferences(ctx context.Context, mg.Spec.InitProvider.PolicyDefinitionID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.InitProvider.PolicyDefinitionIDRef = rsp.ResolvedReference + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ResourceGroupID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ResourceGroupIDRef, + Selector: mg.Spec.InitProvider.ResourceGroupIDSelector, + To: reference.To{ + List: &v1beta1.ResourceGroupList{}, + Managed: &v1beta1.ResourceGroup{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.ResourceGroupID") + } + mg.Spec.InitProvider.ResourceGroupID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.ResourceGroupIDRef = rsp.ResolvedReference + return nil } diff --git a/apis/authorization/v1beta1/zz_resourcegrouppolicyassignment_types.go b/apis/authorization/v1beta1/zz_resourcegrouppolicyassignment_types.go index 49247fc1e..86c17b5a6 100755 --- a/apis/authorization/v1beta1/zz_resourcegrouppolicyassignment_types.go +++ b/apis/authorization/v1beta1/zz_resourcegrouppolicyassignment_types.go @@ -158,6 +158,19 @@ type ResourceGroupPolicyAssignmentInitParameters struct { // +kubebuilder:validation:Optional PolicyDefinitionIDSelector *v1.Selector `json:"policyDefinitionIdSelector,omitempty" tf:"-"` + // The ID of the Resource Group where this Policy Assignment should be created. Changing this forces a new Policy Assignment to be created. + // +crossplane:generate:reference:type=github.com/upbound/provider-azure/apis/azure/v1beta1.ResourceGroup + // +crossplane:generate:reference:extractor=github.com/crossplane/upjet/pkg/resource.ExtractResourceID() + ResourceGroupID *string `json:"resourceGroupId,omitempty" tf:"resource_group_id,omitempty"` + + // Reference to a ResourceGroup in azure to populate resourceGroupId. + // +kubebuilder:validation:Optional + ResourceGroupIDRef *v1.Reference `json:"resourceGroupIdRef,omitempty" tf:"-"` + + // Selector for a ResourceGroup in azure to populate resourceGroupId. + // +kubebuilder:validation:Optional + ResourceGroupIDSelector *v1.Selector `json:"resourceGroupIdSelector,omitempty" tf:"-"` + // One or more resource_selectors blocks as defined below to filter polices by resource properties. ResourceSelectors []ResourceSelectorsInitParameters `json:"resourceSelectors,omitempty" tf:"resource_selectors,omitempty"` } diff --git a/apis/containerregistry/v1beta1/zz_containerconnectedregistry_types.go b/apis/containerregistry/v1beta1/zz_containerconnectedregistry_types.go index e96ea35e5..cb2a13241 100755 --- a/apis/containerregistry/v1beta1/zz_containerconnectedregistry_types.go +++ b/apis/containerregistry/v1beta1/zz_containerconnectedregistry_types.go @@ -25,6 +25,19 @@ type ContainerConnectedRegistryInitParameters struct { // Specifies a list of IDs of Container Registry Tokens, which are meant to be used by the clients to connect to the Connected Registry. ClientTokenIds []*string `json:"clientTokenIds,omitempty" tf:"client_token_ids,omitempty"` + // The ID of the Container Registry that this Connected Registry will reside in. Changing this forces a new Container Connected Registry to be created. + // +crossplane:generate:reference:type=Registry + // +crossplane:generate:reference:extractor=github.com/upbound/provider-azure/apis/rconfig.ExtractResourceID() + ContainerRegistryID *string `json:"containerRegistryId,omitempty" tf:"container_registry_id,omitempty"` + + // Reference to a Registry to populate containerRegistryId. + // +kubebuilder:validation:Optional + ContainerRegistryIDRef *v1.Reference `json:"containerRegistryIdRef,omitempty" tf:"-"` + + // Selector for a Registry to populate containerRegistryId. + // +kubebuilder:validation:Optional + ContainerRegistryIDSelector *v1.Selector `json:"containerRegistryIdSelector,omitempty" tf:"-"` + // The verbosity of the logs. Possible values are None, Debug, Information, Warning and Error. LogLevel *string `json:"logLevel,omitempty" tf:"log_level,omitempty"` diff --git a/apis/containerregistry/v1beta1/zz_generated.deepcopy.go b/apis/containerregistry/v1beta1/zz_generated.deepcopy.go index 224218a66..cf9be8798 100644 --- a/apis/containerregistry/v1beta1/zz_generated.deepcopy.go +++ b/apis/containerregistry/v1beta1/zz_generated.deepcopy.go @@ -371,6 +371,21 @@ func (in *ContainerConnectedRegistryInitParameters) DeepCopyInto(out *ContainerC } } } + if in.ContainerRegistryID != nil { + in, out := &in.ContainerRegistryID, &out.ContainerRegistryID + *out = new(string) + **out = **in + } + if in.ContainerRegistryIDRef != nil { + in, out := &in.ContainerRegistryIDRef, &out.ContainerRegistryIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ContainerRegistryIDSelector != nil { + in, out := &in.ContainerRegistryIDSelector, &out.ContainerRegistryIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.LogLevel != nil { in, out := &in.LogLevel, &out.LogLevel *out = new(string) @@ -2913,6 +2928,21 @@ func (in *WebhookInitParameters) DeepCopyInto(out *WebhookInitParameters) { *out = new(string) **out = **in } + if in.RegistryName != nil { + in, out := &in.RegistryName, &out.RegistryName + *out = new(string) + **out = **in + } + if in.RegistryNameRef != nil { + in, out := &in.RegistryNameRef, &out.RegistryNameRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.RegistryNameSelector != nil { + in, out := &in.RegistryNameSelector, &out.RegistryNameSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.Scope != nil { in, out := &in.Scope, &out.Scope *out = new(string) diff --git a/apis/containerregistry/v1beta1/zz_generated.resolvers.go b/apis/containerregistry/v1beta1/zz_generated.resolvers.go index 3a83fe640..11be429fb 100644 --- a/apis/containerregistry/v1beta1/zz_generated.resolvers.go +++ b/apis/containerregistry/v1beta1/zz_generated.resolvers.go @@ -130,6 +130,22 @@ func (mg *ContainerConnectedRegistry) ResolveReferences(ctx context.Context, c c mg.Spec.ForProvider.SyncTokenID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SyncTokenIDRef = rsp.ResolvedReference + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ContainerRegistryID), + Extract: rconfig.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ContainerRegistryIDRef, + Selector: mg.Spec.InitProvider.ContainerRegistryIDSelector, + To: reference.To{ + List: &RegistryList{}, + Managed: &Registry{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.ContainerRegistryID") + } + mg.Spec.InitProvider.ContainerRegistryID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.ContainerRegistryIDRef = rsp.ResolvedReference + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.SyncTokenID), Extract: rconfig.ExtractResourceID(), @@ -449,5 +465,21 @@ func (mg *Webhook) ResolveReferences(ctx context.Context, c client.Reader) error mg.Spec.ForProvider.ResourceGroupName = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.ResourceGroupNameRef = rsp.ResolvedReference + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RegistryName), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RegistryNameRef, + Selector: mg.Spec.InitProvider.RegistryNameSelector, + To: reference.To{ + List: &RegistryList{}, + Managed: &Registry{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.RegistryName") + } + mg.Spec.InitProvider.RegistryName = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.RegistryNameRef = rsp.ResolvedReference + return nil } diff --git a/apis/containerregistry/v1beta1/zz_webhook_types.go b/apis/containerregistry/v1beta1/zz_webhook_types.go index 6b2508b38..4f50a89f7 100755 --- a/apis/containerregistry/v1beta1/zz_webhook_types.go +++ b/apis/containerregistry/v1beta1/zz_webhook_types.go @@ -30,6 +30,18 @@ type WebhookInitParameters struct { // Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. Location *string `json:"location,omitempty" tf:"location,omitempty"` + // The Name of Container registry this Webhook belongs to. Changing this forces a new resource to be created. + // +crossplane:generate:reference:type=github.com/upbound/provider-azure/apis/containerregistry/v1beta1.Registry + RegistryName *string `json:"registryName,omitempty" tf:"registry_name,omitempty"` + + // Reference to a Registry in containerregistry to populate registryName. + // +kubebuilder:validation:Optional + RegistryNameRef *v1.Reference `json:"registryNameRef,omitempty" tf:"-"` + + // Selector for a Registry in containerregistry to populate registryName. + // +kubebuilder:validation:Optional + RegistryNameSelector *v1.Selector `json:"registryNameSelector,omitempty" tf:"-"` + // Specifies the scope of repositories that can trigger an event. For example, foo:* means events for all tags under repository foo. foo:bar means events for 'foo:bar' only. foo is equivalent to foo:latest. Empty means all events. Defaults to "". Scope *string `json:"scope,omitempty" tf:"scope,omitempty"` diff --git a/apis/storage/v1beta1/zz_encryptionscope_types.go b/apis/storage/v1beta1/zz_encryptionscope_types.go index 85150641c..685a95d35 100755 --- a/apis/storage/v1beta1/zz_encryptionscope_types.go +++ b/apis/storage/v1beta1/zz_encryptionscope_types.go @@ -27,6 +27,19 @@ type EncryptionScopeInitParameters struct { // The source of the Storage Encryption Scope. Possible values are Microsoft.KeyVault and Microsoft.Storage. Source *string `json:"source,omitempty" tf:"source,omitempty"` + + // The ID of the Storage Account where this Storage Encryption Scope is created. Changing this forces a new Storage Encryption Scope to be created. + // +crossplane:generate:reference:type=github.com/upbound/provider-azure/apis/storage/v1beta1.Account + // +crossplane:generate:reference:extractor=github.com/crossplane/upjet/pkg/resource.ExtractResourceID() + StorageAccountID *string `json:"storageAccountId,omitempty" tf:"storage_account_id,omitempty"` + + // Reference to a Account in storage to populate storageAccountId. + // +kubebuilder:validation:Optional + StorageAccountIDRef *v1.Reference `json:"storageAccountIdRef,omitempty" tf:"-"` + + // Selector for a Account in storage to populate storageAccountId. + // +kubebuilder:validation:Optional + StorageAccountIDSelector *v1.Selector `json:"storageAccountIdSelector,omitempty" tf:"-"` } type EncryptionScopeObservation struct { diff --git a/apis/storage/v1beta1/zz_generated.deepcopy.go b/apis/storage/v1beta1/zz_generated.deepcopy.go index f1b9e6dd4..3b788de4f 100644 --- a/apis/storage/v1beta1/zz_generated.deepcopy.go +++ b/apis/storage/v1beta1/zz_generated.deepcopy.go @@ -4680,6 +4680,21 @@ func (in *EncryptionScopeInitParameters) DeepCopyInto(out *EncryptionScopeInitPa *out = new(string) **out = **in } + if in.StorageAccountID != nil { + in, out := &in.StorageAccountID, &out.StorageAccountID + *out = new(string) + **out = **in + } + if in.StorageAccountIDRef != nil { + in, out := &in.StorageAccountIDRef, &out.StorageAccountIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountIDSelector != nil { + in, out := &in.StorageAccountIDSelector, &out.StorageAccountIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EncryptionScopeInitParameters. @@ -5620,6 +5635,21 @@ func (in *ManagementPolicyInitParameters) DeepCopyInto(out *ManagementPolicyInit (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.StorageAccountID != nil { + in, out := &in.StorageAccountID, &out.StorageAccountID + *out = new(string) + **out = **in + } + if in.StorageAccountIDRef != nil { + in, out := &in.StorageAccountIDRef, &out.StorageAccountIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountIDSelector != nil { + in, out := &in.StorageAccountIDSelector, &out.StorageAccountIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagementPolicyInitParameters. diff --git a/apis/storage/v1beta1/zz_generated.resolvers.go b/apis/storage/v1beta1/zz_generated.resolvers.go index 846fe184f..28771ee35 100644 --- a/apis/storage/v1beta1/zz_generated.resolvers.go +++ b/apis/storage/v1beta1/zz_generated.resolvers.go @@ -431,6 +431,22 @@ func (mg *EncryptionScope) ResolveReferences(ctx context.Context, c client.Reade mg.Spec.ForProvider.StorageAccountID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StorageAccountIDRef = rsp.ResolvedReference + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageAccountID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StorageAccountIDRef, + Selector: mg.Spec.InitProvider.StorageAccountIDSelector, + To: reference.To{ + List: &AccountList{}, + Managed: &Account{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.StorageAccountID") + } + mg.Spec.InitProvider.StorageAccountID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.StorageAccountIDRef = rsp.ResolvedReference + return nil } @@ -457,6 +473,22 @@ func (mg *ManagementPolicy) ResolveReferences(ctx context.Context, c client.Read mg.Spec.ForProvider.StorageAccountID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.StorageAccountIDRef = rsp.ResolvedReference + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.StorageAccountID), + Extract: resource.ExtractResourceID(), + Reference: mg.Spec.InitProvider.StorageAccountIDRef, + Selector: mg.Spec.InitProvider.StorageAccountIDSelector, + To: reference.To{ + List: &AccountList{}, + Managed: &Account{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.StorageAccountID") + } + mg.Spec.InitProvider.StorageAccountID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.StorageAccountIDRef = rsp.ResolvedReference + return nil } diff --git a/apis/storage/v1beta1/zz_managementpolicy_types.go b/apis/storage/v1beta1/zz_managementpolicy_types.go index 820e145cc..695eb6f15 100755 --- a/apis/storage/v1beta1/zz_managementpolicy_types.go +++ b/apis/storage/v1beta1/zz_managementpolicy_types.go @@ -224,6 +224,19 @@ type ManagementPolicyInitParameters struct { // A rule block as documented below. Rule []RuleInitParameters `json:"rule,omitempty" tf:"rule,omitempty"` + + // Specifies the id of the storage account to apply the management policy to. Changing this forces a new resource to be created. + // +crossplane:generate:reference:type=github.com/upbound/provider-azure/apis/storage/v1beta1.Account + // +crossplane:generate:reference:extractor=github.com/crossplane/upjet/pkg/resource.ExtractResourceID() + StorageAccountID *string `json:"storageAccountId,omitempty" tf:"storage_account_id,omitempty"` + + // Reference to a Account in storage to populate storageAccountId. + // +kubebuilder:validation:Optional + StorageAccountIDRef *v1.Reference `json:"storageAccountIdRef,omitempty" tf:"-"` + + // Selector for a Account in storage to populate storageAccountId. + // +kubebuilder:validation:Optional + StorageAccountIDSelector *v1.Selector `json:"storageAccountIdSelector,omitempty" tf:"-"` } type ManagementPolicyObservation struct { diff --git a/config/apimanagement/config.go b/config/apimanagement/config.go index 57ba42381..f950f5c17 100644 --- a/config/apimanagement/config.go +++ b/config/apimanagement/config.go @@ -20,6 +20,7 @@ import ( "github.com/crossplane/upjet/pkg/config" "github.com/upbound/provider-azure/apis/rconfig" + "github.com/upbound/provider-azure/config/common" ) // Configure configures apimanagement group @@ -100,4 +101,7 @@ func Configure(p *config.Provider) { Extractor: rconfig.ExtractResourceIDFuncPath, } }) + p.AddResourceConfigurator("azurerm_api_management_gateway", func(r *config.Resource) { + r.ExternalName.IdentifierFields = common.RemoveIndex(r.ExternalName.IdentifierFields, "api_management_id") + }) } diff --git a/config/authorization/config.go b/config/authorization/config.go index 52f27915e..84c264eb9 100644 --- a/config/authorization/config.go +++ b/config/authorization/config.go @@ -18,6 +18,8 @@ package authorization import ( "github.com/crossplane/upjet/pkg/config" + + "github.com/upbound/provider-azure/config/common" ) // Configure configures authorization group @@ -27,4 +29,7 @@ func Configure(p *config.Provider) { IgnoredFields: []string{"role_definition_id"}, } }) + p.AddResourceConfigurator("azurerm_resource_group_policy_assignment", func(r *config.Resource) { + r.ExternalName.IdentifierFields = common.RemoveIndex(r.ExternalName.IdentifierFields, "resource_group_id") + }) } diff --git a/config/common/common.go b/config/common/common.go index bf0ea4f59..dc039c6d9 100644 --- a/config/common/common.go +++ b/config/common/common.go @@ -227,3 +227,13 @@ func PasswordGenerator(secretRefFieldPath, toggleFieldPath string) tjconfig.NewI }) } } + +func RemoveIndex(s []string, elementToRemove string) []string { + var result []string + for _, value := range s { + if value != elementToRemove { + result = append(result, value) + } + } + return result +} diff --git a/config/containerregistry/config.go b/config/containerregistry/config.go index 6b1df8edd..a5265d26f 100644 --- a/config/containerregistry/config.go +++ b/config/containerregistry/config.go @@ -4,6 +4,7 @@ import ( "github.com/crossplane/upjet/pkg/config" "github.com/upbound/provider-azure/apis/rconfig" + "github.com/upbound/provider-azure/config/common" ) // Configure configures containerregistry group @@ -30,5 +31,10 @@ func Configure(p *config.Provider) { Type: "Token", Extractor: rconfig.ExtractResourceIDFuncPath, } + r.ExternalName.IdentifierFields = common.RemoveIndex(r.ExternalName.IdentifierFields, "container_registry_id") + }) + + p.AddResourceConfigurator("azurerm_container_registry_webhook", func(r *config.Resource) { + r.ExternalName.IdentifierFields = common.RemoveIndex(r.ExternalName.IdentifierFields, "registry_name") }) } diff --git a/config/storage/config.go b/config/storage/config.go index 2d35961f8..642f78be8 100644 --- a/config/storage/config.go +++ b/config/storage/config.go @@ -17,9 +17,10 @@ limitations under the License. package storage import ( - "github.com/upbound/provider-azure/apis/rconfig" - "github.com/crossplane/upjet/pkg/config" + + "github.com/upbound/provider-azure/apis/rconfig" + "github.com/upbound/provider-azure/config/common" ) // Configure configures storage group @@ -45,4 +46,12 @@ func Configure(p *config.Provider) { Extractor: rconfig.ExtractResourceIDFuncPath, } }) + + p.AddResourceConfigurator("azurerm_storage_encryption_scope", func(r *config.Resource) { + r.ExternalName.IdentifierFields = common.RemoveIndex(r.ExternalName.IdentifierFields, "storage_account_id") + }) + + p.AddResourceConfigurator("azurerm_storage_management_policy", func(r *config.Resource) { + r.ExternalName.IdentifierFields = common.RemoveIndex(r.ExternalName.IdentifierFields, "storage_account_id") + }) } diff --git a/package/crds/apimanagement.azure.upbound.io_gateways.yaml b/package/crds/apimanagement.azure.upbound.io_gateways.yaml index 08862e04b..c58bc208f 100644 --- a/package/crds/apimanagement.azure.upbound.io_gateways.yaml +++ b/package/crds/apimanagement.azure.upbound.io_gateways.yaml @@ -185,6 +185,86 @@ spec: for example because of an external controller is managing them, like an autoscaler. properties: + apiManagementId: + description: The ID of the API Management Resource in which the + gateway will be created. Changing this forces a new API Management + Gateway resource to be created. + type: string + apiManagementIdRef: + description: Reference to a Management in apimanagement to populate + apiManagementId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + apiManagementIdSelector: + description: Selector for a Management in apimanagement to populate + apiManagementId. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object description: description: The description of the API Management Gateway. type: string diff --git a/package/crds/authorization.azure.upbound.io_resourcegrouppolicyassignments.yaml b/package/crds/authorization.azure.upbound.io_resourcegrouppolicyassignments.yaml index ef24ae7a1..0fddb64e1 100644 --- a/package/crds/authorization.azure.upbound.io_resourcegrouppolicyassignments.yaml +++ b/package/crds/authorization.azure.upbound.io_resourcegrouppolicyassignments.yaml @@ -549,6 +549,86 @@ spec: type: string type: object type: object + resourceGroupId: + description: The ID of the Resource Group where this Policy Assignment + should be created. Changing this forces a new Policy Assignment + to be created. + type: string + resourceGroupIdRef: + description: Reference to a ResourceGroup in azure to populate + resourceGroupId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + resourceGroupIdSelector: + description: Selector for a ResourceGroup in azure to populate + resourceGroupId. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object resourceSelectors: description: One or more resource_selectors blocks as defined below to filter polices by resource properties. diff --git a/package/crds/containerregistry.azure.upbound.io_containerconnectedregistries.yaml b/package/crds/containerregistry.azure.upbound.io_containerconnectedregistries.yaml index 9e22e2fdc..8cb1eb831 100644 --- a/package/crds/containerregistry.azure.upbound.io_containerconnectedregistries.yaml +++ b/package/crds/containerregistry.azure.upbound.io_containerconnectedregistries.yaml @@ -309,6 +309,84 @@ spec: items: type: string type: array + containerRegistryId: + description: The ID of the Container Registry that this Connected + Registry will reside in. Changing this forces a new Container + Connected Registry to be created. + type: string + containerRegistryIdRef: + description: Reference to a Registry to populate containerRegistryId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + containerRegistryIdSelector: + description: Selector for a Registry to populate containerRegistryId. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object logLevel: description: The verbosity of the logs. Possible values are None, Debug, Information, Warning and Error. diff --git a/package/crds/containerregistry.azure.upbound.io_webhooks.yaml b/package/crds/containerregistry.azure.upbound.io_webhooks.yaml index eae05467d..c26595fd9 100644 --- a/package/crds/containerregistry.azure.upbound.io_webhooks.yaml +++ b/package/crds/containerregistry.azure.upbound.io_webhooks.yaml @@ -298,6 +298,85 @@ spec: description: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. type: string + registryName: + description: The Name of Container registry this Webhook belongs + to. Changing this forces a new resource to be created. + type: string + registryNameRef: + description: Reference to a Registry in containerregistry to populate + registryName. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + registryNameSelector: + description: Selector for a Registry in containerregistry to populate + registryName. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object scope: description: Specifies the scope of repositories that can trigger an event. For example, foo:* means events for all tags under diff --git a/package/crds/storage.azure.upbound.io_encryptionscopes.yaml b/package/crds/storage.azure.upbound.io_encryptionscopes.yaml index f6f14b0eb..30b8bc1c5 100644 --- a/package/crds/storage.azure.upbound.io_encryptionscopes.yaml +++ b/package/crds/storage.azure.upbound.io_encryptionscopes.yaml @@ -184,6 +184,84 @@ spec: description: The source of the Storage Encryption Scope. Possible values are Microsoft.KeyVault and Microsoft.Storage. type: string + storageAccountId: + description: The ID of the Storage Account where this Storage + Encryption Scope is created. Changing this forces a new Storage + Encryption Scope to be created. + type: string + storageAccountIdRef: + description: Reference to a Account in storage to populate storageAccountId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + storageAccountIdSelector: + description: Selector for a Account in storage to populate storageAccountId. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object type: object managementPolicies: default: diff --git a/package/crds/storage.azure.upbound.io_managementpolicies.yaml b/package/crds/storage.azure.upbound.io_managementpolicies.yaml index 070bb7c84..3094558bd 100644 --- a/package/crds/storage.azure.upbound.io_managementpolicies.yaml +++ b/package/crds/storage.azure.upbound.io_managementpolicies.yaml @@ -520,6 +520,84 @@ spec: type: string type: object type: array + storageAccountId: + description: Specifies the id of the storage account to apply + the management policy to. Changing this forces a new resource + to be created. + type: string + storageAccountIdRef: + description: Reference to a Account in storage to populate storageAccountId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + storageAccountIdSelector: + description: Selector for a Account in storage to populate storageAccountId. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object type: object managementPolicies: default: