-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support complex configuration in consul_certificate_authority #341
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,40 @@ | ||
--- | ||
layout: "consul" | ||
page_title: "Consul: consul_certificate_authority" | ||
sidebar_current: "docs-consul-resource-certificate-authority" | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "consul_certificate_authority Resource - terraform-provider-consul" | ||
subcategory: "" | ||
description: |- | ||
A resource that manage the Consul Connect Certificate Authority | ||
The consul_certificate_authority resource can be used to manage the configuration of the Certificate Authority used by Consul Connect https://www.consul.io/docs/connect/ca. | ||
-> Note: The keys in the config argument must be using Camel case. | ||
--- | ||
|
||
# certificate_authority | ||
# consul_certificate_authority (Resource) | ||
|
||
The `consul_certificate_authority` resource can be used to manage the configuration of | ||
the Certificate Authority used by [Consul Connect](https://www.consul.io/docs/connect/ca). | ||
The `consul_certificate_authority` resource can be used to manage the configuration of the Certificate Authority used by [Consul Connect](https://www.consul.io/docs/connect/ca). | ||
|
||
-> **Note:** The keys in the `config` argument must be using Camel case. | ||
|
||
## Example Usage | ||
|
||
### Using the built-in CA with specific TTL | ||
|
||
```hcl | ||
resource "consul_certificate_authority" "connect" { | ||
connect_provider = "consul" | ||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
config = { | ||
LeafCertTTL = "24h" | ||
RotationPeriod = "2160h" | ||
IntermediateCertTTL = "8760h" | ||
} | ||
} | ||
``` | ||
|
||
### Using Vault to manage and sign certificates | ||
|
||
```hcl | ||
resource "consul_certificate_authority" "connect" { | ||
connect_provider = "vault" | ||
|
||
config = { | ||
Address = "http://localhost:8200" | ||
Token = "..." | ||
RootPKIPath = "connect-root" | ||
IntermediatePKIPath = "connect-intermediate" | ||
} | ||
} | ||
``` | ||
|
||
### Using the [AWS Certificate Manager Private Certificate Authority](https://aws.amazon.com/certificate-manager/private-certificate-authority/) | ||
### Required | ||
|
||
```hcl | ||
resource "consul_certificate_authority" "connect" { | ||
connect_provider = "aws-pca" | ||
- `connect_provider` (String) Specifies the CA provider type to use. | ||
|
||
config = { | ||
ExistingARN = "arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-123456789012" | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
### Optional | ||
|
||
* `connect_provider` - (Required, string) Specifies the CA provider type to use. | ||
* `config` - (Required, map) The raw configuration to use for the chosen provider. | ||
- `config` (Map of String, Deprecated) The raw configuration to use for the chosen provider. For more information on configuring the Connect CA providers, see [Provider Config](https://developer.hashicorp.com/consul/docs/connect/ca). | ||
- `config_json` (String) The raw configuration to use for the chosen provider. For more information on configuring the Connect CA providers, see [Provider Config](https://developer.hashicorp.com/consul/docs/connect/ca). | ||
|
||
### Read-Only | ||
|
||
## Attributes Reference | ||
|
||
The following attributes are exported: | ||
|
||
* `connect_provider` - Specifies the CA provider type to use. | ||
* `config` - The raw configuration to use for the chosen provider. | ||
- `id` (String) The ID of this resource. | ||
|
||
## Import | ||
|
||
`certificate_authority` can be imported: | ||
Import is supported using the following syntax: | ||
|
||
``` | ||
$ terraform import certificate_authority.connect connect-ca | ||
```shell | ||
terraform import certificate_authority.connect connect-ca | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
terraform import certificate_authority.connect connect-ca |
34 changes: 34 additions & 0 deletions
34
examples/resources/consul_certificate_authority/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Using the built-in CA with specific TTL | ||
resource "consul_certificate_authority" "connect" { | ||
connect_provider = "consul" | ||
|
||
config_json = jsondecode({ | ||
LeafCertTTL = "24h" | ||
RotationPeriod = "2160h" | ||
IntermediateCertTTL = "8760h" | ||
}) | ||
} | ||
|
||
|
||
# Using Vault to manage and sign certificates | ||
resource "consul_certificate_authority" "connect" { | ||
connect_provider = "vault" | ||
|
||
config_json = jsonencode({ | ||
Address = "http://localhost:8200" | ||
Token = "..." | ||
RootPKIPath = "connect-root" | ||
IntermediatePKIPath = "connect-intermediate" | ||
}) | ||
} | ||
|
||
|
||
# Using the AWS Certificate Manager Private Certificate Authority | ||
# * https://aws.amazon.com/certificate-manager/private-certificate-authority/ | ||
resource "consul_certificate_authority" "connect" { | ||
connect_provider = "aws-pca" | ||
|
||
config_json = jsonencode({ | ||
ExistingARN = "arn:aws:acm-pca:region:account:certificate-authority/12345678-1234-1234-123456789012" | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should mention that this is expected to be a json configuration in the description?