early-truck-24471
12/06/2020, 5:10 PMapp_instance = ec2.Instance(........)
ip=app_instance.private_ip
ptr_splitted = ipaddress.ip_address(ip).reverse_pointer.split('.')
ptr_splitted[0] + '.' + ptr_splitted[1]
the output I'm expecting is: 21.101
my problem is when I send this function the ec2 instance IP it send the pulumi.output.Output
object
I'm familiar with the Output.concat
function but in my case, I need to change the actual string and I didn't find any examples on how to do that.
I would appreciate your suggestions.witty-candle-66007
12/07/2020, 2:02 PM.apply()
(https://www.pulumi.com/docs/intro/concepts/programming-model/#apply)
Here is a simple example that hopefully helps:
# Create an AWS resource (S3 Bucket)
bucket = s3.Bucket('my-bucket')
bucket_name_array = bucket.id.apply(
lambda id: id.split("-")
)
pulumi.export('bucket_name', bucket.id)
pulumi.export('name_array', bucket_name_array)