Package com.pulumi.gcp.compute
Class SSLCertificate
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.gcp.compute.SSLCertificate
-
public class SSLCertificate extends com.pulumi.resources.CustomResource
An SslCertificate resource, used for HTTPS load balancing. This resource provides a mechanism to upload an SSL key and certificate to the load balancer to serve secure connections from the user. To get more information about SslCertificate, see: * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/sslCertificates) * How-to Guides * [Official Documentation](https://cloud.google.com/load-balancing/docs/ssl-certificates) ## Example Usage ### Ssl Certificate Basic ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.SSLCertificate; import com.pulumi.gcp.compute.SSLCertificateArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var default_ = new SSLCertificate("default", SSLCertificateArgs.builder() .namePrefix("my-certificate-") .description("a description") .privateKey(Files.readString(Paths.get("path/to/private.key"))) .certificate(Files.readString(Paths.get("path/to/certificate.crt"))) .build()); } } ``` ### Ssl Certificate Random Provider ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.SSLCertificate; import com.pulumi.gcp.compute.SSLCertificateArgs; import com.pulumi.random.RandomId; import com.pulumi.random.RandomIdArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var default_ = new SSLCertificate("default", SSLCertificateArgs.builder() .privateKey(Files.readString(Paths.get("path/to/private.key"))) .certificate(Files.readString(Paths.get("path/to/certificate.crt"))) .build()); var certificate = new RandomId("certificate", RandomIdArgs.builder() .byteLength(4) .prefix("my-certificate-") .keepers(Map.ofEntries( Map.entry("private_key", computeFileBase64Sha256("path/to/private.key")), Map.entry("certificate", computeFileBase64Sha256("path/to/certificate.crt")) )) .build()); } } ``` ### Ssl Certificate Target Https Proxies ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.SSLCertificate; import com.pulumi.gcp.compute.SSLCertificateArgs; import com.pulumi.gcp.compute.HttpHealthCheck; import com.pulumi.gcp.compute.HttpHealthCheckArgs; import com.pulumi.gcp.compute.BackendService; import com.pulumi.gcp.compute.BackendServiceArgs; import com.pulumi.gcp.compute.URLMap; import com.pulumi.gcp.compute.URLMapArgs; import com.pulumi.gcp.compute.inputs.URLMapHostRuleArgs; import com.pulumi.gcp.compute.inputs.URLMapPathMatcherArgs; import com.pulumi.gcp.compute.TargetHttpsProxy; import com.pulumi.gcp.compute.TargetHttpsProxyArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var defaultSSLCertificate = new SSLCertificate("defaultSSLCertificate", SSLCertificateArgs.builder() .namePrefix("my-certificate-") .privateKey(Files.readString(Paths.get("path/to/private.key"))) .certificate(Files.readString(Paths.get("path/to/certificate.crt"))) .build()); var defaultHttpHealthCheck = new HttpHealthCheck("defaultHttpHealthCheck", HttpHealthCheckArgs.builder() .requestPath("/") .checkIntervalSec(1) .timeoutSec(1) .build()); var defaultBackendService = new BackendService("defaultBackendService", BackendServiceArgs.builder() .portName("http") .protocol("HTTP") .timeoutSec(10) .healthChecks(defaultHttpHealthCheck.id()) .build()); var defaultURLMap = new URLMap("defaultURLMap", URLMapArgs.builder() .description("a description") .defaultService(defaultBackendService.id()) .hostRules(URLMapHostRuleArgs.builder() .hosts("mysite.com") .pathMatcher("allpaths") .build()) .pathMatchers(URLMapPathMatcherArgs.builder() .name("allpaths") .defaultService(defaultBackendService.id()) .pathRules(URLMapPathMatcherPathRuleArgs.builder() .paths("/*") .service(defaultBackendService.id()) .build()) .build()) .build()); var defaultTargetHttpsProxy = new TargetHttpsProxy("defaultTargetHttpsProxy", TargetHttpsProxyArgs.builder() .urlMap(defaultURLMap.id()) .sslCertificates(defaultSSLCertificate.id()) .build()); } } ``` ## Import SslCertificate can be imported using any of these accepted formats* `projects/{{project}}/global/sslCertificates/{{name}}` * `{{project}}/{{name}}` * `{{name}}` In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import SslCertificate using one of the formats above. For exampletf import { id = "projects/{{project}}/global/sslCertificates/{{name}}" to = google_compute_ssl_certificate.default } ```sh $ pulumi import gcp:compute/sSLCertificate:SSLCertificate When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), SslCertificate can be imported using one of the formats above. For example ``` ```sh $ pulumi import gcp:compute/sSLCertificate:SSLCertificate default projects/{{project}}/global/sslCertificates/{{name}} ``` ```sh $ pulumi import gcp:compute/sSLCertificate:SSLCertificate default {{project}}/{{name}} ``` ```sh $ pulumi import gcp:compute/sSLCertificate:SSLCertificate default {{name}} ```
-
-
Constructor Summary
Constructors Constructor Description SSLCertificate(java.lang.String name)
SSLCertificate(java.lang.String name, SSLCertificateArgs args)
SSLCertificate(java.lang.String name, SSLCertificateArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>
certificate()
com.pulumi.core.Output<java.lang.Integer>
certificateId()
com.pulumi.core.Output<java.lang.String>
creationTimestamp()
com.pulumi.core.Output<java.util.Optional<java.lang.String>>
description()
com.pulumi.core.Output<java.lang.String>
expireTime()
static SSLCertificate
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, SSLCertificateState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>
name()
com.pulumi.core.Output<java.lang.String>
namePrefix()
com.pulumi.core.Output<java.lang.String>
privateKey()
com.pulumi.core.Output<java.lang.String>
project()
com.pulumi.core.Output<java.lang.String>
selfLink()
-
-
-
Constructor Detail
-
SSLCertificate
public SSLCertificate(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
SSLCertificate
public SSLCertificate(java.lang.String name, SSLCertificateArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
SSLCertificate
public SSLCertificate(java.lang.String name, SSLCertificateArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
certificate
public com.pulumi.core.Output<java.lang.String> certificate()
- Returns:
- The certificate in PEM format. The certificate chain must be no greater than 5 certs long. The chain must include at least one intermediate cert. **Note**: This property is sensitive and will not be displayed in the plan.
-
certificateId
public com.pulumi.core.Output<java.lang.Integer> certificateId()
- Returns:
- The unique identifier for the resource.
-
creationTimestamp
public com.pulumi.core.Output<java.lang.String> creationTimestamp()
- Returns:
- Creation timestamp in RFC3339 text format.
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- An optional description of this resource.
-
expireTime
public com.pulumi.core.Output<java.lang.String> expireTime()
- Returns:
- Expire time of the certificate in RFC3339 text format.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `a-z?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. These are in the same namespace as the managed SSL certificates.
-
namePrefix
public com.pulumi.core.Output<java.lang.String> namePrefix()
- Returns:
- Creates a unique name beginning with the specified prefix. Conflicts with `name`.
-
privateKey
public com.pulumi.core.Output<java.lang.String> privateKey()
- Returns:
- The write-only private key in PEM format. **Note**: This property is sensitive and will not be displayed in the plan. ***
-
project
public com.pulumi.core.Output<java.lang.String> project()
- Returns:
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
-
selfLink
public com.pulumi.core.Output<java.lang.String> selfLink()
- Returns:
- The URI of the created resource.
-
get
public static SSLCertificate get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable SSLCertificateState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-