Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions delivery/main.tf

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Jaime that this should be eligible and not mandated. But would it make more sense to add this to the DOM module? And through the deploy script, validate whether the domains are validated or not, and then call the dom module to perform the late validation?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pareddyakamai this is related to removing the post validation flow for now.

Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ resource "akamai_property" "this" {
lifecycle {
ignore_changes = [version_notes]
}

}
# akamai_property_domainownership_late_validation resource is used to verify the validation state of your hostnames and activate your property on a network.
resource "akamai_property_domainownership_late_validation" "this" {

contract_id = var.contract_id
group_id = var.group_id
property_id = akamai_property.this.id
version = akamai_property.this.latest_version
validation_method = "DNS_CNAME"

timeouts {
create = "5m"
}
}

resource "akamai_property_activation" "staging" {
Expand All @@ -87,6 +101,7 @@ resource "akamai_property_activation" "staging" {
note = var.activation_notes
contact = var.notification_emails
auto_acknowledge_rule_warnings = true
depends_on = [akamai_property_domainownership_late_validation.this]

lifecycle {
ignore_changes = [note]
Expand All @@ -101,6 +116,7 @@ resource "akamai_property_activation" "production" {
note = var.activation_notes
contact = var.notification_emails
auto_acknowledge_rule_warnings = true
depends_on = [akamai_property_domainownership_late_validation.this]

lifecycle {
ignore_changes = [note]
Expand Down
66 changes: 66 additions & 0 deletions dom/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!-- BEGIN_TF_DOCS -->



# Usage
Basic usage of this module is as follows:

```hcl
module "example" {
source = "<module-location>"

# Required variables
domain_validation_entries = <list(object({
domain_name = string
validation_scope = string
validation_method = string
}))>
edgerc_path = <string>
edgerc_section = <string>
enable_validation = <bool>

# Optional variables
domain_search_entries = <list(object({
domain_name = string
validation_scope = string
}))> | default: []
}
```

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.9.0 |
| <a name="requirement_akamai"></a> [akamai](#requirement\_akamai) | >= 9.2.0 |

## Resources

| Name | Type |
|------|------|
| [akamai_property_domainownership_domains.domains](https://registry.terraform.io/providers/akamai/akamai/latest/docs/resources/property_domainownership_domains) | resource |
| [akamai_property_domainownership_validation.validation](https://registry.terraform.io/providers/akamai/akamai/latest/docs/resources/property_domainownership_validation) | resource |
| [akamai_property_domainownership_search_domains.search](https://registry.terraform.io/providers/akamai/akamai/latest/docs/data-sources/property_domainownership_search_domains) | data source |

## Modules

No modules.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_domain_validation_entries"></a> [domain\_validation\_entries](#input\_domain\_validation\_entries) | A list of objects with hostnames, domains, or wildcards to DOM validate | <pre>list(object({<br/> domain_name = string<br/> validation_scope = string<br/> validation_method = string<br/> }))</pre> | n/a | yes |
| <a name="input_edgerc_path"></a> [edgerc\_path](#input\_edgerc\_path) | Path to the .edgerc file | `string` | n/a | yes |
| <a name="input_edgerc_section"></a> [edgerc\_section](#input\_edgerc\_section) | Section in the .edgerc file | `string` | n/a | yes |
| <a name="input_enable_validation"></a> [enable\_validation](#input\_enable\_validation) | Set to true to enable domain validation | `bool` | n/a | yes |
| <a name="input_domain_search_entries"></a> [domain\_search\_entries](#input\_domain\_search\_entries) | List of domains to search validation status for | <pre>list(object({<br/> domain_name = string<br/> validation_scope = string<br/> }))</pre> | `[]` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_cname_validation_challenges"></a> [cname\_validation\_challenges](#output\_cname\_validation\_challenges) | Map of CNAME records for domain validation challenges (key: domain\_name) |
| <a name="output_domain_search_results"></a> [domain\_search\_results](#output\_domain\_search\_results) | n/a |
| <a name="output_txt_validation_challenges"></a> [txt\_validation\_challenges](#output\_txt\_validation\_challenges) | Map of TXT records for domain validation challenges (key: domain\_name) |
<!-- END_TF_DOCS -->
44 changes: 44 additions & 0 deletions dom/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this empty line for the terraform-docs to add the documentation in this main.tf to the README.

/**
* # Akamai Domain Ownership Management (DOM)
*
* This directory contains the resource for Domain entry creation and Validation
*
*/


resource "akamai_property_domainownership_domains" "domains" {
for_each = { for entry in var.domain_validation_entries : entry.domain_name => entry }
Comment thread
rlopezso marked this conversation as resolved.

domains = [
{
domain_name = each.value.domain_name
validation_scope = each.value.validation_scope
}
]
}

resource "akamai_property_domainownership_validation" "validation" {
for_each = var.enable_validation ? { for entry in var.domain_validation_entries : entry.domain_name => entry } : {}

domains = [
{
domain_name = each.value.domain_name
validation_scope = each.value.validation_scope
validation_method = each.value.validation_method
}
]
}

data "akamai_property_domainownership_search_domains" "search" {
# If the list is empty or null, count is 0 (resource is skipped)
# Otherwise, count is 1 (resource is executed)
count = length(var.domain_search_entries) > 0 ? 1 : 0

domains = [
for entry in var.domain_search_entries : {
domain_name = entry.domain_name
validation_scope = upper(entry.validation_scope)
}
]
}
22 changes: 22 additions & 0 deletions dom/outputs.tf
Comment thread
rlopezso marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
output "txt_validation_challenges" {
description = "Map of TXT records for domain validation challenges (key: domain_name)"
value = {
for domain_resource in akamai_property_domainownership_domains.domains :
element(flatten([for domain in domain_resource.domains : domain.domain_name]), 0) =>
element(flatten([for domain in domain_resource.domains : domain.validation_challenge.txt_record]), 0)
}
}

output "cname_validation_challenges" {
description = "Map of CNAME records for domain validation challenges (key: domain_name)"
value = {
for domain_resource in akamai_property_domainownership_domains.domains :
element(flatten([for domain in domain_resource.domains : domain.domain_name]), 0) =>
element(flatten([for domain in domain_resource.domains : domain.validation_challenge.cname_record]), 0)
}
}

output "domain_search_results" {
# 'domains' is the actual attribute name for this Akamai data source
value = one(data.akamai_property_domainownership_search_domains.search[*].domains)
}
34 changes: 34 additions & 0 deletions dom/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
variable "domain_validation_entries" {
description = "A list of objects with hostnames, domains, or wildcards to DOM validate"
type = list(object({
domain_name = string
validation_scope = string
validation_method = string
}))
}

variable "enable_validation" {
description = "Set to true to enable domain validation"
type = bool
}

#tflint-ignore: terraform_unused_declarations
variable "edgerc_path" {
description = "Path to the .edgerc file"
type = string
}

#tflint-ignore: terraform_unused_declarations
variable "edgerc_section" {
description = "Section in the .edgerc file"
type = string
}

variable "domain_search_entries" {
description = "List of domains to search validation status for"
type = list(object({
domain_name = string
validation_scope = string
}))
default = []
}
9 changes: 9 additions & 0 deletions dom/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_providers {
akamai = {
source = "akamai/akamai"
version = ">= 9.2.0"
}
}
required_version = ">= 1.9.0"
}
Loading