GoogleCloudPlatform / deploymentmanager-samples

Deployment Manager samples and templates.
Apache License 2.0
939 stars 718 forks source link

Creating a DNS managedZone returns "INVALID_ARGUMENT" #555

Open jimanvlad opened 4 years ago

jimanvlad commented 4 years ago

Hi,

I am trying to create a managed DNS zone following the example here and I get the following error in Deployment Manager:

ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1588969909552-5a528e3048557-8403a662-67474853]: errors:
- code: RESOURCE_ERROR
  location: /deployments/dev-server/resources/YOUR_DEPLOYMENT_NAME
  message: '{"ResourceType":"dns.v1.managedZone","ResourceErrorCode":"400","ResourceErrorMessage":{"code":400,"message":"Request
    contains an invalid argument.","status":"INVALID_ARGUMENT","statusMessage":"Bad
    Request","requestPath":"https://dns.googleapis.com/dns/v1/projects/mygcpproject/managedZones","httpMethod":"POST"}}'

Code:

resources:
- name: YOUR_DEPLOYMENT_NAME
  type: gcp-types/dns-v1:managedZones
  properties:
    description: A managed zone
# Making dnsName unique with deployment name for testing purpose.
    dnsName: my-great-domain-YOUR_DEPLOYMENT_NAME.com.

I also tried with type: dns.v1.managedZone as well as type: gcp-types/dns-v1beta2:managedZones. I get the same exact same error regardless of the properties that I add.

I can create the managed zone via the Console, gcloud command as well as pinging the REST API manually.

It's unclear why my Deployment Manager request is invalid, and what the INVALID_ARGUMENT is.

Any ideas?

komasoftware commented 4 years ago

Same issue

            managedZones.append({
                'name': managedZoneResourceName,
                'type': 'gcp-types/dns-v1:managedZones',
                'properties': {
                    'project': '$(ref.' + projectResourceName + '.projectId)',
                    'name': managedZoneResourceName,
                    'dnsName': 'awesomedomain.com..',
                    'visibility': 'public'
                }
            })

{"ResourceType":"gcp-types/dns-v1:managedZones","ResourceErrorCode":"400","ResourceErrorMessage":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT","statusMessage":"Bad Request","requestPath":"https://dns.googleapis.com/dns/v1/projects/XXX/managedZones","httpMethod":"POST"}}

komasoftware commented 4 years ago

Turns out that 'description' is a required field. @jimanvlad that makes the call work.

... sigh

jimanvlad commented 4 years ago

Ah, that wasn’t very obvious :(

komasoftware commented 4 years ago

But I came to the conclustion that it is impossible to manage your zone files / resource records using DM. See also https://github.com/GoogleCloudPlatform/deploymentmanager-samples/issues/62 In a nutshell,it is possible create your records with DM, but you can not do a delta update to the records, which renders it useless.

ocsig commented 4 years ago

@komasoftware Please take a look at the 'type': 'gcp-types/dns-v1:resourceRecordSets' type. This was published at the end of 2018, after your thread. Official DM type examples CFT DNS record examples

I believe this solved the recordset update problem you had. Let me know if you have any feedback on this type as well.