Skip to content
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

Add account_id to allow module to function #24

Merged
merged 5 commits into from
May 19, 2023
Merged
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
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ module "zone" {
source = "cloudposse/zone/cloudflare"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
zone = "cloudposse.co"
records = [

account_id = "example-account-id"
zone = "cloudposse.co"
records = [
{
name = "bastion"
value = "192.168.1.11"
Expand Down Expand Up @@ -195,6 +197,7 @@ Available targets:

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | Cloudflare account ID to manage the zone resource in | `string` | n/a | yes |
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br>This is for some rare cases where resources want additional configuration of tags<br>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
| <a name="input_argo_enabled"></a> [argo\_enabled](#input\_argo\_enabled) | Whether to enable Cloudflare Argo for DNS zone | `bool` | `false` | no |
| <a name="input_argo_smart_routing_enabled"></a> [argo\_smart\_routing\_enabled](#input\_argo\_smart\_routing\_enabled) | Whether smart routing is enabled. | `bool` | `true` | no |
Expand All @@ -205,8 +208,8 @@ Available targets:
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| <a name="input_firewall_rules"></a> [firewall\_rules](#input\_firewall\_rules) | paused:<br> Whether this filter is currently paused.<br>expression:<br> The filter expression to be used.<br>description:<br> A note that you can use to describe the purpose of the filter and rule.<br>ref:<br> Short reference tag to quickly select related rules.<br>action:<br> The action to apply to a matched request. <br> Possible values: `block`, `challenge`, `allow`, `js_challenge`, `bypass`.<br>priority:<br> The priority of the rule to allow control of processing order. <br> A lower number indicates high priority.<br> If not provided, any rules with a priority will be sequenced before those without.<br>products:<br> List of products to bypass for a request when the bypass action is used. <br> Possible values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`. | `list(any)` | `null` | no |
| <a name="input_healthchecks"></a> [healthchecks](#input\_healthchecks) | A list of maps of Health Checks rules. <br>The values of map is fully compliant with `cloudflare_healthcheck` resource.<br>To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/healthcheck | `list(any)` | `null` | no |
| <a name="input_firewall_rules"></a> [firewall\_rules](#input\_firewall\_rules) | paused:<br> Whether this filter is currently paused.<br>expression:<br> The filter expression to be used.<br>description:<br> A note that you can use to describe the purpose of the filter and rule.<br>ref:<br> Short reference tag to quickly select related rules.<br>action:<br> The action to apply to a matched request.<br> Possible values: `block`, `challenge`, `allow`, `js_challenge`, `bypass`.<br>priority:<br> The priority of the rule to allow control of processing order.<br> A lower number indicates high priority.<br> If not provided, any rules with a priority will be sequenced before those without.<br>products:<br> List of products to bypass for a request when the bypass action is used.<br> Possible values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`. | `list(any)` | `null` | no |
| <a name="input_healthchecks"></a> [healthchecks](#input\_healthchecks) | A list of maps of Health Checks rules.<br>The values of map is fully compliant with `cloudflare_healthcheck` resource.<br>To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/healthcheck | `list(any)` | `null` | no |
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
| <a name="input_jump_start"></a> [jump\_start](#input\_jump\_start) | Whether to scan for DNS records on creation. | `bool` | `false` | no |
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
Expand All @@ -215,10 +218,10 @@ Available targets:
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
| <a name="input_page_rules"></a> [page\_rules](#input\_page\_rules) | A list of maps of Page Rules. <br>The values of map is fully compliant with `cloudflare_page_rule` resource.<br>To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/cloudflare_page_rule | `list(any)` | `null` | no |
| <a name="input_page_rules"></a> [page\_rules](#input\_page\_rules) | A list of maps of Page Rules.<br>The values of map is fully compliant with `cloudflare_page_rule` resource.<br>To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/cloudflare_page_rule | `list(any)` | `null` | no |
| <a name="input_paused"></a> [paused](#input\_paused) | Whether this zone is paused (traffic bypasses Cloudflare) | `bool` | `false` | no |
| <a name="input_plan"></a> [plan](#input\_plan) | The name of the commercial plan to apply to the zone. Possible values: `free`, `pro`, `business`, `enterprise` | `string` | `"free"` | no |
| <a name="input_records"></a> [records](#input\_records) | name:<br> The name of the record.<br>type:<br> The type of the record.<br>value:<br> The value of the record.<br>ttl:<br> The TTL of the record.<br> Default value: 1.<br>priority:<br> The priority of the record. <br>proxied:<br> Whether the record gets Cloudflare's origin protection. <br> Default value: false. | `list(any)` | `[]` | no |
| <a name="input_records"></a> [records](#input\_records) | name:<br> The name of the record.<br>type:<br> The type of the record.<br>value:<br> The value of the record.<br>ttl:<br> The TTL of the record.<br> Default value: 1.<br>priority:<br> The priority of the record.<br>proxied:<br> Whether the record gets Cloudflare's origin protection.<br> Default value: false. | `list(any)` | `[]` | no |
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
Expand Down
6 changes: 4 additions & 2 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ usage: |-
source = "cloudposse/zone/cloudflare"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
zone = "cloudposse.co"
records = [

account_id = "example-account-id"
JohnShortland marked this conversation as resolved.
Show resolved Hide resolved
zone = "cloudposse.co"
records = [
{
name = "bastion"
value = "192.168.1.11"
Expand Down
9 changes: 5 additions & 4 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_account_id"></a> [account\_id](#input\_account\_id) | Cloudflare account ID to manage the zone resource in | `string` | n/a | yes |
| <a name="input_additional_tag_map"></a> [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.<br>This is for some rare cases where resources want additional configuration of tags<br>and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no |
| <a name="input_argo_enabled"></a> [argo\_enabled](#input\_argo\_enabled) | Whether to enable Cloudflare Argo for DNS zone | `bool` | `false` | no |
| <a name="input_argo_smart_routing_enabled"></a> [argo\_smart\_routing\_enabled](#input\_argo\_smart\_routing\_enabled) | Whether smart routing is enabled. | `bool` | `true` | no |
Expand All @@ -48,8 +49,8 @@
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| <a name="input_firewall_rules"></a> [firewall\_rules](#input\_firewall\_rules) | paused:<br> Whether this filter is currently paused.<br>expression:<br> The filter expression to be used.<br>description:<br> A note that you can use to describe the purpose of the filter and rule.<br>ref:<br> Short reference tag to quickly select related rules.<br>action:<br> The action to apply to a matched request. <br> Possible values: `block`, `challenge`, `allow`, `js_challenge`, `bypass`.<br>priority:<br> The priority of the rule to allow control of processing order. <br> A lower number indicates high priority.<br> If not provided, any rules with a priority will be sequenced before those without.<br>products:<br> List of products to bypass for a request when the bypass action is used. <br> Possible values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`. | `list(any)` | `null` | no |
| <a name="input_healthchecks"></a> [healthchecks](#input\_healthchecks) | A list of maps of Health Checks rules. <br>The values of map is fully compliant with `cloudflare_healthcheck` resource.<br>To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/healthcheck | `list(any)` | `null` | no |
| <a name="input_firewall_rules"></a> [firewall\_rules](#input\_firewall\_rules) | paused:<br> Whether this filter is currently paused.<br>expression:<br> The filter expression to be used.<br>description:<br> A note that you can use to describe the purpose of the filter and rule.<br>ref:<br> Short reference tag to quickly select related rules.<br>action:<br> The action to apply to a matched request.<br> Possible values: `block`, `challenge`, `allow`, `js_challenge`, `bypass`.<br>priority:<br> The priority of the rule to allow control of processing order.<br> A lower number indicates high priority.<br> If not provided, any rules with a priority will be sequenced before those without.<br>products:<br> List of products to bypass for a request when the bypass action is used.<br> Possible values: `zoneLockdown`, `uaBlock`, `bic`, `hot`, `securityLevel`, `rateLimit`, `waf`. | `list(any)` | `null` | no |
| <a name="input_healthchecks"></a> [healthchecks](#input\_healthchecks) | A list of maps of Health Checks rules.<br>The values of map is fully compliant with `cloudflare_healthcheck` resource.<br>To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/healthcheck | `list(any)` | `null` | no |
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
| <a name="input_jump_start"></a> [jump\_start](#input\_jump\_start) | Whether to scan for DNS records on creation. | `bool` | `false` | no |
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
Expand All @@ -58,10 +59,10 @@
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
| <a name="input_page_rules"></a> [page\_rules](#input\_page\_rules) | A list of maps of Page Rules. <br>The values of map is fully compliant with `cloudflare_page_rule` resource.<br>To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/cloudflare_page_rule | `list(any)` | `null` | no |
| <a name="input_page_rules"></a> [page\_rules](#input\_page\_rules) | A list of maps of Page Rules.<br>The values of map is fully compliant with `cloudflare_page_rule` resource.<br>To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/cloudflare_page_rule | `list(any)` | `null` | no |
| <a name="input_paused"></a> [paused](#input\_paused) | Whether this zone is paused (traffic bypasses Cloudflare) | `bool` | `false` | no |
| <a name="input_plan"></a> [plan](#input\_plan) | The name of the commercial plan to apply to the zone. Possible values: `free`, `pro`, `business`, `enterprise` | `string` | `"free"` | no |
| <a name="input_records"></a> [records](#input\_records) | name:<br> The name of the record.<br>type:<br> The type of the record.<br>value:<br> The value of the record.<br>ttl:<br> The TTL of the record.<br> Default value: 1.<br>priority:<br> The priority of the record. <br>proxied:<br> Whether the record gets Cloudflare's origin protection. <br> Default value: false. | `list(any)` | `[]` | no |
| <a name="input_records"></a> [records](#input\_records) | name:<br> The name of the record.<br>type:<br> The type of the record.<br>value:<br> The value of the record.<br>ttl:<br> The TTL of the record.<br> Default value: 1.<br>priority:<br> The priority of the record.<br>proxied:<br> Whether the record gets Cloudflare's origin protection.<br> Default value: false. | `list(any)` | `[]` | no |
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| <a name="input_stage"></a> [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
Expand Down
2 changes: 2 additions & 0 deletions examples/complete/fixtures.us-east-2.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ stage = "test"
name = "cf-zone"

zone = "test-automation.app"

account_id = "example-account-id"
1 change: 1 addition & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module "zone" {
source = "../.."

account_id = var.account_id
zone = var.zone
zone_enabled = false
argo_enabled = false
Expand Down
5 changes: 5 additions & 0 deletions examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ variable "zone" {
type = string
description = "The DNS zone name which will be added."
}

variable "account_id" {
type = string
description = "Cloudflare account ID to manage the zone resource in"
}
Loading