Hi ! I am trying to setup a private dns zone conne...
# google-cloud
a
Hi ! I am trying to setup a private dns zone connected with ServiceDiscovery service. Unfortunately, when i run this code:
Copy code
const serviceDirectoryNamespace = new gcp.servicedirectory.Namespace('ns', {
    namespaceId: "nsid",
    location: 'europe-west3',
    project,
    });
const dnsManagedZone = new gcp.dns.ManagedZone('zone',{
    dnsName: 'fancy.local.',
    project,
    visibility: "private",
    serviceDirectoryConfig: {
      namespace: {
        namespaceUrl: serviceDirectoryNamespace.selfLink,
      },
    }
});
i get this error message:
gcp:dns/managedZone:ManagedZone resource 'zone' has a problem: "service_directory_config.0.namespace.0.namespace_url": required field is not set
if i change
serviceDirectoryConfig
and wrap the contents in arrays, I get error messages like this:
[...] has a problem: service_directory_config.0.namespace.0: expected object, got slice
the code i have looks pretty much like the code here: https://github.com/pulumi/pulumi-gcp/blob/master/sdk/nodejs/dns/managedZone.ts#L134 does anybody have an idea why this is not working ?
w
I’m not all that familiar with these resources, but here are couple of thoughts in case it helps: The example code you reference uses the
id
property instead of the
selfLink
property like in your code. Assuming
selfLink
is correct, then I’m thinking you may want to use
apply()
to resolve the
selfLink
property when used in the dnsManagedZone declaration. For example:
Copy code
const dnsManagedZone = serviceDirectoryNamespace.selfLink.apply(link =>
new gcp.dns.ManagedZone('zone',{
    dnsName: 'fancy.local.',
    project,
    visibility: "private",
    serviceDirectoryConfig: {
      namespace: {
        namespaceUrl: link,
      },
    }
}))
You can read more about what the apply does here: https://www.pulumi.com/docs/intro/concepts/inputs-outputs
a
awesome !
changing from selfLink to id worked
thanks !