Skip to content

Commit

Permalink
feat: added tls provider and veriables description
Browse files Browse the repository at this point in the history
  • Loading branch information
mamrajyadav committed Sep 7, 2023
1 parent 77ce433 commit 95ddf21
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
workflow_dispatch:
jobs:
alb:
example:
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
with:
working_directory: './_example/'
working_directory: './_example/'
15 changes: 15 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ resource "aws_acm_certificate" "ca" {
count = var.enabled ? 1 : 0
private_key = join("", tls_private_key.ca[*].private_key_pem)
certificate_body = join("", tls_self_signed_cert.ca[*].cert_pem)

lifecycle {
create_before_destroy = true
}
}

resource "tls_private_key" "root" {
Expand Down Expand Up @@ -95,6 +99,10 @@ resource "aws_acm_certificate" "root" {
private_key = join("", tls_private_key.server[*].private_key_pem)
certificate_body = join("", tls_locally_signed_cert.root[*].cert_pem)
certificate_chain = join("", tls_self_signed_cert.ca[*].cert_pem)

lifecycle {
create_before_destroy = true
}
}

resource "tls_private_key" "server" {
Expand All @@ -120,6 +128,13 @@ resource "tls_cert_request" "server" {
##-----------------------------------------------------------------------------
## Generates a Certificate Signing Request (CSR) in PEM format, which is the typical format used to request a certificate from a certificate authority.
##-----------------------------------------------------------------------------
#The TLS provider provides utilities for working with Transport Layer Security keys and certificates. It provides resources that allow private keys, certificates and certificate requests to be created as part of a Terraform deployment.
provider "tls" {
proxy {
from_env = true
}
}

resource "tls_locally_signed_cert" "server" {

Check warning on line 138 in main.tf

View workflow job for this annotation

GitHub Actions / tf-lint / tflint

Missing version constraint for provider "tls" in "required_providers"
count = var.enabled ? 1 : 0

Expand Down
8 changes: 4 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -156,25 +156,25 @@ variable "self_service_portal" {
variable "rsa_bits" {
type = number
default = 2048
description = ""
description = "When algorithm is RSA, the size of the generated RSA key, in bits (default: 2048)."
}

variable "algorithm" {
type = string
default = "RSA"
description = ""
description = "Name of the algorithm to use when generating the private key. Currently-supported values are: RSA, ECDSA, ED25519."
}

variable "validity_period_hours" {
type = number
default = 87600
description = ""
description = "Number of hours, after initial issuing, that the certificate will remain valid for."
}

variable "is_ca_certificate" {
type = bool
default = true
description = ""
description = "Is the generated certificate representing a Certificate Authority (CA)."
}

variable "authorize_all_groups" {
Expand Down

0 comments on commit 95ddf21

Please sign in to comment.