From 49ccbb75d356f2bf1c3507e25c2fd65f194ec9e1 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Wed, 22 Mar 2023 10:29:46 +0800 Subject: [PATCH] udpate: config.get() --- infrastructure/__main__.py | 11 +++++------ infrastructure/config/__init__.py | 5 +++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/infrastructure/__main__.py b/infrastructure/__main__.py index 1ba1c02e..2d2e140e 100644 --- a/infrastructure/__main__.py +++ b/infrastructure/__main__.py @@ -21,14 +21,13 @@ igw_id = internet_gateway( vpc_id ) route_table_id = route_table( vpc_id, igw_id ) subnets = subnets(vpc_id, az_list, route_table_id, 'public' ) -ssh_key = local.Command("random", - create="printenv SSH_PUBLIC_KEY" -) +#ssh_key = local.Command("random", +# create="printenv SSH_PUBLIC_KEY" +#) -pulumi.export("sshkey", ssh_key) -pulumi.export("sshkey", ssh_key.stdout) +public_key=config.get('SSH_PUBLIC_KEY') +key_pair = key_pair("deployer", public_key) -key_pair = pulumi_aws.ec2.KeyPair("deployer", public_key=ssh_key.stdout) # Create an AWS resource (S3 Bucket) #bucket = s3.Bucket('my-bucket') diff --git a/infrastructure/config/__init__.py b/infrastructure/config/__init__.py index d03d2b02..1beaf7d3 100644 --- a/infrastructure/config/__init__.py +++ b/infrastructure/config/__init__.py @@ -1,4 +1,5 @@ import os -def get( key_name ): - return os.environ[key_name] +def get(input): + output = Output.from_input(input) + return output.apply( os.environ[key_name] )