diff --git a/apis/ec2/v1alpha2/zz_generated.deepcopy.go b/apis/ec2/v1alpha2/zz_generated.deepcopy.go index 9187df3c3..d90c6d34f 100644 --- a/apis/ec2/v1alpha2/zz_generated.deepcopy.go +++ b/apis/ec2/v1alpha2/zz_generated.deepcopy.go @@ -4789,6 +4789,16 @@ func (in *SecurityGroupRuleParameters) DeepCopyInto(out *SecurityGroupRuleParame *out = new(string) **out = **in } + if in.SourceSecurityGroupIDRef != nil { + in, out := &in.SourceSecurityGroupIDRef, &out.SourceSecurityGroupIDRef + *out = new(v1.Reference) + **out = **in + } + if in.SourceSecurityGroupIDSelector != nil { + in, out := &in.SourceSecurityGroupIDSelector, &out.SourceSecurityGroupIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } if in.ToPort != nil { in, out := &in.ToPort, &out.ToPort *out = new(float64) diff --git a/apis/ec2/v1alpha2/zz_generated.resolvers.go b/apis/ec2/v1alpha2/zz_generated.resolvers.go index 732c50596..4d3106330 100644 --- a/apis/ec2/v1alpha2/zz_generated.resolvers.go +++ b/apis/ec2/v1alpha2/zz_generated.resolvers.go @@ -780,6 +780,22 @@ func (mg *SecurityGroupRule) ResolveReferences(ctx context.Context, c client.Rea mg.Spec.ForProvider.SecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) mg.Spec.ForProvider.SecurityGroupIDRef = rsp.ResolvedReference + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.SourceSecurityGroupID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.SourceSecurityGroupIDRef, + Selector: mg.Spec.ForProvider.SourceSecurityGroupIDSelector, + To: reference.To{ + List: &SecurityGroupList{}, + Managed: &SecurityGroup{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.SourceSecurityGroupID") + } + mg.Spec.ForProvider.SourceSecurityGroupID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.SourceSecurityGroupIDRef = rsp.ResolvedReference + return nil } diff --git a/apis/ec2/v1alpha2/zz_securitygrouprule_types.go b/apis/ec2/v1alpha2/zz_securitygrouprule_types.go index 485869d7e..94db06b37 100755 --- a/apis/ec2/v1alpha2/zz_securitygrouprule_types.go +++ b/apis/ec2/v1alpha2/zz_securitygrouprule_types.go @@ -67,9 +67,16 @@ type SecurityGroupRuleParameters struct { // +kubebuilder:validation:Optional Self *bool `json:"self,omitempty" tf:"self,omitempty"` + // +crossplane:generate:reference:type=SecurityGroup // +kubebuilder:validation:Optional SourceSecurityGroupID *string `json:"sourceSecurityGroupId,omitempty" tf:"source_security_group_id,omitempty"` + // +kubebuilder:validation:Optional + SourceSecurityGroupIDRef *v1.Reference `json:"sourceSecurityGroupIdRef,omitempty" tf:"-"` + + // +kubebuilder:validation:Optional + SourceSecurityGroupIDSelector *v1.Selector `json:"sourceSecurityGroupIdSelector,omitempty" tf:"-"` + // +kubebuilder:validation:Required ToPort *float64 `json:"toPort" tf:"to_port,omitempty"` diff --git a/config/ec2/config.go b/config/ec2/config.go index c1612d22c..3a7c33698 100644 --- a/config/ec2/config.go +++ b/config/ec2/config.go @@ -245,6 +245,9 @@ func Configure(p *config.Provider) { r.References["security_group_id"] = config.Reference{ Type: "SecurityGroup", } + r.References["source_security_group_id"] = config.Reference{ + Type: "SecurityGroup", + } }) p.AddResourceConfigurator("aws_vpc_ipv4_cidr_block_association", func(r *config.Resource) { diff --git a/package/crds/ec2.aws.jet.crossplane.io_securitygrouprules.yaml b/package/crds/ec2.aws.jet.crossplane.io_securitygrouprules.yaml index 0871e723c..56d1674f9 100644 --- a/package/crds/ec2.aws.jet.crossplane.io_securitygrouprules.yaml +++ b/package/crds/ec2.aws.jet.crossplane.io_securitygrouprules.yaml @@ -114,6 +114,29 @@ spec: type: boolean sourceSecurityGroupId: type: string + sourceSecurityGroupIdRef: + description: A Reference to a named object. + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + sourceSecurityGroupIdSelector: + description: A Selector selects an object. + 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 + type: object toPort: type: number type: