mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(organizations): store the tags passed to CreateAccount (#7302)
CreateAccount validated Tags and then dropped them, so ListTagsForResource on a new account was empty and Terraform reported tag drift on every account it created. Store them like CreateOrganizationalUnit does. Closes #7301
This commit is contained in:
1 parent
33e12b3cf7
commit
c79db010ea
2 files changed
+14
No files matched your search
+3
@@ -637,6 +637,9 @@ public class OrganizationsService implements ScpProvider, RootAccessOrganization
|
||||
|
||||
String newAccountId = allocateAccountId(organization);
|
||||
OrganizationAccount account = newMemberAccount(organization, newAccountId, email, accountName, "CREATED");
|
||||
if (tags != null) {
|
||||
account.getTags().putAll(tags);
|
||||
}
|
||||
accounts.putForAccount(organization.getMasterAccountId(), newAccountId, account);
|
||||
attachFullAwsAccess(organization, newAccountId);
|
||||
accountAccessRoleProvisioner.provision(newAccountId,
|
||||
|
||||
+11
@@ -80,6 +80,17 @@ class OrganizationsServiceTest {
|
||||
assertTrue(status.getAccountId().matches("\\d{12}"), status.getAccountId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void createAccountStoresTheRequestedTags() {
|
||||
service.createOrganization(MANAGEMENT_ACCOUNT, "ALL");
|
||||
|
||||
CreateAccountStatus status = service.createAccount(MANAGEMENT_ACCOUNT, "tagged@example.com", "Tagged",
|
||||
Map.of("team", "platform"), false);
|
||||
|
||||
assertEquals(Map.of("team", "platform"),
|
||||
service.listTagsForResource(MANAGEMENT_ACCOUNT, status.getAccountId()));
|
||||
}
|
||||
|
||||
/** The (member account, role name, management account) triples a provisioner received. */
|
||||
private static final class RecordedProvisions implements AccountAccessRoleProvisioner {
|
||||
final List<String> calls = new ArrayList<>();
|
||||
|
||||
Reference in new issue
Block a user