cuddly-smartphone-15267
12/02/2020, 11:20 AMreduce
and apply
just confused me a lot.. the example is basically creating some dns records for a certificate validation
const exampleRecord: aws.route53.Record[];
for (const range of Object.entries(exampleCertificate.domainValidationOptions.apply(domainValidationOptions => domainValidationOptions.reduce((__obj, dvo) => { ...__obj, [dvo.domainName]: {
name: dvo.resourceRecordName,
record: dvo.resourceRecordValue,
type: dvo.resourceRecordType,
} }))).map(([k, v]) => {key: k, value: v})) {
exampleRecord.push(new aws.route53.Record(`exampleRecord-${range.key}`, {
allowOverwrite: true,
name: range.value.name,
records: [range.value.record],
ttl: 60,
type: range.value.type,
zoneId: exampleZone.then(exampleZone => exampleZone.zoneId),
}));
}
const exampleCertificateValidation = new aws.acm.CertificateValidation("exampleCertificateValidation", {
certificateArn: exampleCertificate.arn,
validationRecordFqdns: exampleRecord.apply(exampleRecord => exampleRecord.map(record => record.fqdn)),
});
anybody that is more familiar with typescript than me perhaps suggest how to port it to the equivalent c# code?tall-librarian-49374
12/02/2020, 11:43 AMvar exampleRecordFqdns = exampleCertificate.DomainValidationOptions.Apply(dvos =>
{
var fqdns = new List<Output<string>>();
foreach (var dvo in dvos)
{
var record = new Record($"exampleRecord-{dvo.DomainName}", new RecordArgs
{
AllowOverwrite = true,
Name = dvo.ResourceRecordName,
Records = { dvo.ResourceRecordValue },
Ttl = 60,
Type = dvo.ResourceRecordType,
ZoneId = exampleZone.then(exampleZone => exampleZone.zoneId),
});
fqdns.Add(record.Fqdn);
}
return Output.All(fqdns);
});
var exampleCertificateValidation = new CertificateValidation("exampleCertificateValidation", new CertificateValidationArgs
{
CertificateArn = exampleCertificate.Arn,
ValidationRecordFqdns = exampleRecordFqdns
});
cuddly-smartphone-15267
12/02/2020, 11:55 AMaws:route53:Record (validationRecord-pulumitest.keypay.dev):
error: aws:route53/record:Record resource 'validationRecord-pulumitest.keypay.dev' has a problem: Required attribute is not set
error: aws:route53/record:Record resource 'validationRecord-pulumitest.keypay.dev' has a problem: Required attribute is not set
tall-librarian-49374
12/02/2020, 12:15 PMCertificateValidation
first, and then deploy again with it?Record
resources thencuddly-smartphone-15267
12/02/2020, 12:44 PMtall-librarian-49374
12/02/2020, 2:54 PMcuddly-smartphone-15267
12/02/2020, 9:10 PM