Skip to content

JamesWoolfenden/terraform-aws-certificate-authority

Repository files navigation

terraform-aws-certificate-authority

Build Status Latest Release GitHub tag (latest SemVer) Terraform Version Infrastructure Tests pre-commit checkov Infrastructure Tests

Terraform module to provision infra. This is pretty much the example from the Terraform docs converted to a module.


It's 100% Open Source and licensed under the APACHE2.

Usage

Include this repository as a module in your existing Terraform code:

module "ca" {
  source    = "git::https://github.com/JamesWoolfenden/terraform-aws-certificate-authority.git?ref=ac7e4b8f846704fa5655bcc3d4bdb6640f070f42"
  algorithm = var.algorithm
  subject   = var.subject
}

Costs

 Monthly cost estimate

Project: .

 Name                                                                  Monthly Qty  Unit                Monthly Cost

 module.ca.aws_acmpca_certificate_authority.certificate_authority
 ├─ Private certificate authority                                                1  months                   $400.00
 └─ Certificates (first 1K)                                        Cost depends on usage: $0.75 per requests

 module.ca.aws_s3_bucket.crl
 └─ Standard
    ├─ Storage                                                     Cost depends on usage: $0.02 per GB-months
    ├─ PUT, COPY, POST, LIST requests                              Cost depends on usage: $0.0053 per 1k requests
    ├─ GET, SELECT, and all other requests                         Cost depends on usage: $0.00042 per 1k requests
    ├─ Select data scanned                                         Cost depends on usage: $0.00225 per GB-months
    └─ Select data returned                                        Cost depends on usage: $0.0008 per GB-months

 PROJECT TOTAL                                                                                               $400.00

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

No modules.

Resources

Name Type
aws_acmpca_certificate.certificate resource
aws_acmpca_certificate_authority.certificate_authority resource
aws_acmpca_certificate_authority_certificate.certificate_authority_certificate resource
aws_s3_bucket.crl resource
aws_s3_bucket_acl.crl resource
aws_s3_bucket_lifecycle_configuration.expire resource
aws_s3_bucket_ownership_controls.crl resource
aws_s3_bucket_policy.bucket resource
aws_s3_bucket_public_access_block.crl resource
aws_s3_bucket_versioning.crl resource
aws_caller_identity.current data source
aws_iam_policy_document.access data source
aws_partition.current data source
aws_region.current data source

Inputs

Name Description Type Default Required
algorithm n/a map(any) n/a yes
sse_algorithm The type of encryption algorithm to use string "aws:kms" no
subject n/a map(any) n/a yes
type n/a string "SUBORDINATE" no
usage_mode n/a string "GENERAL_PURPOSE" no

Outputs

Name Description
certificate_authority_arn Certificate authority arn
certificate_authority_id Certificate authority id
certificate_signing_request The CSR itself

Policy

This is the policy required to build this project:

The Terraform resource required is:

resource "aws_iam_policy" "terraform_pike" {
  name_prefix = "terraform_pike"
  path        = "/"
  description = "Pike Autogenerated policy from IAC"

  policy = jsonencode({
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "acm-pa:DescribeCertificateAuthority",
                "acm-pa:ListTags"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "acm-pca:CreateCertificateAuthority",
                "acm-pca:DeleteCertificateAuthority",
                "acm-pca:GetCertificateAuthorityCertificate",
                "acm-pca:UpdateCertificateAuthority"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "VisualEditor2",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeAccountAttributes"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "VisualEditor3",
            "Effect": "Allow",
            "Action": [
                "s3:CreateBucket",
                "s3:DeleteBucket",
                "s3:GetAccelerateConfiguration",
                "s3:GetBucketAcl",
                "s3:GetBucketCORS",
                "s3:GetBucketLogging",
                "s3:GetBucketObjectLockConfiguration",
                "s3:GetBucketPolicy",
                "s3:GetBucketPublicAccessBlock",
                "s3:GetBucketRequestPayment",
                "s3:GetBucketTagging",
                "s3:GetBucketVersioning",
                "s3:GetBucketWebsite",
                "s3:GetEncryptionConfiguration",
                "s3:GetIntelligentTieringConfiguration",
                "s3:GetLifecycleConfiguration",
                "s3:GetObject",
                "s3:GetObjectAcl",
                "s3:GetReplicationConfiguration",
                "s3:ListAllMyBuckets",
                "s3:ListBucket",
                "s3:PutBucketAcl",
                "s3:PutBucketLogging",
                "s3:PutBucketPolicy",
                "s3:PutBucketPublicAccessBlock",
                "s3:PutBucketVersioning",
                "s3:PutIntelligentTieringConfiguration",
                "s3:PutLifecycleConfiguration"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
})
}

Related Projects

Check out these related projects.

Help

Got a question?

File a GitHub issue.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Copyrights

Copyright © 2019-2023 James Woolfenden

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributors

James Woolfenden
James Woolfenden