Pulumi does not know about my Python Class Output

Help me understand why Pulumi is not recognizing my output? I’ve been grappling with this issue for two and a half days, and it’s becoming increasingly frustrating. Your prompt assistance would be greatly appreciated.

This is my error; it keeps coming up in this class no matter what I try.

    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "C:DevOpsGreenStoneInvestorPortalcority.awsinfrastructure.pulumi.greenstone.investorportalinfrastructure__main__.py", line 62, in <module>
        security_groups=[security_group_creation.security_group_id],
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'CoritySECG' object has no attribute 'security_group_id'. Did you mean: 'security_group_type'?

My class code:

import pulumi
import pulumi_aws as aws
from pulumi import ResourceOptions, Output
from typing import Mapping, List


class SECGArgs:
    """The arguments necessary to construct a security group resource"""

    def __init__(
        self,
        base_tags: Mapping[str, str],
        internal: bool,
        enable_deletion_protection: bool,
        service_type: List[str],
        cidr_blocks: List[str],
        vpc_id: str,
    ):
        self.internal = internal
        self.service_type = service_type
        self.cidr_blocks = cidr_blocks
        self.enable_deletion_protection = enable_deletion_protection
        self.vpc_id = vpc_id
        self.base_tags = base_tags


class CoritySECG(pulumi.ComponentResource):
    def __init__(
        self, resource_name: str, args: SECGArgs, opts: ResourceOptions = None
    ):
        super().__init__("cority:aws:ecs", resource_name, {}, opts)

        self.sec_group_name = resource_name
        self.internal = args.internal
        self.enable_deletion_protection = args.enable_deletion_protection
        self.vpc_id = args.vpc_id
        self.base_tags = args.base_tags
        self.service_type = args.service_type
        self.cidr_blocks = args.cidr_blocks

    def security_group_type(self, args: SECGArgs, sec_group_name: str):
        if args.service_type == "ecs":
            # Create a Security Group for ECS
            security_group = aws.ec2.SecurityGroup(
                sec_group_name,
                description="Allow all inbound traffic for ECS tasks.",
                vpc_id=args.vpc_id,
                ingress=[
                    aws.ec2.SecurityGroupIngressArgs(
                        protocol="-1",  # All protocols
                        from_port=0,
                        to_port=0,
                        cidr_blocks=["0.0.0.0/0"],
                    ),
                ],
                egress=[
                    aws.ec2.SecurityGroupEgressArgs(
                        protocol="-1",  # All protocols
                        from_port=0,
                        to_port=0,
                        cidr_blocks=["0.0.0.0/0"],
                    ),
                ],
                tags=args.base_tags,
            )
        elif args.service_type == "ec2":
            # Create a Security Group for EC2
            security_group = aws.ec2.SecurityGroup(
                sec_group_name,
                description="Allow SSH and HTTP inbound traffic for EC2 instances.",
                vpc_id=args.vpc_id,
                ingress=[
                    aws.ec2.SecurityGroupIngressArgs(
                        protocol="tcp",
                        from_port=22,
                        to_port=22,
                        cidr_blocks=["0.0.0.0/0"],  # Allow SSH from anywhere
                    ),
                    aws.ec2.SecurityGroupIngressArgs(
                        protocol="tcp",
                        from_port=80,
                        to_port=80,
                        cidr_blocks=["0.0.0.0/0"],  # Allow HTTP from anywhere
                    ),
                ],
                egress=[
                    aws.ec2.SecurityGroupEgressArgs(
                        protocol="-1",  # All protocols
                        from_port=0,
                        to_port=0,
                        cidr_blocks=["0.0.0.0/0"],
                    ),
                ],
                tags=args.base_tags,
            )
        elif args.service_type in ["ecs", "ec2"]:
            # Create a Security Group for both ECS and EC2
            security_group = aws.ec2.SecurityGroup(
                sec_group_name,
                description="Allow all inbound traffic for ECS tasks and SSH/HTTP for EC2 instances.",
                vpc_id=args.vpc_id,
                ingress=[
                    aws.ec2.SecurityGroupIngressArgs(
                        protocol="-1",  # All protocols for ECS
                        from_port=0,
                        to_port=0,
                        cidr_blocks=["0.0.0.0/0"],
                    ),
                    aws.ec2.SecurityGroupIngressArgs(
                        protocol="tcp",
                        from_port=22,
                        to_port=22,
                        cidr_blocks=["0.0.0.0/0"],  # Allow SSH from anywhere for EC2
                    ),
                    aws.ec2.SecurityGroupIngressArgs(
                        protocol="tcp",
                        from_port=80,
                        to_port=80,
                        cidr_blocks=["0.0.0.0/0"],  # Allow HTTP from anywhere for EC2
                    ),
                ],
                egress=[
                    aws.ec2.SecurityGroupEgressArgs(
                        protocol="-1",  # All protocols
                        from_port=0,
                        to_port=0,
                        cidr_blocks=["0.0.0.0/0"],
                    ),
                ],
                tags=args.base_tags,
            )

            return security_group

        self.security_group_id = security_group.id

        self.register_outputs({"security_group_id": self.security_group_id})

I am calling the class like so (Please assume all imports are working; I cant share the whole of main because of company data):

secg_args = security_group.SECGArgs(
    base_tags={"Project": "Portal"},
    internal=False,
    enable_deletion_protection=False,
    service_type=["ecs", "ec2"],
    cidr_blocks=[cnetworking.vpc_cidr_block],
    vpc_id=vpc_id,
)

# Create Security Group
security_group_creation = security_group.CoritySECG(
    resource_name="ecs-ec2-ip-sec-group",
    args=secg_args,
    opts=None,
)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật