'Alternative solution to the Launch template version value for multiple AWS accounts

I have a AWS CF script which creates the stack via the parent template according to the account (Development & Production).

2 templates are names as - DevLaunchTemplate and ProdLaunchTemplate

In the resource I am using the FindInMap function to get the Launch template name according to the account.

Now the ask is to make this CF as a single use for both the accounts and to avoid using the "DevLaunchTemplate" name in the version. Is there a way that I can do this?

"Mappings": {
    "TimeZoneMapping": {
        "ca-central-1": {
            "TimeZone": "Eastern Standard Time",
            "Culture": "en-CA"
        },
        "ap-southeast-2": {
            "TimeZone": "AUS Eastern Standard Time",
            "Culture": "en-AU"
        },
        "us-east-1": {
            "TimeZone": "Eastern Standard Time",
            "Culture": "en-US"
        },
        "us-east-2": {
            "TimeZone": "Eastern Standard Time",
            "Culture": "en-US"
        },
        "us-west-1": {
            "TimeZone": "Pacific Standard Time",
            "Culture": "en-US"
        },
        "us-west-2": {
            "TimeZone": "Pacific Standard Time",
            "Culture": "en-US"
        }
    },
    "Account" : {
        "123456789" : {
            "LaunchConfig" : "DevLaunchTemplate"
        },
        "987654321" : {
            "LaunchConfig" : "ProdLaunchTemplate"
        }
    }
},
"Resources": {
    "AutoScalingGroup": {
        "Type": "AWS::AutoScaling::AutoScalingGroup",
        "DependsOn": ["DevLaunchTemplate","ProdLaunchTemplate"],
        "Properties": {
            "AutoScalingGroupName": {
                "Fn::Join" : [ "-", ["cld", { "Fn::Select" : [ "1", { "Fn::Split": ["-", {"Fn::Sub": "${AWS::StackName}"}]}]}, { "Fn::Select" : [ "2", { "Fn::Split": ["-", {"Fn::Sub": "${AWS::StackName}"}]}]}]]
            },
            "AvailabilityZones": [
                {
                    "Fn::Select": [
                        0,
                        {
                            "Fn::GetAZs": ""
                        }
                    ]
                },
                {
                    "Fn::Select": [
                        1,
                        {
                            "Fn::GetAZs": ""
                        }
                    ]
                }
            ],
            "VPCZoneIdentifier": {
                "Ref": "Subnets"
            },
            "LaunchTemplate": {
                "LaunchTemplateName": {
                    "Fn::Sub": [
                        "${AWS::StackName}-${FindInMapLaunchConfig}",
                        {
                            "FindInMapLaunchConfig": {
                                "Fn::FindInMap": [
                                    "Account",
                                    {
                                        "Ref": "AWS::AccountId"
                                    },
                                    "LaunchConfig"
                                ]
                            }
                        }
                    ]
                },
                "Version" : { "Fn::GetAtt" : [ "DevLaunchTemplate", "LatestVersionNumber" ] }
            },
            "MaxSize": 1,
            "MinSize": 1,
            "DesiredCapacity": "1",
            "Cooldown": "900",
            "NotificationConfiguration": {
                "TopicARN": {
                    "Ref": "SNSTopic"
                },
            },
        },
        "CreationPolicy": {
            "ResourceSignal": {
                "Count": "1",
                "Timeout": "PT30M"
            }
        }
    },
    "DevLaunchTemplate":{
        "Type":"AWS::EC2::LaunchTemplate",
        "Properties":{
            "LaunchTemplateName":{
                "Fn::Sub": "${AWS::StackName}-DevLaunchTemplate"
            },
            "LaunchTemplateData":{
                "IamInstanceProfile":{
                     "Arn":{"Fn::GetAtt": ["ProvisioningToolProfile", "Arn"]}
            },
            "InstanceMarketOptions":{
                "MarketType": "spot",
                "SpotOptions": {
                    "MaxPrice" : "0.5"
                }
            },
            "ImageId":{
                "Ref": "AMIId"
            },
            "InstanceType":{
                "Ref": "InstanceType"
            },
            "KeyName":{
                "Ref": "KeyName"
            },
            "SecurityGroupIds":[{
                "Ref": "SecurityGroup"
            }],
            "EbsOptimized": "false",
            "BlockDeviceMappings": [
                {
                    "DeviceName": "/dev/sda1",
                    "Ebs": {
                        "VolumeSize": "40",
                        "VolumeType": "gp3",
                        "Encrypted": "true"
                    }
                }
            ]
        }
        }
    },
    "ProdLaunchTemplate":{
        "Type":"AWS::EC2::LaunchTemplate",
        "Properties":{
            "LaunchTemplateName":{
                "Fn::Sub": "${AWS::StackName}-ProdLaunchTemplate"
            },
            "LaunchTemplateData":{
                "IamInstanceProfile":{
                     "Arn":{"Fn::GetAtt": ["ProvisioningToolProfile", "Arn"]}
            },
            "ImageId":{
                "Ref": "AMIId"
            },
            "InstanceType":{
                "Ref": "InstanceType"
            },
            "KeyName":{
                "Ref": "KeyName"
            },
            "SecurityGroupIds":[{
                "Ref": "SecurityGroup"
            }],
            "EbsOptimized": "false",
            "BlockDeviceMappings": [
                {
                    "DeviceName": "/dev/sda1",
                    "Ebs": {
                        "VolumeSize": "40",
                        "VolumeType": "gp3",
                        "Encrypted": "true"
                    }
                }
            ]
        }
    },

How do I format the below code part to make it as a single use for both development and production account?

"Version" : { "Fn::GetAtt" : [ "DevLaunchTemplate", "LatestVersionNumber" ] }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source