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

AWS instances not recreated #205

Open waldner opened 2 years ago

waldner commented 2 years ago

Crossplane 1.8.1, jet-aws provider 0.4.2,

I wanted to test the convergence behavior, so I created an AWS instance with the following YAML:

apiVersion: ec2.aws.jet.crossplane.io/v1alpha2
kind: Instance
metadata:
  name: crossplane-instance
spec:
  forProvider:
    region: eu-west-1
    ami: ami-0a10fe11f3e1bf41e
    instanceType: t2.micro
    keyName: mykey
  providerConfigRef:
    name: aws-provider-config

The creation was fine. I terminated the instance from the AWS console, and crossplane doesn't recreate it with this error:

    - lastTransitionTime: "2022-06-02T11:45:18Z"
      message: 'create failed: cannot apply: apply failed: error collecting instance settings: error creating resource: iops attribute not supported for root_block_device with volume_type gp2: : File name: main.tf.json'
      reason: ReconcileError
      status: "False"
      type: Synced

Indeed, main.tf.json has the following:

"root_block_device":[{"iops":100,"volume_size":10,"volume_type":"gp2"}]

and the Instance spec also:

      rootBlockDevice:
      - iops: 100
        volumeSize: 10
        volumeType: gp2

so it looks like it was incorrectly backfilled after creation? Any help appreciated.

EDIT: After manually edit the Instance YAML and removing the rootBlockDevice from the spec, crossplane now fails with:

      message: "create failed: cannot apply: apply failed: Error launching source instance: UnsupportedOperation: The t2.micro instance type does not support specifying CpuOptions.\n\tstatus code: 400, request id: 9a1ada5a-17cb-4e46-9729-fe43a1d25031: : File name: main.tf.json"

After removing the CPU options from the YAML, the instance was finally recreated.