# automation-api


01/19/2023, 9:39 AM
Hello, I am trying to create multiple dns records in cloudflare using the automation api. And as such have a
of ips that should be mapped to a single domain, this is entirely supported by Cloudflare by just creating multiple records. However as the Ip's comes in as an
because I first have to provision the necessary infrastructure I have no other choice but to use an
to get the underlying Ip's to be able to create the records. However, as per the documentation for apply ( it specifically recommends against doing this. How would I go about creating a list of DNS records based on a variable amount of Ip's when the Cloudflare record type does not accept a list of Ip's but only a
( My code looks like this:
Copy code
public ClusterDnsComponent(string name, Input<List<string>> externalIps, DeploymentRegion region,
        ComponentResourceOptions? options = null)
        : base("dgz:cloudflare:clusterdns", name, options)
        var opts = new CustomResourceOptions()
            Parent = this

        var dnsNames = externalIps.Apply(e => e.Select((externalIp, index) =>
                var record = new Cloudflare.Record($"cluster-dns-{index}", new Cloudflare.RecordArgs()
                    ZoneId = "",
                    Name = NamingHelper.GetClusterDnsName(region),
                    Value = externalIp,
                    Type = Constants.Domain.DsnTypes.ARecord,
                }, opts);
                return record.Name;

        DnsNames = dnsNames.Apply(o => Output.All(o).Apply(s => s));
As far as I can see Pulumi suggests using an apply themselves in one of their examples here, but I would love to hear if there is a better way, that may not give incorrect results for preview