Hi Friends, how can i modify pulumi output value ?...
# cloudengineering-support
Hi Friends, how can i modify pulumi output value ? my example: when I create an ec2 instance I want to take the instance private IP: '' and create a reverse record(ptr) usually, I would do the following
Copy code
app_instance = ec2.Instance(........)
ptr_splitted = ipaddress.ip_address(ip).reverse_pointer.split('.')
ptr_splitted[0] + '.' + ptr_splitted[1]
the output I'm expecting is:
my problem is when I send this function the ec2 instance IP it send the
object I'm familiar with the
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.
any suggestions?
You need to use
(https://www.pulumi.com/docs/intro/concepts/programming-model/#apply) Here is a simple example that hopefully helps:
Copy code
# 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)