crossplane-contrib / provider-jet-aws

AWS Provider for Crossplane that is built with Terrajet.
https://crossplane.io
Apache License 2.0
37 stars 30 forks source link

EIP is not associated to new instance after instance recreation #239

Open endrec opened 1 year ago

endrec commented 1 year ago

What happened?

I have created an EC2 instnace, and an Elastic IP, which references the instance. After the instance is deleted and recreated, EIP is not re-attached to the new instance. (Workaround: manually remove spec.forProvider.instance from EIP.)

How can we reproduce it?

  1. Create an EC2 instance:
    apiVersion: ec2.aws.jet.crossplane.io/v1alpha2
    kind: Instance
    metadata:
    name: test-server
    spec:
    providerConfigRef:
    name: aws-provider
    forProvider:
    region: eu-west-2 # or any other, as long as it is same as eip
    # Not important for reproduction, whatever you need to have a running instance
    [...]
  2. Create an EIP:
    apiVersion: ec2.aws.jet.crossplane.io/v1alpha2
    kind: EIP
    metadata:
    name: test-eip
    spec:
    providerConfigRef:
    name: aws-provider
    forProvider:
    region: eu-west-2 # or any other, as long as it is same as instance
    vpc: true
    instanceRef:
      name: test-server
  3. Apply both instance and EIP manifests, and observe they are synchronised and ready.
  4. kubectl delete instance.ec2.aws.jet.crossplane.io/test-server, and reapply instance manifest.
  5. After instance is synchronised and ready, observe EIP is not reattached.

What environment did it happen in?

Crossplane version: v0.5.0-preview EKS: 1.21