From c3da024d7e8f9333749c64c5ec3f49313d83a36b Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Tue, 5 Sep 2017 07:47:55 +0100 Subject: [PATCH 1/2] Remove 'id' fields from schemas --- google/resource_compute_ssl_certificate.go | 7 ------- google/resource_compute_target_http_proxy.go | 7 ------- google/resource_compute_target_https_proxy.go | 7 ------- google/resource_compute_url_map.go | 7 ------- google/resource_google_project.go | 6 ------ 5 files changed, 34 deletions(-) diff --git a/google/resource_compute_ssl_certificate.go b/google/resource_compute_ssl_certificate.go index 32579cca..79a72ab2 100644 --- a/google/resource_compute_ssl_certificate.go +++ b/google/resource_compute_ssl_certificate.go @@ -2,7 +2,6 @@ package google import ( "fmt" - "strconv" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" @@ -61,11 +60,6 @@ func resourceComputeSslCertificate() *schema.Resource { ForceNew: true, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - "project": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -140,7 +134,6 @@ func resourceComputeSslCertificateRead(d *schema.ResourceData, meta interface{}) } d.Set("self_link", cert.SelfLink) - d.Set("id", strconv.FormatUint(cert.Id, 10)) return nil } diff --git a/google/resource_compute_target_http_proxy.go b/google/resource_compute_target_http_proxy.go index 2f7913b0..80b88f54 100644 --- a/google/resource_compute_target_http_proxy.go +++ b/google/resource_compute_target_http_proxy.go @@ -3,7 +3,6 @@ package google import ( "fmt" "log" - "strconv" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/compute/v1" @@ -34,11 +33,6 @@ func resourceComputeTargetHttpProxy() *schema.Resource { ForceNew: true, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - "project": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -134,7 +128,6 @@ func resourceComputeTargetHttpProxyRead(d *schema.ResourceData, meta interface{} } d.Set("self_link", proxy.SelfLink) - d.Set("id", strconv.FormatUint(proxy.Id, 10)) return nil } diff --git a/google/resource_compute_target_https_proxy.go b/google/resource_compute_target_https_proxy.go index fc75508f..8a6c0ac5 100644 --- a/google/resource_compute_target_https_proxy.go +++ b/google/resource_compute_target_https_proxy.go @@ -3,7 +3,6 @@ package google import ( "fmt" "log" - "strconv" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/compute/v1" @@ -55,11 +54,6 @@ func resourceComputeTargetHttpsProxy() *schema.Resource { Computed: true, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - "project": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -178,7 +172,6 @@ func resourceComputeTargetHttpsProxyRead(d *schema.ResourceData, meta interface{ d.Set("ssl_certificates", proxy.SslCertificates) d.Set("self_link", proxy.SelfLink) - d.Set("id", strconv.FormatUint(proxy.Id, 10)) return nil } diff --git a/google/resource_compute_url_map.go b/google/resource_compute_url_map.go index 855799e8..b9c7ecb4 100644 --- a/google/resource_compute_url_map.go +++ b/google/resource_compute_url_map.go @@ -2,7 +2,6 @@ package google import ( "fmt" - "strconv" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/compute/v1" @@ -63,11 +62,6 @@ func resourceComputeUrlMap() *schema.Resource { }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, - "path_matcher": &schema.Schema{ Type: schema.TypeList, Optional: true, @@ -315,7 +309,6 @@ func resourceComputeUrlMapRead(d *schema.ResourceData, meta interface{}) error { d.SetId(name) d.Set("self_link", urlMap.SelfLink) - d.Set("id", strconv.FormatUint(urlMap.Id, 10)) d.Set("fingerprint", urlMap.Fingerprint) hostRuleMap := make(map[string]*compute.HostRule) diff --git a/google/resource_google_project.go b/google/resource_google_project.go index 5b6efbce..0bbc7107 100644 --- a/google/resource_google_project.go +++ b/google/resource_google_project.go @@ -30,12 +30,6 @@ func resourceGoogleProject() *schema.Resource { MigrateState: resourceGoogleProjectMigrateState, Schema: map[string]*schema.Schema{ - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - Removed: "The id field has been removed. Use project_id instead.", - }, "project_id": &schema.Schema{ Type: schema.TypeString, Required: true, From ac73bebb156fcd74a5ab7e44e3b61cff0646a9ec Mon Sep 17 00:00:00 2001 From: Paddy Date: Mon, 25 Sep 2017 07:23:46 -0700 Subject: [PATCH 2/2] Rename instead of removing. Rename all ID fields to {resource_noun}_id instead of removing them outright. This means people can still get at the info. Leave project's id deleted. It has been marked as Removed for months. I'm fine with cleaning it up before 1.0.0. Also, update website docs. --- google/resource_compute_ssl_certificate.go | 7 +++++++ google/resource_compute_target_http_proxy.go | 7 +++++++ google/resource_compute_target_https_proxy.go | 10 +++++++++- google/resource_compute_url_map.go | 7 +++++++ website/docs/r/compute_ssl_certificate.html.markdown | 4 ++-- website/docs/r/compute_target_http_proxy.html.markdown | 2 +- .../docs/r/compute_target_https_proxy.html.markdown | 2 +- website/docs/r/compute_url_map.html.markdown | 2 +- 8 files changed, 35 insertions(+), 6 deletions(-) diff --git a/google/resource_compute_ssl_certificate.go b/google/resource_compute_ssl_certificate.go index 79a72ab2..7a7dc2e2 100644 --- a/google/resource_compute_ssl_certificate.go +++ b/google/resource_compute_ssl_certificate.go @@ -2,6 +2,7 @@ package google import ( "fmt" + "strconv" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/schema" @@ -60,6 +61,11 @@ func resourceComputeSslCertificate() *schema.Resource { ForceNew: true, }, + "certificate_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "project": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -134,6 +140,7 @@ func resourceComputeSslCertificateRead(d *schema.ResourceData, meta interface{}) } d.Set("self_link", cert.SelfLink) + d.Set("certificate_id", strconv.FormatUint(cert.Id, 10)) return nil } diff --git a/google/resource_compute_target_http_proxy.go b/google/resource_compute_target_http_proxy.go index 80b88f54..21a9a0a8 100644 --- a/google/resource_compute_target_http_proxy.go +++ b/google/resource_compute_target_http_proxy.go @@ -3,6 +3,7 @@ package google import ( "fmt" "log" + "strconv" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/compute/v1" @@ -33,6 +34,11 @@ func resourceComputeTargetHttpProxy() *schema.Resource { ForceNew: true, }, + "proxy_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "project": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -128,6 +134,7 @@ func resourceComputeTargetHttpProxyRead(d *schema.ResourceData, meta interface{} } d.Set("self_link", proxy.SelfLink) + d.Set("proxy_id", strconv.FormatUint(proxy.Id, 10)) return nil } diff --git a/google/resource_compute_target_https_proxy.go b/google/resource_compute_target_https_proxy.go index 8a6c0ac5..1c86def4 100644 --- a/google/resource_compute_target_https_proxy.go +++ b/google/resource_compute_target_https_proxy.go @@ -3,10 +3,12 @@ package google import ( "fmt" "log" + "strconv" + + "regexp" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/compute/v1" - "regexp" ) const ( @@ -54,6 +56,11 @@ func resourceComputeTargetHttpsProxy() *schema.Resource { Computed: true, }, + "proxy_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "project": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -171,6 +178,7 @@ func resourceComputeTargetHttpsProxyRead(d *schema.ResourceData, meta interface{ } d.Set("ssl_certificates", proxy.SslCertificates) + d.Set("proxy_id", strconv.FormatUint(proxy.Id, 10)) d.Set("self_link", proxy.SelfLink) return nil diff --git a/google/resource_compute_url_map.go b/google/resource_compute_url_map.go index b9c7ecb4..22933c07 100644 --- a/google/resource_compute_url_map.go +++ b/google/resource_compute_url_map.go @@ -2,6 +2,7 @@ package google import ( "fmt" + "strconv" "github.com/hashicorp/terraform/helper/schema" "google.golang.org/api/compute/v1" @@ -62,6 +63,11 @@ func resourceComputeUrlMap() *schema.Resource { }, }, + "map_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "path_matcher": &schema.Schema{ Type: schema.TypeList, Optional: true, @@ -309,6 +315,7 @@ func resourceComputeUrlMapRead(d *schema.ResourceData, meta interface{}) error { d.SetId(name) d.Set("self_link", urlMap.SelfLink) + d.Set("map_id", strconv.FormatUint(urlMap.Id, 10)) d.Set("fingerprint", urlMap.Fingerprint) hostRuleMap := make(map[string]*compute.HostRule) diff --git a/website/docs/r/compute_ssl_certificate.html.markdown b/website/docs/r/compute_ssl_certificate.html.markdown index 1a97ac44..f3018789 100644 --- a/website/docs/r/compute_ssl_certificate.html.markdown +++ b/website/docs/r/compute_ssl_certificate.html.markdown @@ -84,9 +84,9 @@ The following arguments are supported: In addition to the arguments listed above, the following computed attributes are exported: -* `id` - A unique ID for the certificated, assigned by GCE. +* `certificate_id` - A unique ID for the certificate, assigned by GCE. * `self_link` - The URI of the created resource. [1]: /docs/providers/google/r/compute_target_https_proxy.html -[2]: /docs/configuration/resources.html#lifecycle \ No newline at end of file +[2]: /docs/configuration/resources.html#lifecycle diff --git a/website/docs/r/compute_target_http_proxy.html.markdown b/website/docs/r/compute_target_http_proxy.html.markdown index 63e0bf6f..ca6cd04f 100644 --- a/website/docs/r/compute_target_http_proxy.html.markdown +++ b/website/docs/r/compute_target_http_proxy.html.markdown @@ -86,6 +86,6 @@ The following arguments are supported: In addition to the arguments listed above, the following computed attributes are exported: -* `id` - A unique ID assigned by GCE. +* `proxy_id` - A unique ID assigned by GCE. * `self_link` - The URI of the created resource. diff --git a/website/docs/r/compute_target_https_proxy.html.markdown b/website/docs/r/compute_target_https_proxy.html.markdown index 1a71273e..3d6dd5f9 100644 --- a/website/docs/r/compute_target_https_proxy.html.markdown +++ b/website/docs/r/compute_target_https_proxy.html.markdown @@ -96,6 +96,6 @@ The following arguments are supported: In addition to the arguments listed above, the following computed attributes are exported: -* `id` - A unique ID assigned by GCE. +* `proxy_id` - A unique ID assigned by GCE. * `self_link` - The URI of the created resource. diff --git a/website/docs/r/compute_url_map.html.markdown b/website/docs/r/compute_url_map.html.markdown index a56888fc..5f91def1 100644 --- a/website/docs/r/compute_url_map.html.markdown +++ b/website/docs/r/compute_url_map.html.markdown @@ -157,6 +157,6 @@ exported: * `fingerprint` - The unique fingerprint for this resource. -* `id` - The GCE assigned ID of the resource. +* `map_id` - The GCE assigned ID of the resource. * `self_link` - The URI of the created resource.