Move the AWS account e-mail from labels to annotations

Signed-off-by: Radu Ciopraga <1442639+raduciopraga@users.noreply.github.com>
This commit is contained in:
Radu Ciopraga
2024-02-08 14:56:21 +01:00
parent 52941b2639
commit 22927c4164
3 changed files with 9 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-aws': patch
---
Move the AWS account e-mail from labels to annotations to fix the creation of `cloud-account` resources.
@@ -59,11 +59,11 @@ describe('AwsOrganizationCloudAccountProcessor', () => {
'amazonaws.com/arn':
'arn:aws:organizations::192594491037:account/o-1vl18kc5a3/957140518395',
'amazonaws.com/account-id': '957140518395',
'amazonaws.com/account-email': 'aws-test-account@backstage.io',
'amazonaws.com/organization-id': 'o-1vl18kc5a3',
},
labels: {
'amazonaws.com/account-status': 'active',
'amazonaws.com/account-email': 'aws-test-account@backstage.io',
},
name: 'test-account',
title: 'Test Account',
@@ -108,11 +108,11 @@ describe('AwsOrganizationCloudAccountProcessor', () => {
'amazonaws.com/arn':
'arn:aws:organizations::192594491037:account/o-1vl18kc5a3/957140518395',
'amazonaws.com/account-id': '957140518395',
'amazonaws.com/account-email': '',
'amazonaws.com/organization-id': 'o-1vl18kc5a3',
},
labels: {
'amazonaws.com/account-status': '',
'amazonaws.com/account-email': '',
},
name: 'test-account',
title: 'Test Account',
@@ -38,11 +38,11 @@ const AWS_ORGANIZATION_REGION = 'us-east-1';
const LOCATION_TYPE = 'aws-cloud-accounts';
const ACCOUNTID_ANNOTATION = 'amazonaws.com/account-id';
const ACCOUNT_EMAIL_ANNOTATION = 'amazonaws.com/account-email';
const ARN_ANNOTATION = 'amazonaws.com/arn';
const ORGANIZATION_ANNOTATION = 'amazonaws.com/organization-id';
const ACCOUNT_STATUS_LABEL = 'amazonaws.com/account-status';
const ACCOUNT_EMAIL_LABEL = 'amazonaws.com/account-email';
/**
* A processor for ingesting AWS Accounts from AWS Organizations.
@@ -171,9 +171,9 @@ export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
[ACCOUNTID_ANNOTATION]: accountId,
[ARN_ANNOTATION]: account.Arn || '',
[ORGANIZATION_ANNOTATION]: organizationId,
[ACCOUNT_EMAIL_ANNOTATION]: account.Email || '',
},
labels: {
[ACCOUNT_EMAIL_LABEL]: account.Email || '',
[ACCOUNT_STATUS_LABEL]: this.normalizeAccountStatus(
account.Status || '',
),