-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from terraform-google-modules/master
update
- Loading branch information
Showing
43 changed files
with
713 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,7 @@ suites: | |
backend: local | ||
controls: | ||
- gcloud | ||
- acm | ||
- name: gcp | ||
backend: gcp | ||
controls: | ||
|
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
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
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,16 +1,22 @@ | ||
# Simple Zonal Cluster | ||
|
||
This example illustrates how to create a simple cluster. | ||
This example illustrates how to create a simple cluster and install [Anthos Config Management](https://cloud.google.com/anthos-config-management/docs/). | ||
|
||
It incorporates the standard cluster module and the [ACM install module](../../modules/acm). | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|:----:|:-----:|:-----:| | ||
| acm\_policy\_dir | Subfolder containing configs in ACM Git repo | string | `"foo-corp"` | no | | ||
| acm\_sync\_branch | Anthos config management Git branch | string | `"1.0.0"` | no | | ||
| acm\_sync\_repo | Anthos config management Git repo | string | `"[email protected]:GoogleCloudPlatform/csp-config-management.git"` | no | | ||
| cluster\_name\_suffix | A suffix to append to the default cluster name | string | `""` | no | | ||
| ip\_range\_pods | The secondary ip range to use for pods | string | n/a | yes | | ||
| ip\_range\_services | The secondary ip range to use for pods | string | n/a | yes | | ||
| network | The VPC network to host the cluster in | string | n/a | yes | | ||
| operator\_path | Path to the operator yaml config. If unset, will download from GCS releases. | string | `"null"` | no | | ||
| project\_id | The project ID to host the cluster in | string | n/a | yes | | ||
| region | The region to host the cluster in | string | n/a | yes | | ||
| subnetwork | The subnetwork to host the cluster in | string | n/a | yes | | ||
|
@@ -20,6 +26,7 @@ This example illustrates how to create a simple cluster. | |
|
||
| Name | Description | | ||
|------|-------------| | ||
| acm\_git\_creds\_public | Public key of SSH keypair to allow the Anthos Operator to authenticate to your Git repository. | | ||
| ca\_certificate | | | ||
| client\_token | | | ||
| cluster\_name | Cluster name | | ||
|
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,27 @@ | ||
/** | ||
* Copyright 2018 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module "acm" { | ||
source = "../../modules/acm" | ||
project_id = var.project_id | ||
location = module.gke.location | ||
cluster_name = module.gke.name | ||
sync_repo = var.acm_sync_repo | ||
sync_branch = var.acm_sync_branch | ||
policy_dir = var.acm_policy_dir | ||
cluster_endpoint = module.gke.endpoint | ||
operator_path = var.operator_path | ||
} |
File renamed without changes.
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
File renamed without changes.
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 |
---|---|---|
|
@@ -48,3 +48,26 @@ variable "ip_range_services" { | |
description = "The secondary ip range to use for pods" | ||
} | ||
|
||
variable "acm_sync_repo" { | ||
description = "Anthos config management Git repo" | ||
type = string | ||
default = "[email protected]:GoogleCloudPlatform/csp-config-management.git" | ||
} | ||
|
||
variable "acm_sync_branch" { | ||
description = "Anthos config management Git branch" | ||
type = string | ||
default = "1.0.0" | ||
} | ||
|
||
variable "acm_policy_dir" { | ||
description = "Subfolder containing configs in ACM Git repo" | ||
type = string | ||
default = "foo-corp" | ||
} | ||
|
||
variable "operator_path" { | ||
description = "Path to the operator yaml config. If unset, will download from GCS releases." | ||
type = string | ||
default = null | ||
} |
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,3 @@ | ||
# This fill will be always downloaded by terraform local-exec command from gc bucket | ||
config-management-operator.yaml | ||
/terraform.tfvars |
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,65 @@ | ||
# Terraform Kubernetes Engine ACM Submodule | ||
|
||
This module installs [Anthos Config Management](https://cloud.google.com/anthos-config-management/docs/) (ACM) in a Kubernetes cluster. | ||
|
||
Specifically, this module automates the following steps for [installing ACM](https://cloud.google.com/anthos-config-management/docs/how-to/installing): | ||
1. Installing the ACM Operator on your cluster. | ||
2. Generating an SSH key for accessing Git and providing it to the Operator | ||
3. Configuring the Operator to connect to your ACM repository | ||
|
||
## Usage | ||
|
||
There is a [full example](../../examples/simple_zonal_with_acm) provided. Simple usage is as follows: | ||
|
||
```tf | ||
module "acm" { | ||
source = "terraform-google-modules/kubernetes-engine/google//modules/acm" | ||
project_id = "my-project-id" | ||
cluster_name = "my-cluster-name" | ||
location = module.gke.location | ||
cluster_endpoint = module.gke.endpoint | ||
sync_repo = "[email protected]:GoogleCloudPlatform/csp-config-management.git" | ||
sync_branch = "1.0.0" | ||
policy_dir = "foo-corp" | ||
} | ||
``` | ||
|
||
To deploy this config: | ||
1. Run `terraform apply` | ||
2. Inspect the `git_creds_public` [output](#outputs) to retrieve the public key used for accessing Git. Whitelist this key for access to your Git repo. Instructions for some popular Git hosting providers are included for convenience: | ||
|
||
* [Cloud Souce Repositories](https://cloud.google.com/source-repositories/docs/authentication#ssh) | ||
* [Bitbucket](https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html) | ||
* [GitHub](https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/) | ||
* [Gitlab](https://docs.gitlab.com/ee/ssh/) | ||
|
||
## Whitelisting | ||
Note that installing Anthos Config Management [requires](https://cloud.google.com/anthos-config-management/docs/how-to/installing#local_environment) an active Anthos license. | ||
By default, this module will attempt to download the ACM operator from Google directly—meaning your Terraform service account needs to be whitelisted for ACM access. If this is an issue, you can predownload the operator yourself then set the `operator_path` variable to point to the file location. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Inputs | ||
|
||
| 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 | | ||
| 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 | | ||
| 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 | | ||
| sync\_branch | ACM repo Git branch | string | `"master"` | no | | ||
| sync\_repo | ACM Git repo address | string | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| git\_creds\_public | Public key of SSH keypair to allow the Anthos Operator to authenticate to your Git repository. | | ||
|
||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
Oops, something went wrong.