Skip to content

Commit

Permalink
Merge pull request #456 from ytsarev/r53-zone-392
Browse files Browse the repository at this point in the history
Enable `vpc` selector for Route53 Zone
  • Loading branch information
ytsarev committed Feb 2, 2023
2 parents 6d1956e + 532bf11 commit d1f9ce4
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 49 deletions.
44 changes: 27 additions & 17 deletions apis/route53/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions apis/route53/v1beta1/zz_generated.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 19 additions & 6 deletions apis/route53/v1beta1/zz_zone_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion config/externalname.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,8 @@ 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 is disabled as it is not recommended for usage by terraform,
// see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone_association
// "aws_route53_zone_association": FormattedIdentifierFromProvider(":", "zone_id", "vpc_id"),
// Imported using the id and version, e.g.,
// 01a52019-d16f-422a-ae72-c306d2b6df7e/1
Expand Down
9 changes: 0 additions & 9 deletions config/route53/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,8 @@ func Configure(p *config.Provider) {
}
})
p.AddResourceConfigurator("aws_route53_zone", func(r *config.Resource) {
// Mutually exclusive with aws_route53_zone_association
config.MoveToStatus(r.TerraformResource, "vpc")
r.References["delegation_set_id"] = config.Reference{
Type: "DelegationSet",
}
})
p.AddResourceConfigurator("aws_route53_zone_association", func(r *config.Resource) {
// Mutually exclusive with existing region field.
config.MoveToStatus(r.TerraformResource, "vpc_region")
r.References["zone_id"] = config.Reference{
Type: "Zone",
}
})
}
4 changes: 4 additions & 0 deletions examples-generated/route53/vpcassociationauthorization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ spec:
forProvider:
name: example.com
region: us-west-1
vpc:
- vpcIdSelector:
matchLabels:
testing.upbound.io/example-name: example

---

Expand Down
108 changes: 92 additions & 16 deletions package/crds/route53.aws.upbound.io_zones.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,98 @@ spec:
type: string
description: Key-value map of resource tags.
type: object
vpc:
description: Configuration block(s) specifying VPC(s) to associate
with a private hosted zone. Conflicts with the delegation_set_id
argument in this resource and any aws_route53_zone_association
resource specifying the same zone ID. Detailed below.
items:
properties:
vpcId:
description: ID of the VPC to associate.
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
vpcRegion:
description: Region of the VPC to associate. Defaults to
AWS provider region.
type: string
type: object
type: array
required:
- name
- region
Expand Down Expand Up @@ -360,22 +452,6 @@ spec:
those inherited from the provider default_tags configuration
block.
type: object
vpc:
description: Configuration block(s) specifying VPC(s) to associate
with a private hosted zone. Conflicts with the delegation_set_id
argument in this resource and any aws_route53_zone_association
resource specifying the same zone ID. Detailed below.
items:
properties:
vpcId:
description: ID of the VPC to associate.
type: string
vpcRegion:
description: Region of the VPC to associate. Defaults to
AWS provider region.
type: string
type: object
type: array
zoneId:
description: The Hosted Zone ID. This can be referenced by zone
records.
Expand Down

0 comments on commit d1f9ce4

Please sign in to comment.