Package com.pulumi.aws.iam
Class ServerCertificate
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.iam.ServerCertificate
-
public class ServerCertificate extends com.pulumi.resources.CustomResourceProvides an IAM Server Certificate resource to upload Server Certificates. Certs uploaded to IAM can easily work with other AWS services such as: - AWS Elastic Beanstalk - Elastic Load Balancing - CloudFront - AWS OpsWorks For information about server certificates in IAM, see [Managing Server Certificates](https://docs.aws.amazon.com/IAM/latest/UserGuide/ManagingServerCerts.html) in AWS Documentation. ## Example Usage **Using certs on file:**
**Example with cert in-line:**package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.iam.ServerCertificate; import com.pulumi.aws.iam.ServerCertificateArgs; import com.pulumi.std.StdFunctions; import com.pulumi.std.inputs.FileArgs; import java.util.ArrayList; import java.util.Arrays; 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 testCert = new ServerCertificate("testCert", ServerCertificateArgs.builder() .name("some_test_cert") .certificateBody(StdFunctions.file(FileArgs.builder() .input("self-ca-cert.pem") .build()).result()) .privateKey(StdFunctions.file(FileArgs.builder() .input("test-key.pem") .build()).result()) .build()); } }
**Use in combination with an AWS ELB resource:** Some properties of an IAM Server Certificates cannot be updated while they are in use. In order for the provider to effectively manage a Certificate in this situation, it is recommended you utilize the `namePrefix` attribute and enable the `createBeforeDestroy` lifecycle block. This will allow Pulumi to create a new, updated `aws.iam.ServerCertificate` resource and replace it in dependant resources before attempting to destroy the old version. ## Import Using `pulumi import`, import IAM Server Certificates using the `name`. For example: ```sh $ pulumi import aws:iam/serverCertificate:ServerCertificate certificate example.com-certificate-until-2018 ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.iam.ServerCertificate; import com.pulumi.aws.iam.ServerCertificateArgs; import java.util.ArrayList; import java.util.Arrays; 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 testCertAlt = new ServerCertificate("testCertAlt", ServerCertificateArgs.builder() .name("alt_test_cert") .certificateBody(""" -----BEGIN CERTIFICATE----- [......] # cert contents -----END CERTIFICATE----- """) .privateKey(""" -----BEGIN RSA PRIVATE KEY----- [......] # cert contents -----END RSA PRIVATE KEY----- """) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description ServerCertificate(java.lang.String name)ServerCertificate(java.lang.String name, ServerCertificateArgs args)ServerCertificate(java.lang.String name, ServerCertificateArgs 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>arn()com.pulumi.core.Output<java.lang.String>certificateBody()com.pulumi.core.Output<java.util.Optional<java.lang.String>>certificateChain()com.pulumi.core.Output<java.lang.String>expiration()static ServerCertificateget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ServerCertificateState 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.util.Optional<java.lang.String>>path()com.pulumi.core.Output<java.lang.String>privateKey()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()com.pulumi.core.Output<java.lang.String>uploadDate()
-
-
-
Constructor Detail
-
ServerCertificate
public ServerCertificate(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
ServerCertificate
public ServerCertificate(java.lang.String name, ServerCertificateArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
ServerCertificate
public ServerCertificate(java.lang.String name, ServerCertificateArgs 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
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- ARN specifying the server certificate.
-
certificateBody
public com.pulumi.core.Output<java.lang.String> certificateBody()
- Returns:
- The contents of the public key certificate in PEM-encoded format.
-
certificateChain
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> certificateChain()
- Returns:
- The contents of the certificate chain. This is typically a concatenation of the PEM-encoded public key certificates of the chain.
-
expiration
public com.pulumi.core.Output<java.lang.String> expiration()
- Returns:
- Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) on which the certificate is set to expire.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- The name of the Server Certificate. Do not include the path in this value. If omitted, the provider will assign a random, unique name.
-
namePrefix
public com.pulumi.core.Output<java.lang.String> namePrefix()
- Returns:
- Creates a unique name beginning with the specified prefix. Conflicts with `name`.
-
path
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> path()
- Returns:
- The IAM path for the server certificate. If it is not included, it defaults to a slash (/). If this certificate is for use with AWS CloudFront, the path must be in format `/cloudfront/your_path_here`. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more details on IAM Paths.
-
privateKey
public com.pulumi.core.Output<java.lang.String> privateKey()
- Returns:
- The contents of the private key in PEM-encoded format.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of resource tags for the server certificate. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. > **NOTE:** AWS performs behind-the-scenes modifications to some certificate files if they do not adhere to a specific format. These modifications will result in this provider forever believing that it needs to update the resources since the local and AWS file contents will not match after theses modifications occur. In order to prevent this from happening you must ensure that all your PEM-encoded files use UNIX line-breaks and that `certificateBody` contains only one certificate. All other certificates should go in `certificateChain`. It is common for some Certificate Authorities to issue certificate files that have DOS line-breaks and that are actually multiple certificates concatenated together in order to form a full certificate chain.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
uploadDate
public com.pulumi.core.Output<java.lang.String> uploadDate()
- Returns:
- Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) when the server certificate was uploaded.
-
get
public static ServerCertificate get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ServerCertificateState 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.
-
-