Skip to content

Commit

Permalink
Add expire_time output field to multiple ssl certificate resources (#…
Browse files Browse the repository at this point in the history
…7007) (#13392)

* Add `expire_time` output field to global `google_compute_ssl_certificate` resource

* Add `expire_time` output field to regional `google_compute_region_ssl_certificate` resource

* Add `expire_time` output field to global `google_compute_managed_ssl_certificate` resource

* Remove duplicate `expire_time` field from `google_compute_managed_ssl_certificate`, update description in original entry

Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Jan 5, 2023
1 parent 373ad89 commit 9e336b1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changelog/7007.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:enhancement
compute: added field `expire_time` to resource `google_compute_ssl_certificate`
```
```release-note:enhancement
compute: added field `expire_time` to resource `google_compute_region_ssl_certificate`
```
2 changes: 1 addition & 1 deletion google/resource_compute_managed_ssl_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ which type this is. Default value: "MANAGED" Possible values: ["MANAGED"]`,
"expire_time": {
Type: schema.TypeString,
Computed: true,
Description: `Expire time of the certificate.`,
Description: `Expire time of the certificate in RFC3339 text format.`,
},
"subject_alternative_names": {
Type: schema.TypeList,
Expand Down
12 changes: 12 additions & 0 deletions google/resource_compute_region_ssl_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ If it is not provided, the provider region is used.`,
Computed: true,
Description: `Creation timestamp in RFC3339 text format.`,
},
"expire_time": {
Type: schema.TypeString,
Computed: true,
Description: `Expire time of the certificate in RFC3339 text format.`,
},
"name_prefix": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -260,6 +265,9 @@ func resourceComputeRegionSslCertificateRead(d *schema.ResourceData, meta interf
if err := d.Set("description", flattenComputeRegionSslCertificateDescription(res["description"], d, config)); err != nil {
return fmt.Errorf("Error reading RegionSslCertificate: %s", err)
}
if err := d.Set("expire_time", flattenComputeRegionSslCertificateExpireTime(res["expireTime"], d, config)); err != nil {
return fmt.Errorf("Error reading RegionSslCertificate: %s", err)
}
if err := d.Set("certificate_id", flattenComputeRegionSslCertificateCertificateId(res["id"], d, config)); err != nil {
return fmt.Errorf("Error reading RegionSslCertificate: %s", err)
}
Expand Down Expand Up @@ -354,6 +362,10 @@ func flattenComputeRegionSslCertificateDescription(v interface{}, d *schema.Reso
return v
}

func flattenComputeRegionSslCertificateExpireTime(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenComputeRegionSslCertificateCertificateId(v interface{}, d *schema.ResourceData, config *Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
Expand Down
12 changes: 12 additions & 0 deletions google/resource_compute_ssl_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ These are in the same namespace as the managed SSL certificates.`,
Computed: true,
Description: `Creation timestamp in RFC3339 text format.`,
},
"expire_time": {
Type: schema.TypeString,
Computed: true,
Description: `Expire time of the certificate in RFC3339 text format.`,
},
"name_prefix": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -245,6 +250,9 @@ func resourceComputeSslCertificateRead(d *schema.ResourceData, meta interface{})
if err := d.Set("description", flattenComputeSslCertificateDescription(res["description"], d, config)); err != nil {
return fmt.Errorf("Error reading SslCertificate: %s", err)
}
if err := d.Set("expire_time", flattenComputeSslCertificateExpireTime(res["expireTime"], d, config)); err != nil {
return fmt.Errorf("Error reading SslCertificate: %s", err)
}
if err := d.Set("certificate_id", flattenComputeSslCertificateCertificateId(res["id"], d, config)); err != nil {
return fmt.Errorf("Error reading SslCertificate: %s", err)
}
Expand Down Expand Up @@ -335,6 +343,10 @@ func flattenComputeSslCertificateDescription(v interface{}, d *schema.ResourceDa
return v
}

func flattenComputeSslCertificateExpireTime(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenComputeSslCertificateCertificateId(v interface{}, d *schema.ResourceData, config *Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ In addition to the arguments listed above, the following computed attributes are
Domains associated with the certificate via Subject Alternative Name.

* `expire_time` -
Expire time of the certificate.
Expire time of the certificate in RFC3339 text format.
* `self_link` - The URI of the created resource.


Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/compute_region_ssl_certificate.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ In addition to the arguments listed above, the following computed attributes are
* `creation_timestamp` -
Creation timestamp in RFC3339 text format.

* `expire_time` -
Expire time of the certificate in RFC3339 text format.

* `certificate_id` -
The unique identifier for the resource.
* `self_link` - The URI of the created resource.
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/compute_ssl_certificate.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ In addition to the arguments listed above, the following computed attributes are
* `creation_timestamp` -
Creation timestamp in RFC3339 text format.

* `expire_time` -
Expire time of the certificate in RFC3339 text format.

* `certificate_id` -
The unique identifier for the resource.
* `self_link` - The URI of the created resource.
Expand Down

0 comments on commit 9e336b1

Please sign in to comment.