-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tls_mutual_authentication): update activation after mtls creation (…
…#829) * fix(tls_mutual_authentication): update activation after mtls creation * build: bump go-fastly to v9.2.1 * doc(tls_mutual_authentication): clarify include attribute * docs(tls_mutual_authentication): add example * test: fastly_tls_mutual_authentication * fix(tls_mutual_authentication): allow null for mTLS ID * doc(tls_mutual_authentication): make activation_id optional * build: bump go-fastly to v9.2.2 * fix(tls_mutual_authentication): support multiple TLS Activations * fix(tls_mutual_authentication): unset mTLS on old TLS Activations * doc(tls_mutual_authentication): remove redundant annotations * doc(tls_mutual_authentication): replace lets-encrypt with certainly * fix(mutual_authentication): avoid accidental plan change by using runtime value for subscription certificate_id
- Loading branch information
1 parent
0e020c2
commit 1ac8dc0
Showing
17 changed files
with
619 additions
and
45 deletions.
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
84 changes: 84 additions & 0 deletions
84
examples/resources/tls_mutual_authentication_basic_usage.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,84 @@ | ||
terraform { | ||
required_providers { | ||
dnsimple = { | ||
source = "dnsimple/dnsimple" | ||
version = "1.5.0" | ||
} | ||
fastly = { | ||
source = "fastly/fastly" | ||
version = "5.7.2" | ||
} | ||
} | ||
} | ||
|
||
variable "dnsimple_token" { | ||
type = string | ||
} | ||
|
||
variable "dnsimple_account" { | ||
type = string | ||
} | ||
|
||
provider "dnsimple" { | ||
account = var.dnsimple_account | ||
token = var.dnsimple_token | ||
} | ||
|
||
variable "zone" { | ||
type = string | ||
default = "example.com" | ||
} | ||
|
||
resource "fastly_service_vcl" "example" { | ||
name = "example" | ||
domain { | ||
name = "www.${var.zone}" | ||
} | ||
backend { | ||
address = "httpbin.org" | ||
name = "httpbin" | ||
} | ||
force_destroy = true | ||
} | ||
|
||
resource "fastly_tls_subscription" "www" { | ||
domains = [for domain in fastly_service_vcl.example.domain : domain.name if domain.name == "www.${var.zone}"] | ||
certificate_authority = "certainly" | ||
} | ||
|
||
resource "dnsimple_zone_record" "www_acme_challenge" { | ||
name = "_acme-challenge.www" | ||
ttl = "60" | ||
type = "CNAME" | ||
value = one([for obj in fastly_tls_subscription.www.managed_dns_challenges : obj.record_value if obj.record_name == "_acme-challenge.www.${var.zone}"]) | ||
zone_name = var.zone | ||
} | ||
|
||
resource "fastly_tls_subscription_validation" "www" { | ||
subscription_id = fastly_tls_subscription.www.id | ||
depends_on = [dnsimple_zone_record.www_acme_challenge] | ||
} | ||
|
||
data "fastly_tls_configuration" "default" { | ||
default = true | ||
depends_on = [fastly_tls_subscription_validation.www] | ||
} | ||
|
||
resource "dnsimple_zone_record" "www" { | ||
name = "www" | ||
ttl = "60" | ||
type = "CNAME" | ||
value = one([for record in data.fastly_tls_configuration.default.dns_records : record.record_value if record.record_type == "CNAME"]) | ||
zone_name = var.zone | ||
} | ||
|
||
data "fastly_tls_activation" "www" { | ||
domain = "www.example.com" | ||
depends_on = [dnsimple_zone_record.www] | ||
} | ||
|
||
resource "fastly_tls_mutual_authentication" "www" { | ||
activation_ids = [data.fastly_tls_activation.www.id] | ||
cert_bundle = "-----BEGIN CERTIFICATE-----\n<REDACTED>\n-----END CERTIFICATE-----" | ||
enforced = true | ||
} |
Oops, something went wrong.