diff --git a/Makefile b/Makefile index ac984b1024..c3675d7c38 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ export SUBPACKAGES := $(SUBPACKAGES) KIND_VERSION = v0.15.0 UP_VERSION = v0.17.0 UP_CHANNEL = stable -UPTEST_VERSION = v0.6.0 +UPTEST_VERSION = v0.6.1 export UP_VERSION := $(UP_VERSION) export UP_CHANNEL := $(UP_CHANNEL) diff --git a/apis/ec2/v1beta1/zz_securitygroupegressrule_types.go b/apis/ec2/v1beta1/zz_securitygroupegressrule_types.go index 49cf31214d..3f322f028f 100755 --- a/apis/ec2/v1beta1/zz_securitygroupegressrule_types.go +++ b/apis/ec2/v1beta1/zz_securitygroupegressrule_types.go @@ -104,28 +104,28 @@ type SecurityGroupEgressRuleParameters struct { IPProtocol *string `json:"ipProtocol,omitempty" tf:"ip_protocol,omitempty"` // The ID of the destination prefix list. - // +crossplane:generate:reference:type=ManagedPrefixList + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.ManagedPrefixList // +kubebuilder:validation:Optional PrefixListID *string `json:"prefixListId,omitempty" tf:"prefix_list_id,omitempty"` - // Reference to a ManagedPrefixList to populate prefixListId. + // Reference to a ManagedPrefixList in ec2 to populate prefixListId. // +kubebuilder:validation:Optional PrefixListIDRef *v1.Reference `json:"prefixListIdRef,omitempty" tf:"-"` - // Selector for a ManagedPrefixList to populate prefixListId. + // Selector for a ManagedPrefixList in ec2 to populate prefixListId. // +kubebuilder:validation:Optional PrefixListIDSelector *v1.Selector `json:"prefixListIdSelector,omitempty" tf:"-"` // The destination security group that is referenced in the rule. - // +crossplane:generate:reference:type=SecurityGroup + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup // +kubebuilder:validation:Optional ReferencedSecurityGroupID *string `json:"referencedSecurityGroupId,omitempty" tf:"referenced_security_group_id,omitempty"` - // Reference to a SecurityGroup to populate referencedSecurityGroupId. + // Reference to a SecurityGroup in ec2 to populate referencedSecurityGroupId. // +kubebuilder:validation:Optional ReferencedSecurityGroupIDRef *v1.Reference `json:"referencedSecurityGroupIdRef,omitempty" tf:"-"` - // Selector for a SecurityGroup to populate referencedSecurityGroupId. + // Selector for a SecurityGroup in ec2 to populate referencedSecurityGroupId. // +kubebuilder:validation:Optional ReferencedSecurityGroupIDSelector *v1.Selector `json:"referencedSecurityGroupIdSelector,omitempty" tf:"-"` @@ -135,15 +135,15 @@ type SecurityGroupEgressRuleParameters struct { Region *string `json:"region" tf:"-"` // The ID of the security group. - // +crossplane:generate:reference:type=SecurityGroup + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup // +kubebuilder:validation:Optional SecurityGroupID *string `json:"securityGroupId,omitempty" tf:"security_group_id,omitempty"` - // Reference to a SecurityGroup to populate securityGroupId. + // Reference to a SecurityGroup in ec2 to populate securityGroupId. // +kubebuilder:validation:Optional SecurityGroupIDRef *v1.Reference `json:"securityGroupIdRef,omitempty" tf:"-"` - // Selector for a SecurityGroup to populate securityGroupId. + // Selector for a SecurityGroup in ec2 to populate securityGroupId. // +kubebuilder:validation:Optional SecurityGroupIDSelector *v1.Selector `json:"securityGroupIdSelector,omitempty" tf:"-"` diff --git a/apis/ec2/v1beta1/zz_securitygroupingressrule_types.go b/apis/ec2/v1beta1/zz_securitygroupingressrule_types.go index 7471cbca28..4fb114968e 100755 --- a/apis/ec2/v1beta1/zz_securitygroupingressrule_types.go +++ b/apis/ec2/v1beta1/zz_securitygroupingressrule_types.go @@ -104,28 +104,28 @@ type SecurityGroupIngressRuleParameters struct { IPProtocol *string `json:"ipProtocol,omitempty" tf:"ip_protocol,omitempty"` // The ID of the source prefix list. - // +crossplane:generate:reference:type=ManagedPrefixList + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.ManagedPrefixList // +kubebuilder:validation:Optional PrefixListID *string `json:"prefixListId,omitempty" tf:"prefix_list_id,omitempty"` - // Reference to a ManagedPrefixList to populate prefixListId. + // Reference to a ManagedPrefixList in ec2 to populate prefixListId. // +kubebuilder:validation:Optional PrefixListIDRef *v1.Reference `json:"prefixListIdRef,omitempty" tf:"-"` - // Selector for a ManagedPrefixList to populate prefixListId. + // Selector for a ManagedPrefixList in ec2 to populate prefixListId. // +kubebuilder:validation:Optional PrefixListIDSelector *v1.Selector `json:"prefixListIdSelector,omitempty" tf:"-"` // The source security group that is referenced in the rule. - // +crossplane:generate:reference:type=SecurityGroup + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup // +kubebuilder:validation:Optional ReferencedSecurityGroupID *string `json:"referencedSecurityGroupId,omitempty" tf:"referenced_security_group_id,omitempty"` - // Reference to a SecurityGroup to populate referencedSecurityGroupId. + // Reference to a SecurityGroup in ec2 to populate referencedSecurityGroupId. // +kubebuilder:validation:Optional ReferencedSecurityGroupIDRef *v1.Reference `json:"referencedSecurityGroupIdRef,omitempty" tf:"-"` - // Selector for a SecurityGroup to populate referencedSecurityGroupId. + // Selector for a SecurityGroup in ec2 to populate referencedSecurityGroupId. // +kubebuilder:validation:Optional ReferencedSecurityGroupIDSelector *v1.Selector `json:"referencedSecurityGroupIdSelector,omitempty" tf:"-"` @@ -135,15 +135,15 @@ type SecurityGroupIngressRuleParameters struct { Region *string `json:"region" tf:"-"` // The ID of the security group. - // +crossplane:generate:reference:type=SecurityGroup + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup // +kubebuilder:validation:Optional SecurityGroupID *string `json:"securityGroupId,omitempty" tf:"security_group_id,omitempty"` - // Reference to a SecurityGroup to populate securityGroupId. + // Reference to a SecurityGroup in ec2 to populate securityGroupId. // +kubebuilder:validation:Optional SecurityGroupIDRef *v1.Reference `json:"securityGroupIdRef,omitempty" tf:"-"` - // Selector for a SecurityGroup to populate securityGroupId. + // Selector for a SecurityGroup in ec2 to populate securityGroupId. // +kubebuilder:validation:Optional SecurityGroupIDSelector *v1.Selector `json:"securityGroupIdSelector,omitempty" tf:"-"` diff --git a/config/ec2/config.go b/config/ec2/config.go index 52da91132a..da654d7ffd 100644 --- a/config/ec2/config.go +++ b/config/ec2/config.go @@ -220,26 +220,26 @@ func Configure(p *config.Provider) { p.AddResourceConfigurator("aws_vpc_security_group_ingress_rule", func(r *config.Resource) { r.Kind = "SecurityGroupIngressRule" r.References["security_group_id"] = config.Reference{ - Type: "SecurityGroup", + TerraformName: "aws_security_group", } r.References["referenced_security_group_id"] = config.Reference{ - Type: "SecurityGroup", + TerraformName: "aws_security_group", } r.References["prefix_list_id"] = config.Reference{ - Type: "ManagedPrefixList", + TerraformName: "aws_ec2_managed_prefix_list", } }) p.AddResourceConfigurator("aws_vpc_security_group_egress_rule", func(r *config.Resource) { r.Kind = "SecurityGroupEgressRule" r.References["security_group_id"] = config.Reference{ - Type: "SecurityGroup", + TerraformName: "aws_security_group", } r.References["referenced_security_group_id"] = config.Reference{ - Type: "SecurityGroup", + TerraformName: "aws_security_group", } r.References["prefix_list_id"] = config.Reference{ - Type: "ManagedPrefixList", + TerraformName: "aws_ec2_managed_prefix_list", } }) diff --git a/config/externalname.go b/config/externalname.go index eed6289e75..ee40038588 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -188,9 +188,9 @@ var ExternalNameConfigs = map[string]config.ExternalName{ // https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule "aws_security_group_rule": config.IdentifierFromProvider, // Imported by using the id: sgr-02108b27edd666983 - "aws_vpc_security_group_egress_rule": config.IdentifierFromProvider, + "aws_vpc_security_group_egress_rule": vpcSecurityGroupRule(), // Imported by using the id: sgr-02108b27edd666983 - "aws_vpc_security_group_ingress_rule": config.IdentifierFromProvider, + "aws_vpc_security_group_ingress_rule": vpcSecurityGroupRule(), // Imported by using the VPC CIDR Association ID: vpc-cidr-assoc-xxxxxxxx "aws_vpc_ipv4_cidr_block_association": config.IdentifierFromProvider, // Imported using the vpc peering id: pcx-111aaa111 @@ -2735,6 +2735,19 @@ func kmsAlias() config.ExternalName { return e } +func vpcSecurityGroupRule() config.ExternalName { + // Terraform does not allow security group rule id to be empty. + // Using a stub value to pass validation. + e := config.IdentifierFromProvider + e.GetIDFn = func(_ context.Context, externalName string, _ map[string]any, _ map[string]any) (string, error) { + if len(externalName) == 0 { + return "sgr-stub", nil + } + return externalName, nil + } + return e +} + func route() config.ExternalName { e := config.IdentifierFromProvider e.GetIDFn = func(_ context.Context, _ string, parameters map[string]interface{}, _ map[string]interface{}) (string, error) { diff --git a/package/crds/ec2.aws.upbound.io_securitygroupegressrules.yaml b/package/crds/ec2.aws.upbound.io_securitygroupegressrules.yaml index ac25f2400e..8adde8973b 100644 --- a/package/crds/ec2.aws.upbound.io_securitygroupegressrules.yaml +++ b/package/crds/ec2.aws.upbound.io_securitygroupegressrules.yaml @@ -89,7 +89,8 @@ spec: description: The ID of the destination prefix list. type: string prefixListIdRef: - description: Reference to a ManagedPrefixList to populate prefixListId. + description: Reference to a ManagedPrefixList in ec2 to populate + prefixListId. properties: name: description: Name of the referenced object. @@ -123,7 +124,8 @@ spec: - name type: object prefixListIdSelector: - description: Selector for a ManagedPrefixList to populate prefixListId. + description: Selector for a ManagedPrefixList in ec2 to populate + prefixListId. properties: matchControllerRef: description: MatchControllerRef ensures an object with the @@ -166,7 +168,7 @@ spec: in the rule. type: string referencedSecurityGroupIdRef: - description: Reference to a SecurityGroup to populate referencedSecurityGroupId. + description: Reference to a SecurityGroup in ec2 to populate referencedSecurityGroupId. properties: name: description: Name of the referenced object. @@ -200,7 +202,7 @@ spec: - name type: object referencedSecurityGroupIdSelector: - description: Selector for a SecurityGroup to populate referencedSecurityGroupId. + description: Selector for a SecurityGroup in ec2 to populate referencedSecurityGroupId. properties: matchControllerRef: description: MatchControllerRef ensures an object with the @@ -246,7 +248,7 @@ spec: description: The ID of the security group. type: string securityGroupIdRef: - description: Reference to a SecurityGroup to populate securityGroupId. + description: Reference to a SecurityGroup in ec2 to populate securityGroupId. properties: name: description: Name of the referenced object. @@ -280,7 +282,7 @@ spec: - name type: object securityGroupIdSelector: - description: Selector for a SecurityGroup to populate securityGroupId. + description: Selector for a SecurityGroup in ec2 to populate securityGroupId. properties: matchControllerRef: description: MatchControllerRef ensures an object with the diff --git a/package/crds/ec2.aws.upbound.io_securitygroupingressrules.yaml b/package/crds/ec2.aws.upbound.io_securitygroupingressrules.yaml index 59c9f9e70c..d959bfb3c3 100644 --- a/package/crds/ec2.aws.upbound.io_securitygroupingressrules.yaml +++ b/package/crds/ec2.aws.upbound.io_securitygroupingressrules.yaml @@ -89,7 +89,8 @@ spec: description: The ID of the source prefix list. type: string prefixListIdRef: - description: Reference to a ManagedPrefixList to populate prefixListId. + description: Reference to a ManagedPrefixList in ec2 to populate + prefixListId. properties: name: description: Name of the referenced object. @@ -123,7 +124,8 @@ spec: - name type: object prefixListIdSelector: - description: Selector for a ManagedPrefixList to populate prefixListId. + description: Selector for a ManagedPrefixList in ec2 to populate + prefixListId. properties: matchControllerRef: description: MatchControllerRef ensures an object with the @@ -166,7 +168,7 @@ spec: rule. type: string referencedSecurityGroupIdRef: - description: Reference to a SecurityGroup to populate referencedSecurityGroupId. + description: Reference to a SecurityGroup in ec2 to populate referencedSecurityGroupId. properties: name: description: Name of the referenced object. @@ -200,7 +202,7 @@ spec: - name type: object referencedSecurityGroupIdSelector: - description: Selector for a SecurityGroup to populate referencedSecurityGroupId. + description: Selector for a SecurityGroup in ec2 to populate referencedSecurityGroupId. properties: matchControllerRef: description: MatchControllerRef ensures an object with the @@ -246,7 +248,7 @@ spec: description: The ID of the security group. type: string securityGroupIdRef: - description: Reference to a SecurityGroup to populate securityGroupId. + description: Reference to a SecurityGroup in ec2 to populate securityGroupId. properties: name: description: Name of the referenced object. @@ -280,7 +282,7 @@ spec: - name type: object securityGroupIdSelector: - description: Selector for a SecurityGroup to populate securityGroupId. + description: Selector for a SecurityGroup in ec2 to populate securityGroupId. properties: matchControllerRef: description: MatchControllerRef ensures an object with the