mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-14 13:01:34 -04:00
2.8 KiB
2.8 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| aws | AWS: aws_iam_server_certificate | docs-aws-resource-iam-server-certificate | Provides an IAM Server Certificate |
aws_iam_server_certificate
Provides 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 Certficates in AWS Documentation.
Example Usage
Using certs on file:
resource "aws_iam_server_certificate" "test_cert" {
name = "some_test_cert"
certificate_body = "${file("self-ca-cert.pem")}"
private_key = "${file("test-key.pem")}"
}
Example with cert in-line:
resource "aws_iam_server_certificate" "test_cert_alt" {
name = "alt_test_cert"
certificate_body = <<EOF
-----BEGIN CERTIFICATE-----
[......] # cert contents
-----END CERTIFICATE-----
EOF
private_key = <<EOF
-----BEGIN RSA PRIVATE KEY-----
[......] # cert contents
-----END CERTIFICATE-----
EOF
}
Use in combination with an AWS ELB resource:
resource "aws_iam_server_certificate" "test_cert" {
name = "some_test_cert"
certificate_body = "${file("self-ca-cert.pem")}"
private_key = "${file("test-key.pem")}"
}
resource "aws_elb" "ourapp" {
name = "terraform-asg-deployment-example"
availability_zones = ["us-west-2a"]
cross_zone_load_balancing = true
listener {
instance_port = 8000
instance_protocol = "http"
lb_port = 443
lb_protocol = "https"
ssl_certificate_id = "${aws_iam_server_certificate.test_cert.arn}"
}
}
Argument Reference
The following arguments are supported:
name- (Required) The name of the Server Certificate. Do not include the path in this value.certificate_body– (Required) The contents of the public key certificate in PEM-encoded format.certificate_chain– (Optional) The contents of the certificate chain. This is typically a concatenation of the PEM-encoded public key certificates of the chain.private_key– (Required) The contents of the private key in PEM-encoded format.path- (Optional) 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 for more details on IAM Paths.
Attributes Reference
id- The unique Server Certificate namename- The name of the Server Certificatearn- The Amazon Resource Name (ARN) specifying the server certificate.