iac_modules/aws/__init__.py: update all return values

This commit is contained in:
Haitao Pan 2023-03-20 23:56:07 +08:00
parent c614e3e912
commit 41560213e3
2 changed files with 12 additions and 12 deletions

View File

@ -2,22 +2,20 @@
import aws
vpc = aws.vpc()
print(vpc)
print(vpc.id)
sg = aws.security_group(vpc.id )
vpc_id = aws.vpc()
sg_id = aws.security_group(vpc_id )
az_list = aws.availability_zones()
igw = aws.internet_gateway( vpc.id )
route_table = aws.route_table( vpc.id, igw.id )
igw_id = aws.internet_gateway( vpc_id )
route_table_id = aws.route_table( vpc_id, igw_id )
subnets=subnets(vpc_id=vpc.id, az_name=az_list, route_table_id=route_table.id, net_type=public )
subnets=subnets(vpc_id=vpc_id, az_name=az_list, route_table_id=route_table_id, net_type=public )
# Create an AWS resource (S3 Bucket)
bucket = s3.Bucket('my-bucket')
# Export the name of the bucket
pulumi.export('bucket_name', bucket.id)
pulumi.export("vpc", vpc.id)
pulumi.export("sg", sg.id)
pulumi.export('bucket_name', bucket)
pulumi.export("vpc", vpc_id)
pulumi.export("sg", sg_id)
pulumi.export("subnets", subnets)

View File

@ -14,7 +14,7 @@ def vpc():
instance_tenancy='default',
tags={"Project": project_name,
"Stack": stack_name})
return vpc
return vpc.id
#------------------------------------#
def availability_zones():
@ -36,6 +36,7 @@ def internet_gateway( vpc_id ):
"Stack": stack_name
}
)
return igw.id
#------------------------------------#
def route_table( vpc_id, igw_id ):
@ -51,6 +52,7 @@ def route_table( vpc_id, igw_id ):
"Stack": stack_name
}
)
return route_table.id
#------------------------------------#
def security_group( vpc_id ):
@ -83,7 +85,7 @@ def security_group( vpc_id ):
"Stack": stack_name
}
)
return security_group
return security_group.id
#------------------------------------#
def subnets( vpc_id, az_name, route_table_id, net_type='private' ):