diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance.go.tmpl b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance.go.tmpl index 9b614a71e19e..0416b6c8b492 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_instance.go.tmpl @@ -3,9 +3,9 @@ package compute import ( "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-google/google/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func DataSourceGoogleComputeInstance() *schema.Resource { @@ -23,7 +23,7 @@ func DataSourceGoogleComputeInstance() *schema.Resource { func dataSourceGoogleComputeInstanceRead(d *schema.ResourceData, meta interface{}) error { config := meta.(*transport_tpg.Config) - userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) if err != nil { return err } @@ -202,6 +202,9 @@ func dataSourceGoogleComputeInstanceRead(d *schema.ResourceData, meta interface{ if err := d.Set("name", instance.Name); err != nil { return fmt.Errorf("Error setting name: %s", err) } + if err := d.Set("creation_timestamp", instance.CreationTimestamp); err != nil { + return fmt.Errorf("Error setting creation_timestamp: %s", err) + } d.SetId(fmt.Sprintf("projects/%s/zones/%s/instances/%s", project, tpgresource.GetResourceNameFromSelfLink(instance.Zone), instance.Name)) return nil } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl index 299363f66c60..da13c94e47d4 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl @@ -1177,6 +1177,12 @@ be from 0 to 999,999,999 inclusive.`, Description: `The server-assigned unique identifier of this instance.`, }, + "creation_timestamp": { + Type: schema.TypeString, + Computed: true, + Description: `Creation timestamp in RFC3339 text format.`, + }, + "label_fingerprint": { Type: schema.TypeString, Computed: true, @@ -1803,6 +1809,9 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error if err := d.Set("instance_id", fmt.Sprintf("%d", instance.Id)); err != nil { return fmt.Errorf("Error setting instance_id: %s", err) } + if err := d.Set("creation_timestamp", instance.CreationTimestamp); err != nil { + return fmt.Errorf("Error setting creation_timestamp: %s", err) + } if err := d.Set("project", project); err != nil { return fmt.Errorf("Error setting project: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl index e16551759592..7d4604aa52e9 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl @@ -831,6 +831,13 @@ be from 0 to 999,999,999 inclusive.`, Description: `A special URI of the created resource that uniquely identifies this instance template.`, }, + "creation_timestamp": { + Type: schema.TypeString, + ForceNew: true, + Computed: true, + Description: `Creation timestamp in RFC3339 text format.`, + }, + "service_account": { Type: schema.TypeList, MaxItems: 1, @@ -1819,6 +1826,9 @@ func resourceComputeInstanceTemplateRead(d *schema.ResourceData, meta interface{ if err = d.Set("self_link_unique", fmt.Sprintf("%v?uniqueId=%v", instanceTemplate.SelfLink, instanceTemplate.Id)); err != nil { return fmt.Errorf("Error setting self_link_unique: %s", err) } + if err = d.Set("creation_timestamp", instanceTemplate.CreationTimestamp); err != nil { + return fmt.Errorf("Error setting creation_timestamp: %s", err) + } if err = d.Set("name", instanceTemplate.Name); err != nil { return fmt.Errorf("Error setting name: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl index df076213b9e0..bc6cb079cf58 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl @@ -52,6 +52,7 @@ func TestAccComputeInstanceTemplate_basic(t *testing.T) { testAccCheckComputeInstanceTemplateMetadata(&instanceTemplate, "foo", "bar"), testAccCheckComputeInstanceTemplateContainsLabel(&instanceTemplate, "my_label", "foobar"), testAccCheckComputeInstanceTemplateLacksShieldedVmConfig(&instanceTemplate), + resource.TestCheckResourceAttrSet("google_compute_instance_template.foobar", "creation_timestamp"), ), }, { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl index 7832b3f5206d..5f6fdfb06472 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl @@ -192,6 +192,7 @@ func TestAccComputeInstance_basic1(t *testing.T) { testAccCheckComputeInstanceMetadata(&instance, "baz", "qux"), testAccCheckComputeInstanceDisk(&instance, instanceName, true, true), resource.TestCheckResourceAttr("google_compute_instance.foobar", "current_status", "RUNNING"), + resource.TestCheckResourceAttrSet("google_compute_instance.foobar", "creation_timestamp"), // by default, DeletionProtection is implicitly false. This should be false on any // instance resource without an explicit deletion_protection = true declaration. diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl index 0dbcead3a2d7..1637a8353789 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl @@ -783,6 +783,13 @@ be from 0 to 999,999,999 inclusive.`, Description: `The URI of the created resource.`, }, + "creation_timestamp": { + Type: schema.TypeString, + Computed: true, + ForceNew: true, + Description: `The time at which the instance was created in RFC 3339 format.`, + }, + "service_account": { Type: schema.TypeList, MaxItems: 1, @@ -1306,6 +1313,9 @@ func resourceComputeRegionInstanceTemplateRead(d *schema.ResourceData, meta inte if err = d.Set("self_link", instanceTemplate["selfLink"]); err != nil { return fmt.Errorf("Error setting self_link: %s", err) } + if err := d.Set("creation_timestamp", instanceTemplate["creationTimestamp"]); err != nil { + return fmt.Errorf("Error setting creation_timestamp: %s", err) + } if err = d.Set("name", instanceTemplate["name"]); err != nil { return fmt.Errorf("Error setting name: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl index b6c7e832b2ae..81711c98831a 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl @@ -47,6 +47,7 @@ func TestAccComputeRegionInstanceTemplate_basic(t *testing.T) { testAccCheckComputeRegionInstanceTemplateMetadata(&instanceTemplate, "foo", "bar"), testAccCheckComputeRegionInstanceTemplateContainsLabel(&instanceTemplate, "my_label", "foobar"), testAccCheckComputeRegionInstanceTemplateLacksShieldedVmConfig(&instanceTemplate), + resource.TestCheckResourceAttrSet("google_compute_region_instance_template.foobar", "creation_timestamp"), ), }, { diff --git a/mmv1/third_party/terraform/website/docs/d/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_instance.html.markdown index b6c32b263ff2..51e910b79fd5 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_instance.html.markdown @@ -73,6 +73,8 @@ The following arguments are supported: * `instance_id` - The server-assigned unique identifier of this instance. +* `creation_timestamp` - Creation timestamp in RFC3339 text format. + * `metadata_fingerprint` - The unique fingerprint of the metadata. * `self_link` - The URI of the created resource. diff --git a/mmv1/third_party/terraform/website/docs/d/compute_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_instance_template.html.markdown index 08be6b15f0f8..c2fec4317626 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_instance_template.html.markdown @@ -318,6 +318,8 @@ The `disk_encryption_key` block supports: * `id` - an identifier for the resource with format `projects/{{project}}/global/instanceTemplates/{{name}}` +* `creation_timestamp` - Creation timestamp in RFC3339 text format. + * `metadata_fingerprint` - The unique fingerprint of the metadata. * `self_link` - The URI of the created resource. diff --git a/mmv1/third_party/terraform/website/docs/d/compute_region_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_region_instance_template.html.markdown index e6f4f548ea6a..88b464f3ab1e 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_region_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_region_instance_template.html.markdown @@ -302,6 +302,8 @@ The `disk_encryption_key` block supports: * `id` - an identifier for the resource with format `projects/{{project}}/regions/{{region}}/instanceTemplates/{{name}}` +* `creation_timestamp` - Creation timestamp in RFC3339 text format. + * `metadata_fingerprint` - The unique fingerprint of the metadata. * `self_link` - The URI of the created resource. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown index b18f1594ce09..28588ad77402 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown @@ -590,6 +590,8 @@ exported: * `id` - an identifier for the resource with format `projects/{{project}}/zones/{{zone}}/instances/{{name}}` +* `creation_timestamp` - Creation timestamp in RFC3339 text format. + * `instance_id` - The server-assigned unique identifier of this instance. * `metadata_fingerprint` - The unique fingerprint of the metadata. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown index afe75854b4e5..31497237c037 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown @@ -733,6 +733,8 @@ exported: * `id` - an identifier for the resource with format `projects/{{project}}/global/instanceTemplates/{{name}}` +* `creation_timestamp` - Creation timestamp in RFC3339 text format. + * `metadata_fingerprint` - The unique fingerprint of the metadata. * `self_link` - The URI of the created resource. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown index facff74df4b6..be8dcbfbe0bf 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown @@ -693,6 +693,8 @@ exported: * `id` - an identifier for the resource with format `projects/{{project}}/regions/{{region}}/instanceTemplates/{{name}}` +* `creation_timestamp` - Creation timestamp in RFC3339 text format. + * `metadata_fingerprint` - The unique fingerprint of the metadata. * `self_link` - The URI of the created resource.