crossplane-contrib / provider-upjet-aws

AWS Provider for Crossplane.
https://marketplace.upbound.io/providers/upbound/provider-family-aws/
Apache License 2.0
146 stars 123 forks source link

[Bug]: Failing to convert AutoScalingGroup.launchTemplate from list to array #1394

Open josegonzalez opened 4 months ago

josegonzalez commented 4 months ago

Is there an existing issue for this?

Affected Resource(s)

Resource MRs required to reproduce the bug

apiVersion: autoscaling.aws.upbound.io/v1beta1
kind: AutoscalingGroup
metadata:
  name: "dev-us-east-1-private-consul"
  namespace: "dev"
  labels:
    name: "dev-us-east-1-private-consul"
    environment: "dev"
    region: "us-east-1"
spec:
  forProvider:
    # prettier-ignore
    desiredCapacity: 3
    # prettier-ignore
    maxSize: 3
    # prettier-ignore
    minSize: 3
    launchTemplate:
      - version: "$Latest"
        idSelector:
          matchLabels:
            name: "dev-us-east-1-private-consul"
            environment: "dev"
            region: "us-east-1"
    region: "us-east-1"
    tag:
      - key: Name
        value: "dev-us-east-1-private-consul"
      - key: environment
        value: "dev"
      - key: managed-by
        value: crossplane
    vpcZoneIdentifierSelector:
      matchLabels:
        subnet-type: "private"
        environment: "dev"
        vpc-name: "dev-us-east-1"

Steps to Reproduce

Apply the above manifest (with a matching template/subnet)

What happened?

Missing launchTemplate property on the converted v1beta3 resource.

Relevant Error Output Snippet

Message:               create failed: async create failed: failed to create the resource: [{0 creating Auto Scaling Group (dev-us-east-1-private-consul): operation error Auto Scaling: CreateAutoScalingGroup, https response error StatusCode: 400, RequestID: 7ebe95af-e405-4fcb-9a7a-dc53a888d835, api error ValidationError: Valid requests must contain either LaunchTemplate, LaunchConfigurationName, InstanceId or MixedInstancesPolicy parameter.  []}]

Spec


Spec:
  Deletion Policy:  Delete
  For Provider:
    Desired Capacity:  3
    Max Size:          3
    Min Size:          3
    Region:            us-east-1
    Tag:
      Key:    Name
      Value:  dev-us-east-1-private-consul
      Key:    environment
      Value:  dev
      Key:    managed-by
      Value:  crossplane
    Vpc Zone Identifier:
      subnet-12345
      subnet-67890
      subnet-45678
    Vpc Zone Identifier Refs:
      Name:  dev-us-east-1c-private
      Name:  dev-us-east-1b-private
      Name:  dev-us-east-1a-private
    Vpc Zone Identifier Selector:
      Match Labels:
        environment:  dev
        subnet-type:  private
        vpc-name:     dev-us-east-1
  Init Provider:
  Management Policies:
    *
  Provider Config Ref:
    Name:  default

Crossplane Version

1.16.0

Provider Version

1.8.0

Kubernetes Version

Client Version: v1.30.1 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.29.4-eks-036c24b

Kubernetes Distribution

EKS

Additional Info

Works fine if I manually change it and switch to the v1beta3 resource myself with the requisite resource changes.

See https://crossplane.slack.com/archives/C05E0UE46S2/p1720556633009269 for more discussion.

Maybe related: https://github.com/crossplane-contrib/provider-upjet-aws/pull/1332

turkenf commented 4 months ago

Since the launchTemplate field is an object in the v1beta3 version, please try without - :

    launchTemplate:
      version: "$Latest"
      idSelector:
josegonzalez commented 4 months ago

Yeah I'm aware, but I was using the v1beta1 object. That should either:

Currently it is silently ignored.

turkenf commented 4 months ago

In the example you gave, you used apiVersion: autoscaling.aws.upbound.io/v1beta3, I could not fully understand your issue.

You can continue to use the v1beta1 version as is, and if you have existing resources it should not be affected.

josegonzalez commented 4 months ago

Sorry that was a typo. I initially used v1beta1, verified it wouldn't update, then was swapping to v1beta3 with the correct changes. I've updated the example to what the resource was from my git repo.

github-actions[bot] commented 1 month ago

This provider repo does not have enough maintainers to address every issue. Since there has been no activity in the last 90 days it is now marked as stale. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.

josegonzalez commented 1 month ago

This is still a bug afaik.