Skip to content
GitHubXDiscord

ModuleDefaultVersion

The ModuleDefaultVersion resource allows you to specify the default version of a CloudFormation module. This is useful for managing versions of reusable CloudFormation components. For more details, refer to the AWS CloudFormation ModuleDefaultVersions documentation.

Create a basic ModuleDefaultVersion with a specified version ID and module name.

import AWS from "alchemy/aws/control";
const defaultVersion = await AWS.CloudFormation.ModuleDefaultVersion("defaultModuleVersion", {
VersionId: "v1.0.0",
ModuleName: "MyAwesomeModule"
});

Configure a ModuleDefaultVersion with additional properties such as adoption of existing resources.

const advancedVersion = await AWS.CloudFormation.ModuleDefaultVersion("advancedModuleVersion", {
VersionId: "v2.0.0",
ModuleName: "MyAwesomeModule",
adopt: true // This will adopt the existing resource instead of failing
});

When you create a ModuleDefaultVersion, you can also access the resource ARN and its creation/update timestamps.

const moduleInfo = await AWS.CloudFormation.ModuleDefaultVersion("infoModuleVersion", {
VersionId: "v2.1.0",
ModuleName: "MyAwesomeModule"
});
console.log(`Module ARN: ${moduleInfo.Arn}`);
console.log(`Creation Time: ${moduleInfo.CreationTime}`);
console.log(`Last Update Time: ${moduleInfo.LastUpdateTime}`);