From 86d8944b6fed28ca40bde53703f41a23b5ecee17 Mon Sep 17 00:00:00 2001 From: Murph Date: Mon, 18 Sep 2023 21:22:20 +0100 Subject: [PATCH] ignore cidr_block on lateinitialize to avoid conflicts when using ipam --- apis/ec2/v1beta1/zz_generated_terraformed.go | 1 + config/ec2/config.go | 1 + examples/ec2/vpc-ipampool.yaml | 81 ++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 examples/ec2/vpc-ipampool.yaml diff --git a/apis/ec2/v1beta1/zz_generated_terraformed.go b/apis/ec2/v1beta1/zz_generated_terraformed.go index 62976fd007..a6930b5339 100755 --- a/apis/ec2/v1beta1/zz_generated_terraformed.go +++ b/apis/ec2/v1beta1/zz_generated_terraformed.go @@ -6332,6 +6332,7 @@ func (tr *VPC) LateInitialize(attrs []byte) (bool, error) { return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") } opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("CidrBlock")) opts = append(opts, resource.WithNameFilter("IPv6CidrBlock")) li := resource.NewGenericLateInitializer(opts...) diff --git a/config/ec2/config.go b/config/ec2/config.go index 15e4d9b032..15c32a7f54 100644 --- a/config/ec2/config.go +++ b/config/ec2/config.go @@ -325,6 +325,7 @@ func Configure(p *config.Provider) { r.LateInitializer = config.LateInitializer{ IgnoredFields: []string{ "ipv6_cidr_block", + "cidr_block", }, } r.UseAsync = true diff --git a/examples/ec2/vpc-ipampool.yaml b/examples/ec2/vpc-ipampool.yaml new file mode 100644 index 0000000000..11e3c4d1c8 --- /dev/null +++ b/examples/ec2/vpc-ipampool.yaml @@ -0,0 +1,81 @@ +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPC +metadata: + annotations: + meta.upbound.io/example-id: ec2/v1beta1/vpc-ipampool + name: sample-vpc +spec: + forProvider: + region: us-west-1 + ipv4IpamPoolIdSelector: + matchLabels: + testing.upbound.io/example-name: ipampool + ipv4NetmaskLength: 28 + tags: + Name: DemoVpc +--- +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPCIpamPoolCidr +metadata: + annotations: + meta.upbound.io/example-id: ec2/v1beta1/vpc-ipampool + labels: + testing.upbound.io/example-name: ipampool + name: example +spec: + forProvider: + cidr: 172.2.0.0/16 + ipamPoolIdSelector: + matchLabels: + testing.upbound.io/example-name: ipampool + region: us-west-1 +--- +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPCIpamPool +metadata: + annotations: + meta.upbound.io/example-id: ec2/v1beta1/vpc-ipampool + labels: + testing.upbound.io/example-name: ipampool + name: example +spec: + forProvider: + addressFamily: ipv4 + ipamScopeIdSelector: + matchLabels: + testing.upbound.io/example-name: ipampool + locale: us-west-1 + region: us-west-1 +--- +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPCIpamScope +metadata: + annotations: + meta.upbound.io/example-id: ec2/v1beta1/vpc-ipampool + labels: + testing.upbound.io/example-name: ipampool + name: example +spec: + forProvider: + description: Another Scope + ipamIdSelector: + matchLabels: + testing.upbound.io/example-name: ipampool + region: us-west-1 +--- +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPCIpam +metadata: + annotations: + meta.upbound.io/example-id: ec2/v1beta1/vpc-ipampool + labels: + testing.upbound.io/example-name: ipampool + name: main +spec: + forProvider: + description: My IPAM + operatingRegions: + - regionName: us-west-1 + region: us-west-1 + tags: + Test: Main