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]: external-name can't be set on Instance.rds.aws.upbound.io/v1beta1 #1185

Open mlubanski opened 8 months ago

mlubanski commented 8 months ago

Is there an existing issue for this?

Affected Resource(s)

rds.aws.upbound.io/v1beta1 - Instance

Resource MRs required to reproduce the bug

apiVersion: rds.aws.upbound.io/v1beta1
kind: Instance
metadata:
  annotations:
    crossplane.io/external-name: eu1lab-eks001-default-mysql-1
  name: mysql-1-d6msv-q7h8m
spec:
  deletionPolicy: Delete
  forProvider:
    allocatedStorage: 20
    applyImmediately: false
    autoMinorVersionUpgrade: true
    availabilityZone: eu-west-1b
    backupRetentionPeriod: 0
    backupWindow: 14:00-16:00
    caCertIdentifier: rds-ca-rsa2048-g1
    copyTagsToSnapshot: true
    dbSubnetGroupName: private_net_vpc-***
    deleteAutomatedBackups: true
    enabledCloudwatchLogsExports:
    - audit
    engine: mysql
    engineVersion: 8.0.35
    instanceClass: db.t4g.small
    iops: 3000
    licenseModel: general-public-license
    maintenanceWindow: Mon:11:00-Mon:14:00
    manageMasterUserPassword: true
    maxAllocatedStorage: 1000
    multiAz: false
    networkType: IPV4
    optionGroupName: default-mysql-8-0
    parameterGroupName: eu1lab-eks001-default-mysql-1
    performanceInsightsEnabled: false
    port: 3306
    publiclyAccessible: false
    region: eu-west-1
    skipFinalSnapshot: true
    storageEncrypted: true
    storageThroughput: 125
    storageType: gp3
    username: root
    vpcSecurityGroupIds:
    - sg-06d7ecbe89aabc75a
    - sg-048580a25883584ad
  initProvider: {}
  managementPolicies:
  - '*'
  providerConfigRef:
    name: upbound-provider-aws
  publishConnectionDetailsTo:
    configRef:
      name: default
    metadata:
      labels:
        secret.crossplane.io/owner-uid: 98f13eb9-d748-4787-b0ba-bec432febf2d
    name: default-mysql-1-rdsinstance

Steps to Reproduce

create Instance ManagedResource with custom custom name set by crossplane.io/external-name: eu1lab-eks001-default-mysql-1 annotation

What happened?

During above MR creation in console I was able see in EXTERNAL-NAME column mysql-1-d6msv-q7h8m name In AWS Resource was named: terraform-20240301080146611000000001 After resource was successfully provisioned in AWS, crossplane changed value of crossplane.io/external-name to db-EZPPTHUGTJANNMPS7SMQI4QGYE (In AWS Console this value is visible as ResourceID)

Relevant Error Output Snippet

No response

Crossplane Version

1.15.1

Provider Version

1.1.0

Kubernetes Version

1.27.x

Kubernetes Distribution

local/kind

Additional Info

No response

shxdxwraze commented 8 months ago

We have the same behaviour

shxdxwraze commented 8 months ago

https://doc.crds.dev/github.com/upbound/provider-aws/rds.aws.upbound.io/Instance/v1beta2@v1.2.1#spec-forProvider-identifier @mlubanski try this

alexrygalov commented 8 months ago

@shxdxwraze thx, worked for me. However if you describe the managed resource the external-name is still generated by crossplane.

apiVersion: rds.aws.upbound.io/v1beta2
kind: Instance
metadata:
  name: aleks-test-01
spec:
  providerConfigRef:
    name: provider-aws
  forProvider:
    identifier: aleks-test-01
k get managed

NAME                                        SYNCED   READY   EXTERNAL-NAME                   AGE
instance.rds.aws.upbound.io/aleks-test-01   True     True    db-IZ3A2WLOJTEG4HBTMMJJXH4ELQ   8m2s
ulucinar commented 8 months ago

Hi @mlubanski, As @shxdxwraze mentioned above, you need to use the spec.forProvider.identifier to set the "DB Identifier", not the external-name annotation. We hold the AWS generated resource ID in the external-name annotation and its purpose and syntax is different than the DB identifier's. An example is db-Q4NG7NCIVPNEPHJA6BT7LUHDHI. Could you please try setting the DB identifier via the spec.forProvider.identifier?

github-actions[bot] commented 3 months 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.

pierluigilenoci commented 3 months ago

@mlubanski, is this still an issue?

abborisova commented 3 months ago

I face the same issue. I've tried setting the identifier but got an error spec.forProvider.identifier: field not declared in schema Setting metadata.name also didn't help

moksongmin commented 3 months ago

I've added the identifier, but ArgoCD can't sync the change successfully. image

In the CRD, I can see the identifier added under the 'last-applied-configuration' annotation, but it's not present under 'spec'.

mbbush commented 3 months ago

Which API version are you using in your composition? spec.forProvider.identifier doesn't exist in v1beta1, only in v1beta2 and v1beta3.

On Thu, Aug 15, 2024, 11:21 PM Momchi @.***> wrote:

I've added the identifier, but ArgoCD can't sync the change successfully. image.png (view on web) https://github.com/user-attachments/assets/c4992535-6ee3-495e-9309-cbb9dea144a8

In the CRD, I can see the identifier added under the 'last-applied-configuration' annotation, but it's not present under 'spec'.

— Reply to this email directly, view it on GitHub https://github.com/crossplane-contrib/provider-upjet-aws/issues/1185#issuecomment-2292893325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH2UAJGZ4B6J6OMS6QVPATZRWLADAVCNFSM6AAAAABEBLDSK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJSHA4TGMZSGU . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

moksongmin commented 3 months ago

@mbbush, I use apiVersion: rds.aws.upbound.io/v1beta2

moksongmin commented 3 months ago

Update:

Currently, I see the 'identifier' under the specs in the CRD: apiVersion: rds.aws.upbound.io/v1beta2 kind: Instance metadata: annotations: ... ... spec: forProvider: ... ... identifier: xyz

Also, as I was renaming the DB Identifier manually via the AWS console, it was scheduling to rename the instance back to 'terraform-XXXXXXX' during the maintenance window, but now that's not the case. Now I think that the issue is more probably related to ArgoCD, which is unable to sync the changes properly.