buildResourceNamePrefixFromParts

buildResourceNamePrefixFromParts( args: BuildResourceNamePrefixArgs, ): string

Builds a canonical JobCloud resource name prefix from explicit naming elements.

Remarks

The returned prefix deliberately excludes purpose, which consumers append as the resource-specific suffix. Select at most one optional qualifier:

  • account appends the six-character hash of a 12-digit AWS account ID;
  • serviceCode accepts only a value from iamRoleServiceCodes;
  • availabilityZone validates its region against jobcloudAllowedRegions and produces the same compact label used by AwsVpc (euw1a).

Parameters

Returns

  • string — The canonical prefix without a purpose suffix.

Example

CODE
import { buildResourceNamePrefixFromParts } from '@jobcloud/pulumi-helpers';

const prefix = buildResourceNamePrefixFromParts({
  projectName: 'checkout-service',
  stackName: 'prd',
});
// prd-<projectHash>
CODE
const prefix = buildResourceNamePrefixFromParts({
  projectName: 'checkout-service',
  stackName: 'prd',
  availabilityZone: 'eu-west-1a',
});
const resourceName = `${prefix}-orders`;
// prd-<projectHash>-euw1a-orders