aws/__init__.py: update aws.key_pair()

This commit is contained in:
Haitao Pan 2023-03-21 23:11:09 +08:00
parent 1eecdd243b
commit 921095c67a
2 changed files with 3 additions and 4 deletions

View File

@ -1,5 +1,6 @@
"""An AWS Python Pulumi AWS Module"""
import config
import pulumi
from aws import vpc
@ -10,8 +11,6 @@ from aws import internet_gateway
from aws import availability_zones
from aws import key_pair
import config
vpc_id = vpc()
az_list = availability_zones()
sg_id = security_group( vpc_id )

View File

@ -22,8 +22,8 @@ def vpc():
return vpc.id
#------------------------------------#
def key_pair( name, ssh_public_key ):
keypair = ec2.KeyPair( name, ssh_public_key )
def key_pair( resource_name: str, public_key: Optional[str] = None):
keypair = ec2.KeyPair( resource_name, public_key )
return keypair.key_name
#------------------------------------#
def availability_zones():