Skip to content

Commit

Permalink
feat(anthos-multi-cloud): general fixups (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody authored Oct 1, 2024
1 parent e808553 commit 93bf0a8
Show file tree
Hide file tree
Showing 45 changed files with 764 additions and 109 deletions.
36 changes: 36 additions & 0 deletions anthos-multi-cloud/AWS/modules/anthos_cluster/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| admin\_users | admin users | `list(string)` | n/a | yes |
| anthos\_prefix | anthos prefix | `string` | n/a | yes |
| aws\_region | aws region | `string` | n/a | yes |
| cluster\_version | cluster version | `string` | n/a | yes |
| control\_plane\_config\_encryption\_kms\_key\_arn | control plane config encryption kms key arn | `string` | n/a | yes |
| control\_plane\_iam\_instance\_profile | control plane iam instance profile | `string` | n/a | yes |
| control\_plane\_instance\_type | control plane instance type | `string` | n/a | yes |
| control\_plane\_main\_volume\_encryption\_kms\_key\_arn | control plane main volume encryption kms key arn | `string` | n/a | yes |
| control\_plane\_root\_volume\_encryption\_kms\_key\_arn | control plane root volume encryption kme key arn | `string` | n/a | yes |
| database\_encryption\_kms\_key\_arn | database encruption kms key arn | `string` | n/a | yes |
| fleet\_project | flet project | `string` | n/a | yes |
| location | GCP location | `string` | n/a | yes |
| node\_pool\_config\_encryption\_kms\_key\_arn | node pool config encruyption kms key arn | `string` | n/a | yes |
| node\_pool\_iam\_instance\_profile | node pool iam instance profile | `string` | n/a | yes |
| node\_pool\_instance\_type | node pool instance type | `string` | n/a | yes |
| node\_pool\_root\_volume\_encryption\_kms\_key\_arn | node pool root volume encruption kms key arn | `string` | n/a | yes |
| node\_pool\_subnet\_id | node pool subnet id | `string` | n/a | yes |
| pod\_address\_cidr\_blocks | pod address cider blocks | `list(string)` | <pre>[<br> "10.2.0.0/16"<br>]</pre> | no |
| role\_arn | role arn | `string` | n/a | yes |
| service\_address\_cidr\_blocks | service address cidr blocks | `list(string)` | <pre>[<br> "10.1.0.0/16"<br>]</pre> | no |
| subnet\_ids | subnet ids | `list(string)` | n/a | yes |
| vpc\_id | VPC id | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| fleet\_membership | fleet membership |
| project\_number | project number |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
7 changes: 2 additions & 5 deletions anthos-multi-cloud/AWS/modules/anthos_cluster/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,10 +23,6 @@
data "google_project" "project" {
}

output "project_number" {
value = data.google_project.project.number
}

resource "google_container_aws_cluster" "this" {
aws_region = var.aws_region
description = "Test AWS cluster created with Terraform"
Expand Down Expand Up @@ -85,6 +81,7 @@ resource "google_container_aws_cluster" "this" {
delete = "45m"
}
}

resource "google_container_aws_node_pool" "this" {
name = "${var.anthos_prefix}-nodepool"
cluster = google_container_aws_cluster.this.id
Expand Down
10 changes: 8 additions & 2 deletions anthos-multi-cloud/AWS/modules/anthos_cluster/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,5 +15,11 @@
*/

output "fleet_membership" {
value = google_container_aws_cluster.this.fleet[0].membership
value = google_container_aws_cluster.this.fleet[0].membership
description = "fleet membership"
}

output "project_number" {
value = data.google_project.project.number
description = "project number"
}
72 changes: 68 additions & 4 deletions anthos-multi-cloud/AWS/modules/anthos_cluster/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,49 +15,113 @@
*/

variable "location" {
type = string
description = "GCP location"
}

variable "aws_region" {
type = string
description = "aws region"
}

variable "cluster_version" {
type = string
description = "cluster version"
}

variable "control_plane_iam_instance_profile" {
type = string
description = "control plane iam instance profile"
}

variable "node_pool_iam_instance_profile" {
type = string
description = "node pool iam instance profile"
}

variable "pod_address_cidr_blocks" {
default = ["10.2.0.0/16"]
type = list(string)
description = "pod address cider blocks"
default = ["10.2.0.0/16"]
}

variable "service_address_cidr_blocks" {
default = ["10.1.0.0/16"]
type = list(string)
description = "service address cidr blocks"
default = ["10.1.0.0/16"]
}

variable "admin_users" {
type = list(string)
description = "admin users"
type = list(string)
}

variable "vpc_id" {
type = string
description = "VPC id"
}

variable "subnet_ids" {
type = list(string)
description = "subnet ids"
}

variable "database_encryption_kms_key_arn" {
type = string
description = "database encruption kms key arn"
}

variable "control_plane_config_encryption_kms_key_arn" {
type = string
description = "control plane config encryption kms key arn"
}

variable "control_plane_root_volume_encryption_kms_key_arn" {
type = string
description = "control plane root volume encryption kme key arn"
}

variable "control_plane_main_volume_encryption_kms_key_arn" {
type = string
description = "control plane main volume encryption kms key arn"
}

variable "node_pool_config_encryption_kms_key_arn" {
type = string
description = "node pool config encruyption kms key arn"
}

variable "node_pool_root_volume_encryption_kms_key_arn" {
type = string
description = "node pool root volume encruption kms key arn"
}

variable "role_arn" {
type = string
description = "role arn"
}

variable "node_pool_subnet_id" {
type = string
description = "node pool subnet id"
}

variable "fleet_project" {
type = string
description = "flet project"
}

variable "anthos_prefix" {
type = string
description = "anthos prefix"
}

variable "control_plane_instance_type" {
type = string
description = "control plane instance type"
}

variable "node_pool_instance_type" {
type = string
description = "node pool instance type"
}
25 changes: 25 additions & 0 deletions anthos-multi-cloud/AWS/modules/anthos_cluster/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright 2024 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.
*/

terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 5, < 7"
}
}
required_version = ">= 0.13"
}
16 changes: 16 additions & 0 deletions anthos-multi-cloud/AWS/modules/gcp_data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| gcp\_location | GCP location | `string` | n/a | yes |
| gcp\_project | GCP project | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| latest\_version | google container aws latest version |
| project\_number | project number |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
10 changes: 1 addition & 9 deletions anthos-multi-cloud/AWS/modules/gcp_data/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,15 +17,7 @@
data "google_project" "project" {
}

output "project_number" {
value = data.google_project.project.number
}

data "google_container_aws_versions" "this" {
location = var.gcp_location
project = var.gcp_project
}

output "latest_version" {
value = data.google_container_aws_versions.this.valid_versions[0]
}
25 changes: 25 additions & 0 deletions anthos-multi-cloud/AWS/modules/gcp_data/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright 2022-2024 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.
*/

output "project_number" {
value = data.google_project.project.number
description = "project number"
}

output "latest_version" {
value = data.google_container_aws_versions.this.valid_versions[0]
description = "google container aws latest version"
}
8 changes: 5 additions & 3 deletions anthos-multi-cloud/AWS/modules/gcp_data/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,9 +15,11 @@
*/

variable "gcp_location" {

type = string
description = "GCP location"
}

variable "gcp_project" {

type = string
description = "GCP project"
}
25 changes: 25 additions & 0 deletions anthos-multi-cloud/AWS/modules/gcp_data/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright 2024 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.
*/

terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 5, < 7"
}
}
required_version = ">= 0.13"
}
21 changes: 21 additions & 0 deletions anthos-multi-cloud/AWS/modules/iam/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| anthos\_prefix | Prefix to apply to Anthos AWS Policy & Network names | `string` | n/a | yes |
| cp\_config\_kms\_arn | Control Plane Configuration KMS ARN | `string` | n/a | yes |
| cp\_main\_volume\_kms\_arn | Control Plane Main Volume KMS ARN | `string` | n/a | yes |
| db\_kms\_arn | DB KMS ARN | `string` | n/a | yes |
| gcp\_project\_number | GCP project Number of project to host cluster | `string` | n/a | yes |
| np\_config\_kms\_arn | Node Pool Configuration KMS ARN | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| api\_role\_arn | ARN of the actuated IAM role resource |
| cp\_instance\_profile\_id | IAM instance profile of controlplane |
| np\_instance\_profile\_id | IAM instance profile of nodepool |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
11 changes: 1 addition & 10 deletions anthos-multi-cloud/AWS/modules/iam/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2022 Google LLC
* Copyright 2022-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,15 +14,6 @@
* limitations under the License.
*/

terraform {
required_version = ">= 0.12.23"
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}

# Create Anthos Multi-Cloud API role
# https://cloud.google.com/anthos/clusters/docs/multi-cloud/aws/how-to/create-aws-iam-roles

Expand Down
Loading

0 comments on commit 93bf0a8

Please sign in to comment.