Skip to content

Commit

Permalink
fix: remove optional for backwards compatibility (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtsorbo authored Mar 30, 2023
1 parent 6e86527 commit 01348c9
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/app_cicd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ done

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| deploy\_branch\_clusters | mapping of branch names to cluster deployments | <pre>map(object({<br> cluster = string<br> project_id = string<br> location = string<br> required_attestations = list(string)<br> env_attestation = string<br> next_env = string<br> }))</pre> | `{}` | no |
| deploy\_branch\_clusters | mapping of branch names to cluster deployments. target\_type can be one of `gke`, `anthos_cluster`, or `run`. See [clouddeploy\_target Terraform docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_target) for more details | <pre>map(object({<br> cluster = string<br> anthos_membership = string<br> project_id = string<br> location = string<br> required_attestations = list(string)<br> env_attestation = string<br> next_env = string<br> target_type = string<br> }))</pre> | `{}` | no |
| primary\_location | Region used for key-ring | `string` | `"us-central1"` | no |
| project\_id | Project ID for CICD Pipeline Project | `string` | n/a | yes |

Expand Down
4 changes: 3 additions & 1 deletion examples/app_cicd/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ variable "primary_location" {
variable "deploy_branch_clusters" {
type = map(object({
cluster = string
anthos_membership = string
project_id = string
location = string
required_attestations = list(string)
env_attestation = string
next_env = string
target_type = string
}))
description = "mapping of branch names to cluster deployments"
description = "mapping of branch names to cluster deployments. target_type can be one of `gke`, `anthos_cluster`, or `run`. See [clouddeploy_target Terraform docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_target) for more details"
default = {}
}
2 changes: 1 addition & 1 deletion examples/private_cluster_cicd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ cp -R terraform-google-secure-cicd/examples/private_cluster_cicd/policies bank-o

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| deploy\_branch\_clusters | mapping of branch names to cluster deployments | <pre>map(object({<br> cluster = string<br> project_id = string<br> location = string<br> required_attestations = list(string)<br> env_attestation = string<br> next_env = string<br> }))</pre> | `{}` | no |
| deploy\_branch\_clusters | mapping of branch names to cluster deployments. target\_type can be one of `gke`, `anthos_cluster`, or `run`. See [clouddeploy\_target Terraform docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_target) for more details | <pre>map(object({<br> cluster = string<br> anthos_membership = string<br> project_id = string<br> location = string<br> required_attestations = list(string)<br> env_attestation = string<br> next_env = string<br> target_type = string<br> }))</pre> | `{}` | no |
| gke\_networks | list of GKE cluster networks in which to create VPN connections | <pre>list(object({<br> control_plane_cidrs = map(string)<br> location = string<br> network = string<br> project_id = string<br> }))</pre> | n/a | yes |
| project\_id | Project ID for CICD Pipeline Project | `string` | n/a | yes |

Expand Down
4 changes: 3 additions & 1 deletion examples/private_cluster_cicd/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ variable "gke_networks" {
variable "deploy_branch_clusters" {
type = map(object({
cluster = string
anthos_membership = string
project_id = string
location = string
required_attestations = list(string)
env_attestation = string
next_env = string
target_type = string
}))
description = "mapping of branch names to cluster deployments"
description = "mapping of branch names to cluster deployments. target_type can be one of `gke`, `anthos_cluster`, or `run`. See [clouddeploy_target Terraform docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_target) for more details"
default = {}
}
6 changes: 3 additions & 3 deletions examples/standalone_single_project/walkthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To get started, click **Start**.
export APP_SOURCE_REPO=$APP_NAME-source
export BLUEPRINT_FOLDER=$PWD
export WORKSPACE_FOLDER=~/workspace-$(date +%s)
mkdir $WORKSPACE_FOLDER
mkdir $WORKSPACE_FOLDER
```
Click **Next**.
Expand Down Expand Up @@ -141,8 +141,8 @@ Once the application has gone through a successful rollout to all target environ
1. Navigate to Kubernetes Engine, then Services & Ingress
<walkthrough-menu-navigation sectionId="KUBERNETES_SECTION;discovery"></walkthrough-menu-navigation>
1. Using the <walkthrough-spotlight-pointer locator="css([name='clusters'])">Clusters</walkthrough-spotlight-pointer> filter, select the checkbox for the cluster corresponding to your final environment, then press **OK**. By default, the final cluster is called "my-app-cluster-prod".
1. In the <walkthrough-spotlight-pointer locator="css([tabindex='0']).css([role='tab'])">Services</walkthrough-spotlight-pointer> tab, click the hyperlinked IP address next to the service called **frontend**. A new tab will open to the frontend service endpoint, launching the Bank of Anthos demo application.
1. In the <walkthrough-spotlight-pointer locator="css([tabindex='0']).css([role='tab'])">Services</walkthrough-spotlight-pointer> tab, click the hyperlinked IP address next to the service called **frontend**. A new tab will open to the frontend service endpoint, launching the Bank of Anthos demo application.
For more information on the Bank of Anthos demo application, go the [project page on GitHub](https://github.com/GoogleCloudPlatform/bank-of-anthos)
You have now successfully deployed the Bank of Anthos demo application using the Secure CI/CD pipeline solution.
You have now successfully deployed the Bank of Anthos demo application using the Secure CI/CD pipeline solution.
2 changes: 1 addition & 1 deletion modules/secure-cd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The template [`cloudbuild-cd.yaml`](../../build/cloudbuild-cd.yaml) build config
| cloudbuild\_private\_pool | Cloud Build private pool self-link | `string` | `""` | no |
| cloudbuild\_service\_account | Cloud Build SA email address | `string` | n/a | yes |
| clouddeploy\_pipeline\_name | Cloud Deploy pipeline name | `string` | n/a | yes |
| deploy\_branch\_clusters | mapping of branch names to cluster deployments. target\_type can be one of `gke`, `anthos_cluster`, or `run`. See [clouddeploy\_target Terraform docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_target) for more details | <pre>map(object({<br> cluster = optional(string)<br> anthos_membership = optional(string)<br> project_id = string<br> location = string<br> required_attestations = list(string)<br> env_attestation = string<br> next_env = string<br> target_type = optional(string, "gke")<br> }))</pre> | `{}` | no |
| deploy\_branch\_clusters | mapping of branch names to cluster deployments. target\_type can be one of `gke`, `anthos_cluster`, or `run`. See [clouddeploy\_target Terraform docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_target) for more details | <pre>map(object({<br> cluster = string<br> anthos_membership = string<br> project_id = string<br> location = string<br> required_attestations = list(string)<br> env_attestation = string<br> next_env = string<br> target_type = string<br> }))</pre> | `{}` | no |
| gar\_repo\_name | Docker artifact registry repo to store app build images | `string` | n/a | yes |
| labels | A set of key/value label pairs to assign to the resources deployed by this blueprint. | `map(string)` | `{}` | no |
| primary\_location | Region used for key-ring | `string` | n/a | yes |
Expand Down
6 changes: 3 additions & 3 deletions modules/secure-cd/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ variable "app_deploy_trigger_yaml" {

variable "deploy_branch_clusters" {
type = map(object({
cluster = optional(string)
anthos_membership = optional(string)
cluster = string
anthos_membership = string
project_id = string
location = string
required_attestations = list(string)
env_attestation = string
next_env = string
target_type = optional(string, "gke")
target_type = string
}))
description = "mapping of branch names to cluster deployments. target_type can be one of `gke`, `anthos_cluster`, or `run`. See [clouddeploy_target Terraform docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/clouddeploy_target) for more details"
default = {}
Expand Down
2 changes: 1 addition & 1 deletion modules/secure-cd/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

terraform {
required_version = ">= 1.3"
required_version = ">= 1.0"
required_providers {
google = {
source = "hashicorp/google"
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/app_cicd/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,33 @@ module "example" {
deploy_branch_clusters = {
"01-dev" = {
cluster = "dev-cluster",
anthos_membership = ""
project_id = var.gke_project_ids["dev"],
location = var.primary_location,
required_attestations = ["projects/${var.project_id}/attestors/build-attestor"]
env_attestation = "projects/${var.project_id}/attestors/security-attestor"
next_env = "qa"
target_type = "gke"
},
"02-qa" = {
cluster = "qa-cluster",
anthos_membership = ""
project_id = var.gke_project_ids["qa"],
location = var.primary_location,
required_attestations = ["projects/${var.project_id}/attestors/security-attestor", "projects/${var.project_id}/attestors/build-attestor"]
env_attestation = "projects/${var.project_id}/attestors/quality-attestor"
next_env = "prod"
target_type = "gke"
},
"03-prod" = {
cluster = "prod-cluster",
anthos_membership = ""
project_id = var.gke_project_ids["prod"],
location = var.primary_location,
required_attestations = ["projects/${var.project_id}/attestors/quality-attestor", "projects/${var.project_id}/attestors/security-attestor", "projects/${var.project_id}/attestors/build-attestor"]
env_attestation = ""
next_env = ""
target_type = "gke"
},
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/cloudbuild_private_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ locals {
required_attestations = ["projects/${var.project_id}/attestors/build-pc-attestor"]
env_attestation = "projects/${var.project_id}/attestors/security-pc-attestor"
next_env = "02-qa"
anthos_membership = ""
target_type = "gke"
},
"02-qa" = {
cluster = "qa-private-cluster",
Expand All @@ -33,6 +35,8 @@ locals {
required_attestations = ["projects/${var.project_id}/attestors/security-pc-attestor", "projects/${var.project_id}/attestors/build-pc-attestor"]
env_attestation = "projects/${var.project_id}/attestors/quality-pc-attestor"
next_env = "03-prod"
anthos_membership = ""
target_type = "gke"
},
"03-prod" = {
cluster = "prod-private-cluster",
Expand All @@ -42,6 +46,8 @@ locals {
required_attestations = ["projects/${var.project_id}/attestors/quality-pc-attestor", "projects/${var.project_id}/attestors/security-pc-attestor", "projects/${var.project_id}/attestors/build-pc-attestor"]
env_attestation = ""
next_env = ""
anthos_membership = ""
target_type = "gke"
},
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/private_cluster_cicd/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ locals {
required_attestations = ["projects/${var.project_id}/attestors/build-pc-attestor"]
env_attestation = "projects/${var.project_id}/attestors/security-pc-attestor"
next_env = "02-qa"
anthos_membership = ""
target_type = "gke"
},
"02-qa" = {
cluster = "qa-private-cluster",
Expand All @@ -33,6 +35,8 @@ locals {
required_attestations = ["projects/${var.project_id}/attestors/security-pc-attestor", "projects/${var.project_id}/attestors/build-pc-attestor"]
env_attestation = "projects/${var.project_id}/attestors/quality-pc-attestor"
next_env = "03-prod"
anthos_membership = ""
target_type = "gke"
},
"03-prod" = {
cluster = "prod-private-cluster",
Expand All @@ -42,6 +46,8 @@ locals {
required_attestations = ["projects/${var.project_id}/attestors/quality-pc-attestor", "projects/${var.project_id}/attestors/security-pc-attestor", "projects/${var.project_id}/attestors/build-pc-attestor"]
env_attestation = ""
next_env = ""
anthos_membership = ""
target_type = "gke"
},
}
}
Expand Down

0 comments on commit 01348c9

Please sign in to comment.