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

Bugfix/acm param defaults #536

Merged
merged 11 commits into from Jun 4, 2020
10 changes: 5 additions & 5 deletions modules/acm/README.md
Expand Up @@ -45,18 +45,18 @@ By default, this module will attempt to download the ACM operator from Google di
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| cluster\_endpoint | Kubernetes cluster endpoint. | string | n/a | yes |
| cluster\_name | The unique name to identify the cluster in ACM. | string | n/a | yes |
| cluster\_name | Name used to reach cluster by way of a google_container_cluster terraform resource. This value becomes the cluster name in the Config Sync kubernetes custom resource. | string | n/a | yes |
| create\_ssh\_key | Controls whether a key will be generated for Git authentication | bool | `"true"` | no |
| enable\_policy\_controller | Whether to enable the ACM Policy Controller on the cluster | bool | `"true"` | no |
| install\_template\_library | Whether to install the default Policy Controller template library | bool | `"true"` | no |
| location | The location (zone or region) this cluster has been created in. | string | n/a | yes |
| location | location used to reach cluster by way of a google_container_cluster terraform resource. | string | n/a | yes |
| operator\_path | Path to the operator yaml config. If unset, will download from GCS releases. | string | `"null"` | no |
| policy\_dir | Subfolder containing configs in ACM Git repo | string | n/a | yes |
| project\_id | The project in which the resource belongs. | string | n/a | yes |
| policy\_dir | Subfolder containing configs in ACM Git repo. If un-set, uses Config Management default. | string | `""` | no |
| project\_id | project_id used to reach cluster by way of a google_container_cluster terraform resource. | string | n/a | yes |
| secret\_type | git authentication secret type, is passed through to ConfigManagement spec.git.secretType. Overriden to value 'ssh' if `create_ssh_key` is true | string | `"ssh"` | no |
| skip\_gcloud\_download | Whether to skip downloading gcloud (assumes gcloud and kubectl already available outside the module) | bool | `"false"` | no |
| ssh\_auth\_key | Key for Git authentication. Overrides 'create_ssh_key' variable. Can be set using 'file(path/to/file)'-function. | string | `"null"` | no |
| sync\_branch | ACM repo Git branch | string | `"master"` | no |
| sync\_branch | ACM repo Git branch. If un-set, uses Config Management default. | string | `""` | no |
| sync\_repo | ACM Git repo address | string | n/a | yes |

## Outputs
Expand Down
10 changes: 5 additions & 5 deletions modules/acm/templates/acm-config.yml.tpl
Expand Up @@ -5,11 +5,11 @@ metadata:
spec:
# clusterName is required and must be unique among all managed clusters
clusterName: ${cluster_name}
git:
syncRepo: ${sync_repo}
syncBranch: ${sync_branch}
secretType: ${secret_type}
policyDir: ${policy_dir}
policyController:
enabled: ${enable_policy_controller}
templateLibraryInstalled: ${install_template_library}
git:
syncRepo: ${sync_repo}
secretType: ${secret_type}
${policy_dir_node}
${sync_branch_node}
13 changes: 7 additions & 6 deletions modules/acm/variables.tf
Expand Up @@ -15,17 +15,17 @@
*/

variable "cluster_name" {
description = "The unique name to identify the cluster in ACM."
description = "Name used to reach cluster by way of a google_container_cluster terraform resource. This value becomes the cluster name in the Config Sync kubernetes custom resource."
linde marked this conversation as resolved.
Show resolved Hide resolved
type = string
}

variable "project_id" {
description = "The project in which the resource belongs."
description = "project_id used to reach cluster by way of a google_container_cluster terraform resource."
linde marked this conversation as resolved.
Show resolved Hide resolved
type = string
}

variable "location" {
description = "The location (zone or region) this cluster has been created in."
description = "location used to reach cluster by way of a google_container_cluster terraform resource."
linde marked this conversation as resolved.
Show resolved Hide resolved
type = string
}

Expand All @@ -41,14 +41,15 @@ variable "sync_repo" {
}

variable "sync_branch" {
description = "ACM repo Git branch"
description = "ACM repo Git branch. If un-set, uses Config Management default."
type = string
default = "master"
default = ""
}

variable "policy_dir" {
description = "Subfolder containing configs in ACM Git repo"
description = "Subfolder containing configs in ACM Git repo. If un-set, uses Config Management default."
type = string
default = ""
}

variable "cluster_endpoint" {
Expand Down
10 changes: 5 additions & 5 deletions modules/config-sync/README.md
Expand Up @@ -48,16 +48,16 @@ To deploy this config:
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| cluster\_endpoint | Kubernetes cluster endpoint. | string | n/a | yes |
| cluster\_name | The unique name to identify the cluster in ACM. | string | n/a | yes |
| cluster\_name | Name used to reach cluster by way of a google_container_cluster terraform resource. This value becomes the cluster name in the Config Sync kubernetes custom resource. | string | n/a | yes |
| create\_ssh\_key | Controls whether a key will be generated for Git authentication | bool | `"true"` | no |
| location | The location (zone or region) this cluster has been created in. | string | n/a | yes |
| location | location used to reach cluster by way of a google_container_cluster terraform resource. | string | n/a | yes |
| operator\_path | Path to the operator yaml config. If unset, will download from GCS releases. | string | `"null"` | no |
| policy\_dir | Subfolder containing configs in ACM Git repo | string | n/a | yes |
| project\_id | The project in which the resource belongs. | string | n/a | yes |
| policy\_dir | Subfolder containing configs in ACM Git repo. If un-set, uses Config Management default. | string | `""` | no |
| project\_id | project_id used to reach cluster by way of a google_container_cluster terraform resource. | string | n/a | yes |
| secret\_type | credential secret type, passed through to ConfigManagement spec.git.secretType. Overriden to value 'ssh' if `create_ssh_key` is true | string | n/a | yes |
| skip\_gcloud\_download | Whether to skip downloading gcloud (assumes gcloud and kubectl already available outside the module) | bool | `"false"` | no |
| ssh\_auth\_key | Key for Git authentication. Overrides 'create_ssh_key' variable. Can be set using 'file(path/to/file)'-function. | string | `"null"` | no |
| sync\_branch | ACM repo Git branch | string | `"master"` | no |
| sync\_branch | ACM repo Git branch. If un-set, uses Config Management default. | string | `""` | no |
| sync\_repo | ACM Git repo address | string | n/a | yes |

## Outputs
Expand Down
4 changes: 2 additions & 2 deletions modules/config-sync/templates/config-sync-config.yml.tpl
Expand Up @@ -7,6 +7,6 @@ spec:
clusterName: ${cluster_name}
git:
syncRepo: ${sync_repo}
syncBranch: ${sync_branch}
secretType: ${secret_type}
policyDir: ${policy_dir}
${sync_branch_node}
${policy_dir_node}
13 changes: 7 additions & 6 deletions modules/config-sync/variables.tf
Expand Up @@ -15,17 +15,17 @@
*/

variable "cluster_name" {
description = "The unique name to identify the cluster in ACM."
description = "Name used to reach cluster by way of a google_container_cluster terraform resource. This value becomes the cluster name in the Config Sync kubernetes custom resource."
type = string
}

variable "project_id" {
description = "The project in which the resource belongs."
description = "project_id used to reach cluster by way of a google_container_cluster terraform resource."
type = string
}

variable "location" {
description = "The location (zone or region) this cluster has been created in."
description = "location used to reach cluster by way of a google_container_cluster terraform resource."
type = string
}

Expand All @@ -41,14 +41,15 @@ variable "sync_repo" {
}

variable "sync_branch" {
description = "ACM repo Git branch"
description = "ACM repo Git branch. If un-set, uses Config Management default."
type = string
default = "master"
default = ""
}

variable "policy_dir" {
description = "Subfolder containing configs in ACM Git repo"
description = "Subfolder containing configs in ACM Git repo. If un-set, uses Config Management default."
type = string
default = ""
}

variable "cluster_endpoint" {
Expand Down
6 changes: 4 additions & 2 deletions modules/k8s-operator-crd-support/main.tf
Expand Up @@ -22,6 +22,8 @@ locals {
k8sop_creds_secret_key = var.secret_type == "cookiefile" ? "cookie_file" : var.secret_type
should_download_manifest = var.operator_path == null ? true : false
manifest_path = local.should_download_manifest ? "${path.root}/.terraform/tmp/config-management-operator.yaml" : var.operator_path
sync_branch_node = var.sync_branch != "" ? format("syncBranch: %s", var.sync_branch) : ""
policy_dir_node = var.policy_dir != "" ? format("policyDir: %s", var.policy_dir) : ""
}


Expand Down Expand Up @@ -87,8 +89,8 @@ data "template_file" "k8sop_config" {
vars = {
cluster_name = var.cluster_name
sync_repo = var.sync_repo
sync_branch = var.sync_branch
policy_dir = var.policy_dir
sync_branch_node = local.sync_branch_node
policy_dir_node = local.policy_dir_node
secret_type = var.create_ssh_key ? "ssh" : var.secret_type
enable_policy_controller = var.enable_policy_controller ? "true" : "false"
install_template_library = var.install_template_library ? "true" : "false"
Expand Down
13 changes: 7 additions & 6 deletions modules/k8s-operator-crd-support/variables.tf
Expand Up @@ -15,17 +15,17 @@
*/

variable "cluster_name" {
description = "The unique name to identify the cluster in ACM."
description = "Name used to reach cluster by way of a google_container_cluster terraform resource. This value becomes the cluster name in the Config Sync kubernetes custom resource."
type = string
}

variable "project_id" {
description = "The project in which the resource belongs."
description = "project_id used to reach cluster by way of a google_container_cluster terraform resource."
type = string
}

variable "location" {
description = "The location (zone or region) this cluster has been created in."
description = "location used to reach cluster by way of a google_container_cluster terraform resource."
type = string
}

Expand All @@ -51,14 +51,15 @@ variable "secret_type" {
}

variable "sync_branch" {
description = "ACM repo Git branch"
description = "ACM repo Git branch. If un-set, uses Config Management default."
type = string
default = "master"
default = ""
}

variable "policy_dir" {
description = "Subfolder containing configs in ACM Git repo"
description = "Subfolder containing configs in ACM Git repo. If un-set, uses Config Management default."
type = string
default = ""
}

variable "cluster_endpoint" {
Expand Down