Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update compute_ssl_certificate.html.markdown #1731

Merged
merged 2 commits into from
Jul 11, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions website/docs/r/compute_ssl_certificate.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,29 @@ resource "google_compute_ssl_certificate" "default" {
description = "a description"
private_key = "${file("path/to/private.key")}"
certificate = "${file("path/to/certificate.crt")}"

lifecycle {
create_before_destroy = true
}
}

# You may also want to control name generation explicitly:

resource "random_id" "certificate" {
byte_length = 4
prefix = "my-certificate-"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would actually not work as intended, I believe--I think we need to use keepers for this to generate a new random ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paddycarver thx for catching it, fixed! (or at least I hope i did :) )

}

resource "google_compute_ssl_certificate" "default" {
# The name will contain 8 random hex digits,
# e.g. "my-certificate-48ab27cd2a"
name = "${random_id.certificate.hex}"
private_key = "${file("path/to/private.key")}"
certificate = "${file("path/to/certificate.crt")}"

lifecycle {
create_before_destroy = true
}
}
```

Expand All @@ -32,8 +55,8 @@ specified configuration, Terraform will destroy the existing resource
and create a replacement. To effectively use an SSL certificate resource
with a [Target HTTPS Proxy resource][1], it's recommended to specify
`create_before_destroy` in a [lifecycle][2] block. Either omit the
Instance Template `name` attribute, or specify a partial name with
`name_prefix`. Example:
Instance Template `name` attribute, specify a partial name with
`name_prefix`, or use [random_id][3] resource. Example:

```hcl
resource "google_compute_ssl_certificate" "default" {
Expand Down Expand Up @@ -90,6 +113,7 @@ exported:

[1]: /docs/providers/google/r/compute_target_https_proxy.html
[2]: /docs/configuration/resources.html#lifecycle
[3]: /docs/providers/random/r/id.html

## Import

Expand Down