Skip to content

Commit

Permalink
Merge f95de8c into d93b98e
Browse files Browse the repository at this point in the history
  • Loading branch information
drebes authored Nov 12, 2018
2 parents d93b98e + f95de8c commit 95e7e1f
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 287 deletions.
3 changes: 3 additions & 0 deletions products/dns/ansible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ datasources: !ruby/object:Provider::ResourceOverrides
overrides: !ruby/object:Provider::ResourceOverrides
ManagedZone: !ruby/object:Provider::Ansible::ResourceOverride
editable: false
properties:
labels: !ruby/object:Provider::Ansible::PropertyOverride
version_added: '2.8'
ResourceRecordSet: !ruby/object:Provider::Ansible::ResourceOverride
access_api_results: true
editable: true
Expand Down
15 changes: 15 additions & 0 deletions products/dns/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ objects:
A mutable string of at most 1024 characters associated with this
resource for the user's convenience. Has no effect on the managed
zone's function.
update_verb: :PATCH
update_url: 'projects/{{project}}/managedZones/{{name}}'
required: true
- !ruby/object:Api::Type::String
name: 'dnsName'
description: |
The DNS name of this managed zone, for instance "example.com.".
required: true
- !ruby/object:Api::Type::Integer
name: 'id'
description: Unique identifier for the resource; defined by the server.
Expand Down Expand Up @@ -81,6 +85,17 @@ objects:
The time that this resource was created on the server.
This is in RFC3339 text format.
output: true
- !ruby/object:Api::Type::KeyValuePairs
name: 'labels'
description: |
A set of key/value label pairs to assign to this ManagedZone.
update_verb: :PATCH
update_url: 'projects/{{project}}/managedZones/{{name}}'
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Managing Zones':
'https://cloud.google.com/dns/zones/'
api: 'https://cloud.google.com/dns/api/v1/managedZones'
- !ruby/object:Api::Resource
name: 'Project'
kind: 'dns#project'
Expand Down
44 changes: 44 additions & 0 deletions products/dns/terraform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

--- !ruby/object:Provider::Terraform::Config
overrides: !ruby/object:Provider::ResourceOverrides
ManagedZone: !ruby/object:Provider::Terraform::ResourceOverride
example:
- !ruby/object:Provider::Terraform::Examples
name: "dns_managed_zone_basic"
primary_resource_id: "example-zone"
version: <%= _version_name %>
properties:
creationTime: !ruby/object:Provider::Terraform::PropertyOverride
exclude: true
description: !ruby/object:Provider::Terraform::PropertyOverride
description: |
A textual description field. Defaults to 'Managed by Terraform'.
default_value: 'Managed by Terraform'
required: false
id: !ruby/object:Provider::Terraform::PropertyOverride
exclude: true
nameServerSet: !ruby/object:Provider::Terraform::PropertyOverride
exclude: true
ResourceRecordSet: !ruby/object:Provider::Terraform::ResourceOverride
exclude: true
Project: !ruby/object:Provider::Terraform::ResourceOverride
exclude: true

# This is for copying files over
files: !ruby/object:Provider::Config::Files
# These files have templating (ERB) code that will be run.
# This is usually to add licensing info, autogeneration notices, etc.
compile:
<%= lines(indent(compile('provider/terraform/product~compile.yaml'), 4)) -%>
2 changes: 1 addition & 1 deletion provider/terraform/utils/provider.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func Provider() terraform.ResourceProvider {
// end beta-only products
<% end -%>
GeneratedComputeResourcesMap,
GeneratedDnsResourcesMap,
GeneratedRedisResourcesMap,
GeneratedResourceManagerResourcesMap,
GeneratedStorageResourcesMap,
Expand Down Expand Up @@ -174,7 +175,6 @@ func Provider() terraform.ResourceProvider {
"google_dataflow_job": resourceDataflowJob(),
"google_dataproc_cluster": resourceDataprocCluster(),
"google_dataproc_job": resourceDataprocJob(),
"google_dns_managed_zone": resourceDnsManagedZone(),
"google_dns_record_set": resourceDnsRecordSet(),
"google_endpoints_service": resourceEndpointsService(),
"google_folder": resourceGoogleFolder(),
Expand Down
12 changes: 12 additions & 0 deletions templates/terraform/examples/dns_managed_zone_basic.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "google_dns_managed_zone" "<%= ctx[:primary_resource_id] %>" {
name = "example-zone"
dns_name = "example-${random_id.rnd.hex}.com."
description = "Example DNS zone"
labels = {
foo = "bar"
}
}

resource "random_id" "rnd" {
byte_length = 4
}
182 changes: 0 additions & 182 deletions third_party/terraform/resources/resource_dns_managed_zone.go

This file was deleted.

41 changes: 0 additions & 41 deletions third_party/terraform/tests/resource_dns_managed_zone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,8 @@ import (

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)

func TestAccDnsManagedZone_basic(t *testing.T) {
t.Parallel()

zoneSuffix := acctest.RandString(10)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckDnsManagedZoneDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccDnsManagedZone_basic(zoneSuffix, "description1"),
},
resource.TestStep{
ResourceName: "google_dns_managed_zone.foobar",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccDnsManagedZone_update(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -61,24 +38,6 @@ func TestAccDnsManagedZone_update(t *testing.T) {
})
}

func testAccCheckDnsManagedZoneDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)

for _, rs := range s.RootModule().Resources {
if rs.Type != "google_dns_zone" {
continue
}

_, err := config.clientDns.ManagedZones.Get(
config.Project, rs.Primary.ID).Do()
if err == nil {
return fmt.Errorf("DNS ManagedZone still exists")
}
}

return nil
}

func testAccDnsManagedZone_basic(suffix, description string) string {
return fmt.Sprintf(`
resource "google_dns_managed_zone" "foobar" {
Expand Down
Loading

0 comments on commit 95e7e1f

Please sign in to comment.