diff --git a/apis/route53/v1beta1/zz_generated.deepcopy.go b/apis/route53/v1beta1/zz_generated.deepcopy.go index e5b313ff27..8d80f8ceae 100644 --- a/apis/route53/v1beta1/zz_generated.deepcopy.go +++ b/apis/route53/v1beta1/zz_generated.deepcopy.go @@ -1621,6 +1621,179 @@ func (in *Zone) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZoneAssociation) DeepCopyInto(out *ZoneAssociation) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZoneAssociation. +func (in *ZoneAssociation) DeepCopy() *ZoneAssociation { + if in == nil { + return nil + } + out := new(ZoneAssociation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ZoneAssociation) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZoneAssociationList) DeepCopyInto(out *ZoneAssociationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ZoneAssociation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZoneAssociationList. +func (in *ZoneAssociationList) DeepCopy() *ZoneAssociationList { + if in == nil { + return nil + } + out := new(ZoneAssociationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ZoneAssociationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZoneAssociationObservation) DeepCopyInto(out *ZoneAssociationObservation) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.OwningAccount != nil { + in, out := &in.OwningAccount, &out.OwningAccount + *out = new(string) + **out = **in + } + if in.VPCRegion != nil { + in, out := &in.VPCRegion, &out.VPCRegion + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZoneAssociationObservation. +func (in *ZoneAssociationObservation) DeepCopy() *ZoneAssociationObservation { + if in == nil { + return nil + } + out := new(ZoneAssociationObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZoneAssociationParameters) DeepCopyInto(out *ZoneAssociationParameters) { + *out = *in + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.VPCID != nil { + in, out := &in.VPCID, &out.VPCID + *out = new(string) + **out = **in + } + if in.VPCIDRef != nil { + in, out := &in.VPCIDRef, &out.VPCIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.VPCIDSelector != nil { + in, out := &in.VPCIDSelector, &out.VPCIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.ZoneID != nil { + in, out := &in.ZoneID, &out.ZoneID + *out = new(string) + **out = **in + } + if in.ZoneIDRef != nil { + in, out := &in.ZoneIDRef, &out.ZoneIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ZoneIDSelector != nil { + in, out := &in.ZoneIDSelector, &out.ZoneIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZoneAssociationParameters. +func (in *ZoneAssociationParameters) DeepCopy() *ZoneAssociationParameters { + if in == nil { + return nil + } + out := new(ZoneAssociationParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZoneAssociationSpec) DeepCopyInto(out *ZoneAssociationSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZoneAssociationSpec. +func (in *ZoneAssociationSpec) DeepCopy() *ZoneAssociationSpec { + if in == nil { + return nil + } + out := new(ZoneAssociationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZoneAssociationStatus) DeepCopyInto(out *ZoneAssociationStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZoneAssociationStatus. +func (in *ZoneAssociationStatus) DeepCopy() *ZoneAssociationStatus { + if in == nil { + return nil + } + out := new(ZoneAssociationStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ZoneList) DeepCopyInto(out *ZoneList) { *out = *in diff --git a/apis/route53/v1beta1/zz_generated.managed.go b/apis/route53/v1beta1/zz_generated.managed.go index 881560f57a..96e81088b8 100644 --- a/apis/route53/v1beta1/zz_generated.managed.go +++ b/apis/route53/v1beta1/zz_generated.managed.go @@ -534,3 +534,69 @@ func (mg *Zone) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo func (mg *Zone) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { mg.Spec.WriteConnectionSecretToReference = r } + +// GetCondition of this ZoneAssociation. +func (mg *ZoneAssociation) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this ZoneAssociation. +func (mg *ZoneAssociation) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetProviderConfigReference of this ZoneAssociation. +func (mg *ZoneAssociation) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this ZoneAssociation. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *ZoneAssociation) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetPublishConnectionDetailsTo of this ZoneAssociation. +func (mg *ZoneAssociation) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this ZoneAssociation. +func (mg *ZoneAssociation) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this ZoneAssociation. +func (mg *ZoneAssociation) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this ZoneAssociation. +func (mg *ZoneAssociation) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetProviderConfigReference of this ZoneAssociation. +func (mg *ZoneAssociation) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this ZoneAssociation. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *ZoneAssociation) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetPublishConnectionDetailsTo of this ZoneAssociation. +func (mg *ZoneAssociation) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this ZoneAssociation. +func (mg *ZoneAssociation) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/route53/v1beta1/zz_generated.managedlist.go b/apis/route53/v1beta1/zz_generated.managedlist.go index 2257aec8a3..85687440d3 100644 --- a/apis/route53/v1beta1/zz_generated.managedlist.go +++ b/apis/route53/v1beta1/zz_generated.managedlist.go @@ -70,6 +70,15 @@ func (l *VPCAssociationAuthorizationList) GetItems() []resource.Managed { return items } +// GetItems of this ZoneAssociationList. +func (l *ZoneAssociationList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + // GetItems of this ZoneList. func (l *ZoneList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) diff --git a/apis/route53/v1beta1/zz_generated.resolvers.go b/apis/route53/v1beta1/zz_generated.resolvers.go index d9a33fe605..24b7a527c9 100644 --- a/apis/route53/v1beta1/zz_generated.resolvers.go +++ b/apis/route53/v1beta1/zz_generated.resolvers.go @@ -217,3 +217,45 @@ func (mg *Zone) ResolveReferences(ctx context.Context, c client.Reader) error { return nil } + +// ResolveReferences of this ZoneAssociation. +func (mg *ZoneAssociation) ResolveReferences(ctx context.Context, c client.Reader) error { + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.VPCID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.VPCIDRef, + Selector: mg.Spec.ForProvider.VPCIDSelector, + To: reference.To{ + List: &v1beta11.VPCList{}, + Managed: &v1beta11.VPC{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.VPCID") + } + mg.Spec.ForProvider.VPCID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.VPCIDRef = rsp.ResolvedReference + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ZoneID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ZoneIDRef, + Selector: mg.Spec.ForProvider.ZoneIDSelector, + To: reference.To{ + List: &ZoneList{}, + Managed: &Zone{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.ZoneID") + } + mg.Spec.ForProvider.ZoneID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.ZoneIDRef = rsp.ResolvedReference + + return nil +} diff --git a/apis/route53/v1beta1/zz_generated_terraformed.go b/apis/route53/v1beta1/zz_generated_terraformed.go index 6b19a4313f..d119c5cd88 100755 --- a/apis/route53/v1beta1/zz_generated_terraformed.go +++ b/apis/route53/v1beta1/zz_generated_terraformed.go @@ -604,3 +604,77 @@ func (tr *Zone) LateInitialize(attrs []byte) (bool, error) { func (tr *Zone) GetTerraformSchemaVersion() int { return 0 } + +// GetTerraformResourceType returns Terraform resource type for this ZoneAssociation +func (mg *ZoneAssociation) GetTerraformResourceType() string { + return "aws_route53_zone_association" +} + +// GetConnectionDetailsMapping for this ZoneAssociation +func (tr *ZoneAssociation) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ZoneAssociation +func (tr *ZoneAssociation) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ZoneAssociation +func (tr *ZoneAssociation) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ZoneAssociation +func (tr *ZoneAssociation) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ZoneAssociation +func (tr *ZoneAssociation) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ZoneAssociation +func (tr *ZoneAssociation) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// LateInitialize this ZoneAssociation using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ZoneAssociation) LateInitialize(attrs []byte) (bool, error) { + params := &ZoneAssociationParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ZoneAssociation) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/route53/v1beta1/zz_zoneassociation_types.go b/apis/route53/v1beta1/zz_zoneassociation_types.go new file mode 100755 index 0000000000..44402b47bf --- /dev/null +++ b/apis/route53/v1beta1/zz_zoneassociation_types.go @@ -0,0 +1,109 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type ZoneAssociationObservation struct { + + // The calculated unique identifier for the association. + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // The account ID of the account that created the hosted zone. + OwningAccount *string `json:"owningAccount,omitempty" tf:"owning_account,omitempty"` + + // The VPC's region. Defaults to the region of the AWS provider. + VPCRegion *string `json:"vpcRegion,omitempty" tf:"vpc_region,omitempty"` +} + +type ZoneAssociationParameters struct { + + // Region is the region you'd like your resource to be created in. + // +upjet:crd:field:TFTag=- + // +kubebuilder:validation:Required + Region *string `json:"region" tf:"-"` + + // The VPC to associate with the private hosted zone. + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.VPC + // +kubebuilder:validation:Optional + VPCID *string `json:"vpcId,omitempty" tf:"vpc_id,omitempty"` + + // Reference to a VPC in ec2 to populate vpcId. + // +kubebuilder:validation:Optional + VPCIDRef *v1.Reference `json:"vpcIdRef,omitempty" tf:"-"` + + // Selector for a VPC in ec2 to populate vpcId. + // +kubebuilder:validation:Optional + VPCIDSelector *v1.Selector `json:"vpcIdSelector,omitempty" tf:"-"` + + // The private hosted zone to associate. + // +crossplane:generate:reference:type=Zone + // +kubebuilder:validation:Optional + ZoneID *string `json:"zoneId,omitempty" tf:"zone_id,omitempty"` + + // Reference to a Zone to populate zoneId. + // +kubebuilder:validation:Optional + ZoneIDRef *v1.Reference `json:"zoneIdRef,omitempty" tf:"-"` + + // Selector for a Zone to populate zoneId. + // +kubebuilder:validation:Optional + ZoneIDSelector *v1.Selector `json:"zoneIdSelector,omitempty" tf:"-"` +} + +// ZoneAssociationSpec defines the desired state of ZoneAssociation +type ZoneAssociationSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider ZoneAssociationParameters `json:"forProvider"` +} + +// ZoneAssociationStatus defines the observed state of ZoneAssociation. +type ZoneAssociationStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider ZoneAssociationObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// ZoneAssociation is the Schema for the ZoneAssociations API. Manages a Route53 Hosted Zone VPC association +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} +type ZoneAssociation struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ZoneAssociationSpec `json:"spec"` + Status ZoneAssociationStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ZoneAssociationList contains a list of ZoneAssociations +type ZoneAssociationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ZoneAssociation `json:"items"` +} + +// Repository type metadata. +var ( + ZoneAssociation_Kind = "ZoneAssociation" + ZoneAssociation_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: ZoneAssociation_Kind}.String() + ZoneAssociation_KindAPIVersion = ZoneAssociation_Kind + "." + CRDGroupVersion.String() + ZoneAssociation_GroupVersionKind = CRDGroupVersion.WithKind(ZoneAssociation_Kind) +) + +func init() { + SchemeBuilder.Register(&ZoneAssociation{}, &ZoneAssociationList{}) +} diff --git a/config/externalname.go b/config/externalname.go index 3c3775de5f..9316766b9a 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -601,8 +601,7 @@ var ExternalNameConfigs = map[string]config.ExternalName{ // Z1D633PJN98FT9 "aws_route53_zone": config.IdentifierFromProvider, // Z123456ABCDEFG:vpc-12345678 - // disabled until it's successfully tested - // "aws_route53_zone_association": FormattedIdentifierFromProvider(":", "zone_id", "vpc_id"), + "aws_route53_zone_association": FormattedIdentifierFromProvider(":", "zone_id", "vpc_id"), // Imported using the id and version, e.g., // 01a52019-d16f-422a-ae72-c306d2b6df7e/1 "aws_route53_traffic_policy": config.IdentifierFromProvider, diff --git a/examples-generated/route53/vpcassociationauthorization.yaml b/examples-generated/route53/vpcassociationauthorization.yaml index eee2d54c48..9bdbd412b0 100644 --- a/examples-generated/route53/vpcassociationauthorization.yaml +++ b/examples-generated/route53/vpcassociationauthorization.yaml @@ -33,6 +33,27 @@ spec: --- +apiVersion: route53.aws.upbound.io/v1beta1 +kind: ZoneAssociation +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/vpcassociationauthorization + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + provider: aws.alternate + region: us-west-1 + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: example + zoneIdSelector: + matchLabels: + testing.upbound.io/example-name: example + +--- + apiVersion: ec2.aws.upbound.io/v1beta1 kind: VPC metadata: diff --git a/examples-generated/route53/zoneassociation.yaml b/examples-generated/route53/zoneassociation.yaml new file mode 100644 index 0000000000..4ec82292a3 --- /dev/null +++ b/examples-generated/route53/zoneassociation.yaml @@ -0,0 +1,69 @@ +apiVersion: route53.aws.upbound.io/v1beta1 +kind: ZoneAssociation +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/zoneassociation + labels: + testing.upbound.io/example-name: secondary + name: secondary +spec: + forProvider: + region: us-west-1 + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: secondary + zoneIdSelector: + matchLabels: + testing.upbound.io/example-name: example + +--- + +apiVersion: route53.aws.upbound.io/v1beta1 +kind: Zone +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/zoneassociation + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + name: example.com + region: us-west-1 + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPC +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/zoneassociation + labels: + testing.upbound.io/example-name: primary + name: primary +spec: + forProvider: + cidrBlock: 10.6.0.0/16 + enableDnsHostnames: true + enableDnsSupport: true + region: us-west-1 + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPC +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/zoneassociation + labels: + testing.upbound.io/example-name: secondary + name: secondary +spec: + forProvider: + cidrBlock: 10.7.0.0/16 + enableDnsHostnames: true + enableDnsSupport: true + region: us-west-1 + +--- + diff --git a/examples/route53/zoneassociation.yaml b/examples/route53/zoneassociation.yaml new file mode 100644 index 0000000000..bac7c6314e --- /dev/null +++ b/examples/route53/zoneassociation.yaml @@ -0,0 +1,67 @@ +apiVersion: route53.aws.upbound.io/v1beta1 +kind: ZoneAssociation +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/zoneassociation + labels: + testing.upbound.io/example-name: secondary + name: secondary +spec: + forProvider: + region: us-west-1 + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: secondary + zoneIdSelector: + matchLabels: + testing.upbound.io/example-name: example + +--- + +apiVersion: route53.aws.upbound.io/v1beta1 +kind: Zone +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/zoneassociation + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + name: upbound.rocks + region: us-west-1 + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPC +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/zoneassociation + labels: + testing.upbound.io/example-name: primary + name: primary +spec: + forProvider: + cidrBlock: 10.6.0.0/16 + enableDnsHostnames: true + enableDnsSupport: true + region: us-west-1 + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPC +metadata: + annotations: + meta.upbound.io/example-id: route53/v1beta1/zoneassociation + labels: + testing.upbound.io/example-name: secondary + name: secondary +spec: + forProvider: + cidrBlock: 10.7.0.0/16 + enableDnsHostnames: true + enableDnsSupport: true + region: us-west-1 + diff --git a/internal/controller/route53/zoneassociation/zz_controller.go b/internal/controller/route53/zoneassociation/zz_controller.go new file mode 100755 index 0000000000..3684c334ce --- /dev/null +++ b/internal/controller/route53/zoneassociation/zz_controller.go @@ -0,0 +1,51 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package zoneassociation + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + ctrl "sigs.k8s.io/controller-runtime" + + v1beta1 "github.com/upbound/provider-aws/apis/route53/v1beta1" +) + +// Setup adds a controller that reconciles ZoneAssociation managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1beta1.ZoneAssociation_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + } + r := managed.NewReconciler(mgr, + xpresource.ManagedKind(v1beta1.ZoneAssociation_GroupVersionKind), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["aws_route53_zone_association"], + tjcontroller.WithCallbackProvider(tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ZoneAssociation_GroupVersionKind))), + )), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3*time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + ) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + For(&v1beta1.ZoneAssociation{}). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index 37886e55dd..47de2a66ab 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -642,6 +642,7 @@ import ( trafficpolicyinstance "github.com/upbound/provider-aws/internal/controller/route53/trafficpolicyinstance" vpcassociationauthorization "github.com/upbound/provider-aws/internal/controller/route53/vpcassociationauthorization" zone "github.com/upbound/provider-aws/internal/controller/route53/zone" + zoneassociation "github.com/upbound/provider-aws/internal/controller/route53/zoneassociation" clusterroute53recoverycontrolconfig "github.com/upbound/provider-aws/internal/controller/route53recoverycontrolconfig/cluster" controlpanel "github.com/upbound/provider-aws/internal/controller/route53recoverycontrolconfig/controlpanel" routingcontrol "github.com/upbound/provider-aws/internal/controller/route53recoverycontrolconfig/routingcontrol" @@ -1444,6 +1445,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { trafficpolicyinstance.Setup, vpcassociationauthorization.Setup, zone.Setup, + zoneassociation.Setup, clusterroute53recoverycontrolconfig.Setup, controlpanel.Setup, routingcontrol.Setup, diff --git a/package/crds/route53.aws.upbound.io_zoneassociations.yaml b/package/crds/route53.aws.upbound.io_zoneassociations.yaml new file mode 100644 index 0000000000..e38c4ccf95 --- /dev/null +++ b/package/crds/route53.aws.upbound.io_zoneassociations.yaml @@ -0,0 +1,460 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.8.0 + creationTimestamp: null + name: zoneassociations.route53.aws.upbound.io +spec: + group: route53.aws.upbound.io + names: + categories: + - crossplane + - managed + - aws + kind: ZoneAssociation + listKind: ZoneAssociationList + plural: zoneassociations + singular: zoneassociation + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: ZoneAssociation is the Schema for the ZoneAssociations API. Manages + a Route53 Hosted Zone VPC association + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ZoneAssociationSpec defines the desired state of ZoneAssociation + properties: + deletionPolicy: + default: Delete + description: DeletionPolicy specifies what will happen to the underlying + external when this managed resource is deleted - either "Delete" + or "Orphan" the external resource. + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + region: + description: Region is the region you'd like your resource to + be created in. + type: string + vpcId: + description: The VPC to associate with the private hosted zone. + type: string + vpcIdRef: + description: Reference to a VPC in ec2 to populate vpcId. + 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 + vpcIdSelector: + description: Selector for a VPC in ec2 to populate vpcId. + 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 + zoneId: + description: The private hosted zone to associate. + type: string + zoneIdRef: + description: Reference to a Zone to populate zoneId. + 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 + zoneIdSelector: + description: Selector for a Zone to populate zoneId. + 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 + required: + - region + type: object + providerConfigRef: + default: + name: default + description: ProviderConfigReference specifies how the provider that + will be used to create, observe, update, and delete this managed + resource should be configured. + 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 + providerRef: + description: 'ProviderReference specifies the provider that will be + used to create, observe, update, and delete this managed resource. + Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`' + 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 + publishConnectionDetailsTo: + description: PublishConnectionDetailsTo specifies the connection secret + config which contains a name, metadata and a reference to secret + store config to which any connection details for this managed resource + should be written. Connection details frequently include the endpoint, + username, and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: SecretStoreConfigRef specifies which secret store + config should be used for this ConnectionSecret. + 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 + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: Annotations are the annotations to be added to + connection secret. - For Kubernetes secrets, this will be + used as "metadata.annotations". - It is up to Secret Store + implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: Labels are the labels/tags to be added to connection + secret. - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store + types. + type: object + type: + description: Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the namespace + and name of a Secret to which any connection details for this managed + resource should be written. Connection details frequently include + the endpoint, username, and password required to connect to the + managed resource. This field is planned to be replaced in a future + release in favor of PublishConnectionDetailsTo. Currently, both + could be set independently and connection details would be published + to both without affecting each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + status: + description: ZoneAssociationStatus defines the observed state of ZoneAssociation. + properties: + atProvider: + properties: + id: + description: The calculated unique identifier for the association. + type: string + owningAccount: + description: The account ID of the account that created the hosted + zone. + type: string + vpcRegion: + description: The VPC's region. Defaults to the region of the AWS + provider. + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this condition + transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this condition's + last transition from one status to another, if any. + type: string + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: Type of this condition. At most one of each condition + type may apply to a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: []