elegant-crayon-4967
11/21/2022, 8:14 PM.apply
of another resource to ensure you get the proper string
type you want, where if you didn’t, you’d most likely get an error of undefined. I do this all the time, but on a net new stack, pulumi won’t show the resources to be created inside that .apply
which makes sense to me, but also very hard as some of these resources I want to import before my pulumi up and can’t verify they are importedvictorious-church-57397
11/21/2022, 8:30 PMdependsOn
to achieve this?elegant-crayon-4967
11/21/2022, 8:36 PM_asg_._loadBalancer_._dnsName_.apply((albDnsName) =>
victorious-church-57397
11/21/2022, 8:38 PMelegant-crayon-4967
11/21/2022, 8:39 PMvictorious-church-57397
11/21/2022, 8:41 PMelegant-crayon-4967
11/21/2022, 8:43 PMvictorious-church-57397
11/21/2022, 8:44 PM.then()
little-cartoon-10569
11/21/2022, 8:52 PMplace pulumi resources inside a .apply of another resource to ensure you get the proper string type you wantThis is never be necessary, and (imo) always wrong. You can use the output properties of the first resource in the 2nd resource without a problem.
elegant-crayon-4967
11/21/2022, 8:55 PMlittle-cartoon-10569
11/21/2022, 8:56 PMelegant-crayon-4967
11/21/2022, 8:56 PMlittle-cartoon-10569
11/21/2022, 8:56 PMelegant-crayon-4967
11/21/2022, 8:57 PMlittle-cartoon-10569
11/21/2022, 8:57 PMelegant-crayon-4967
11/21/2022, 8:58 PMlittle-cartoon-10569
11/21/2022, 8:58 PMelegant-crayon-4967
11/21/2022, 8:58 PMlittle-cartoon-10569
11/21/2022, 8:58 PMelegant-crayon-4967
11/21/2022, 8:59 PMlittle-cartoon-10569
11/21/2022, 9:00 PMvictorious-church-57397
11/21/2022, 9:00 PMlittle-cartoon-10569
11/21/2022, 9:01 PMconst record = new aws.route53.Record(name, {
name: pulumi.output(loadbalancer).dnsName,
...
elegant-crayon-4967
11/21/2022, 9:04 PM// Call MBX EC2 Library
const asg = new mbxec2.ASG({
...does things
)}
// Build DNS Entries for Ultra DNS & CloudFlare
asg.loadBalancer.dnsName.apply((albDnsName) => {
// AWS ALB Specific Record per Environment
if (env.appEnv.includes('-example')) {
config.ultraDnsRecords.map((ultraRecord) => {
new ultradns.Record(`${env.appEnv}-${ultraRecord.subDomain}-ultraDnsRecord`, {
ownerName: ultraRecord.subDomain,
recordType: 'CNAME',
zoneName: config.bookerTld,
ttl: 3600,
recordDatas:
ultraRecord.data == 'ALB-DNS-PLACEHOLDER' ? [`${albDnsName}.`] : [`${ultraRecord.data}`]
});
});
victorious-church-57397
11/21/2022, 9:05 PMelegant-crayon-4967
11/21/2022, 9:05 PMlittle-cartoon-10569
11/21/2022, 9:06 PMelegant-crayon-4967
11/21/2022, 9:06 PMasg.loadBalancer.dnsName
in the recordDates I would get undefinedlittle-cartoon-10569
11/21/2022, 9:06 PMelegant-crayon-4967
11/21/2022, 9:06 PMlittle-cartoon-10569
11/21/2022, 9:07 PMelegant-crayon-4967
11/21/2022, 9:08 PMlittle-cartoon-10569
11/21/2022, 9:08 PMelegant-crayon-4967
11/21/2022, 9:09 PMlittle-cartoon-10569
11/21/2022, 9:09 PMconst ultraPromised = lb.name.apply((_) => ultraReal))
elegant-crayon-4967
11/21/2022, 9:10 PMlittle-cartoon-10569
11/21/2022, 9:11 PMclever-sunset-76585
11/23/2022, 2:36 AMunfortunately the ultraDNS provider wants an array of stringsIt seems that the
recordDatas
property takes in an Input
of array of Input<string>
. So you should be able to use the ALB's dnsName
property directly as @little-cartoon-10569 suggested. Input
is a type union:
export declare type Input<T> = T | Promise<T> | OutputInstance<T>;
if you just useI think this might provide a hint as to what might be wrong here. How is thein the recordDates I would get undefinedasg.loadBalancer.dnsName
loadBalancer
property getting its value in the component resource mbxec2.ASG
? Also are you calling super.registerOutputs({})
in your component resource after you've created all the resources you need to?