From 2e552e9c1c621987631fe56f81be5df973abfbfd Mon Sep 17 00:00:00 2001 From: Nathan Mckinley Date: Thu, 9 Dec 2021 15:58:10 -0800 Subject: [PATCH] Move to handwritten samples, add data source for versions and permissible regions. --- ...ta_source_google_container_aws_versions.go | 74 +++++++++ ..._source_google_container_azure_versions.go | 74 +++++++++ mmv1/third_party/terraform/go.mod.erb | 2 +- mmv1/third_party/terraform/go.sum | 2 + .../terraform/utils/provider.go.erb | 2 + .../containeraws/samples/basic.cluster.json | 65 -------- .../containeraws/samples/basic.node_pool.json | 48 ------ .../samples/basic_aws_cluster.yaml | 42 ----- .../samples/basic_aws_node_pool.yaml | 46 ------ .../containeraws/samples/basic_cluster.yaml | 47 ------ .../containeraws/samples/basic_node_pool.yaml | 52 ------- .../containeraws/samples/minimal.cluster.json | 36 ----- .../samples/minimal.node_pool.json | 21 --- .../containeraws/samples/minimal_cluster.yaml | 40 ----- .../samples/minimal_node_pool.yaml | 44 ------ .../containeraws/samples/update.cluster.json | 65 -------- .../samples/update.node_pool.json | 48 ------ .../samples/basic.azure_client.json | 7 - .../containerazure/samples/basic.cluster.json | 57 ------- .../samples/basic.node_pool.json | 30 ---- .../samples/basic_azure_client.yaml | 28 ---- .../samples/basic_azure_cluster.yaml | 30 ---- .../samples/basic_azure_node_pool.yaml | 34 ---- .../containerazure/samples/basic_cluster.yaml | 53 ------- .../samples/basic_node_pool.yaml | 46 ------ .../samples/minimal.cluster.json | 30 ---- .../samples/minimal.node_pool.json | 20 --- .../samples/minimal_cluster.yaml | 38 ----- .../samples/minimal_node_pool.yaml | 41 ----- .../samples/update.azure_client.json | 7 - .../samples/update.cluster.json | 58 ------- .../samples/update.node_pool.json | 30 ---- tpgtools/go.mod | 2 +- tpgtools/go.sum | 4 +- .../samples/cluster/basic.tf.tmpl | 84 ++++++++++ .../containeraws/samples/cluster/basic.yaml | 32 ++++ .../samples/cluster/basic_update.tf.tmpl | 84 ++++++++++ .../samples/nodepool/basic.tf.tmpl | 146 ++++++++++++++++++ .../containeraws/samples/nodepool/basic.yaml | 34 ++++ .../samples/nodepool/basic_update.tf.tmpl | 145 +++++++++++++++++ .../containeraws/samples/nodepool/meta.yaml | 2 + .../samples/client/basic.tf.tmpl | 7 + .../containerazure/samples/client/basic.yaml | 12 ++ .../samples/{azureclient => client}/meta.yaml | 0 .../samples/cluster/basic.tf.tmpl | 51 ++++++ .../containerazure/samples/cluster/basic.yaml | 24 +++ .../samples/cluster/basic_update.tf.tmpl | 79 ++++++++++ .../samples/nodepool/basic.tf.tmpl | 92 +++++++++++ .../samples/nodepool/basic.yaml | 26 ++++ .../samples/nodepool/basic_update.tf.tmpl | 93 +++++++++++ tpgtools/resource.go | 2 +- 51 files changed, 1068 insertions(+), 1068 deletions(-) create mode 100644 mmv1/third_party/terraform/data_sources/data_source_google_container_aws_versions.go create mode 100644 mmv1/third_party/terraform/data_sources/data_source_google_container_azure_versions.go delete mode 100755 tpgtools/api/containeraws/samples/basic.cluster.json delete mode 100755 tpgtools/api/containeraws/samples/basic.node_pool.json delete mode 100755 tpgtools/api/containeraws/samples/basic_aws_cluster.yaml delete mode 100755 tpgtools/api/containeraws/samples/basic_aws_node_pool.yaml delete mode 100755 tpgtools/api/containeraws/samples/basic_cluster.yaml delete mode 100755 tpgtools/api/containeraws/samples/basic_node_pool.yaml delete mode 100755 tpgtools/api/containeraws/samples/minimal.cluster.json delete mode 100755 tpgtools/api/containeraws/samples/minimal.node_pool.json delete mode 100755 tpgtools/api/containeraws/samples/minimal_cluster.yaml delete mode 100755 tpgtools/api/containeraws/samples/minimal_node_pool.yaml delete mode 100755 tpgtools/api/containeraws/samples/update.cluster.json delete mode 100755 tpgtools/api/containeraws/samples/update.node_pool.json delete mode 100755 tpgtools/api/containerazure/samples/basic.azure_client.json delete mode 100755 tpgtools/api/containerazure/samples/basic.cluster.json delete mode 100755 tpgtools/api/containerazure/samples/basic.node_pool.json delete mode 100755 tpgtools/api/containerazure/samples/basic_azure_client.yaml delete mode 100755 tpgtools/api/containerazure/samples/basic_azure_cluster.yaml delete mode 100755 tpgtools/api/containerazure/samples/basic_azure_node_pool.yaml delete mode 100755 tpgtools/api/containerazure/samples/basic_cluster.yaml delete mode 100755 tpgtools/api/containerazure/samples/basic_node_pool.yaml delete mode 100755 tpgtools/api/containerazure/samples/minimal.cluster.json delete mode 100755 tpgtools/api/containerazure/samples/minimal.node_pool.json delete mode 100755 tpgtools/api/containerazure/samples/minimal_cluster.yaml delete mode 100755 tpgtools/api/containerazure/samples/minimal_node_pool.yaml delete mode 100755 tpgtools/api/containerazure/samples/update.azure_client.json delete mode 100755 tpgtools/api/containerazure/samples/update.cluster.json delete mode 100755 tpgtools/api/containerazure/samples/update.node_pool.json create mode 100644 tpgtools/overrides/containeraws/samples/cluster/basic.tf.tmpl create mode 100644 tpgtools/overrides/containeraws/samples/cluster/basic.yaml create mode 100644 tpgtools/overrides/containeraws/samples/cluster/basic_update.tf.tmpl create mode 100644 tpgtools/overrides/containeraws/samples/nodepool/basic.tf.tmpl create mode 100644 tpgtools/overrides/containeraws/samples/nodepool/basic.yaml create mode 100644 tpgtools/overrides/containeraws/samples/nodepool/basic_update.tf.tmpl create mode 100644 tpgtools/overrides/containeraws/samples/nodepool/meta.yaml create mode 100644 tpgtools/overrides/containerazure/samples/client/basic.tf.tmpl create mode 100644 tpgtools/overrides/containerazure/samples/client/basic.yaml rename tpgtools/overrides/containerazure/samples/{azureclient => client}/meta.yaml (100%) create mode 100644 tpgtools/overrides/containerazure/samples/cluster/basic.tf.tmpl create mode 100644 tpgtools/overrides/containerazure/samples/cluster/basic.yaml create mode 100644 tpgtools/overrides/containerazure/samples/cluster/basic_update.tf.tmpl create mode 100644 tpgtools/overrides/containerazure/samples/nodepool/basic.tf.tmpl create mode 100644 tpgtools/overrides/containerazure/samples/nodepool/basic.yaml create mode 100644 tpgtools/overrides/containerazure/samples/nodepool/basic_update.tf.tmpl diff --git a/mmv1/third_party/terraform/data_sources/data_source_google_container_aws_versions.go b/mmv1/third_party/terraform/data_sources/data_source_google_container_aws_versions.go new file mode 100644 index 000000000000..058f42c18ec5 --- /dev/null +++ b/mmv1/third_party/terraform/data_sources/data_source_google_container_aws_versions.go @@ -0,0 +1,74 @@ +package google + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func dataSourceGoogleContainerAwsVersions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceGoogleContainerAwsVersionsRead, + Schema: map[string]*schema.Schema{ + "project": { + Type: schema.TypeString, + Optional: true, + }, + "location": { + Type: schema.TypeString, + Optional: true, + }, + "valid_versions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "supported_regions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func dataSourceGoogleContainerAwsVersionsRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + userAgent, err := generateUserAgentString(d, config.userAgent) + if err != nil { + return err + } + + project, err := getProject(d, config) + if err != nil { + return err + } + + location, err := getLocation(d, config) + if err != nil { + return err + } + if len(location) == 0 { + return fmt.Errorf("Cannot determine location: set location in this data source or at provider-level") + } + + url, err := replaceVars(d, config, "{{ContainerAwsBasePath}}projects/{{project}}/locations/{{location}}/awsServerConfig") + if err != nil { + return err + } + res, err := sendRequest(config, "GET", project, url, userAgent, nil) + if err != nil { + return err + } + d.Set("supported_regions", res["supportedAwsRegions"]) + var validVersions []string + for _, v := range res["validVersions"].([]interface{}) { + vm := v.(map[string]interface{}) + validVersions = append(validVersions, vm["version"].(string)) + } + d.Set("valid_versions", validVersions) + + d.SetId(time.Now().UTC().String()) + return nil +} diff --git a/mmv1/third_party/terraform/data_sources/data_source_google_container_azure_versions.go b/mmv1/third_party/terraform/data_sources/data_source_google_container_azure_versions.go new file mode 100644 index 000000000000..a8c178ce9c70 --- /dev/null +++ b/mmv1/third_party/terraform/data_sources/data_source_google_container_azure_versions.go @@ -0,0 +1,74 @@ +package google + +import ( + "fmt" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func dataSourceGoogleContainerAzureVersions() *schema.Resource { + return &schema.Resource{ + Read: dataSourceGoogleContainerAzureVersionsRead, + Schema: map[string]*schema.Schema{ + "project": { + Type: schema.TypeString, + Optional: true, + }, + "location": { + Type: schema.TypeString, + Optional: true, + }, + "valid_versions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "supported_regions": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func dataSourceGoogleContainerAzureVersionsRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + userAgent, err := generateUserAgentString(d, config.userAgent) + if err != nil { + return err + } + + project, err := getProject(d, config) + if err != nil { + return err + } + + location, err := getLocation(d, config) + if err != nil { + return err + } + if len(location) == 0 { + return fmt.Errorf("Cannot determine location: set location in this data source or at provider-level") + } + + url, err := replaceVars(d, config, "{{ContainerAzureBasePath}}projects/{{project}}/locations/{{location}}/azureServerConfig") + if err != nil { + return err + } + res, err := sendRequest(config, "GET", project, url, userAgent, nil) + if err != nil { + return err + } + d.Set("supported_regions", res["supportedAzureRegions"]) + var validVersions []string + for _, v := range res["validVersions"].([]interface{}) { + vm := v.(map[string]interface{}) + validVersions = append(validVersions, vm["version"].(string)) + } + d.Set("valid_versions", validVersions) + + d.SetId(time.Now().UTC().String()) + return nil +} diff --git a/mmv1/third_party/terraform/go.mod.erb b/mmv1/third_party/terraform/go.mod.erb index 7bcee27888db..1886d6ab7333 100644 --- a/mmv1/third_party/terraform/go.mod.erb +++ b/mmv1/third_party/terraform/go.mod.erb @@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-google<%= "-" + version unless ve require ( cloud.google.com/go/bigtable v1.10.1 - github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211203235203-8447c7fb5d37 + github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211209025336-809317629d25 github.com/apparentlymart/go-cidr v1.1.0 github.com/client9/misspell v0.3.4 github.com/davecgh/go-spew v1.1.1 diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index db3f215eddf7..1eb832243caf 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -1455,3 +1455,5 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211209025336-809317629d25 h1:ZtvhfSquCMVsEbbHW2cCmnvmvmmBzo2z8xdqWgZu10k= +github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211209025336-809317629d25/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU= diff --git a/mmv1/third_party/terraform/utils/provider.go.erb b/mmv1/third_party/terraform/utils/provider.go.erb index 1d3420558ee9..c17b2d97394d 100644 --- a/mmv1/third_party/terraform/utils/provider.go.erb +++ b/mmv1/third_party/terraform/utils/provider.go.erb @@ -245,6 +245,8 @@ func Provider() *schema.Provider { "google_compute_subnetwork": dataSourceGoogleComputeSubnetwork(), "google_compute_vpn_gateway": dataSourceGoogleComputeVpnGateway(), "google_compute_zones": dataSourceGoogleComputeZones(), + "google_container_azure_versions": dataSourceGoogleContainerAzureVersions(), + "google_container_aws_versions": dataSourceGoogleContainerAwsVersions(), "google_container_cluster": dataSourceGoogleContainerCluster(), "google_container_engine_versions": dataSourceGoogleContainerEngineVersions(), "google_container_registry_image": dataSourceGoogleContainerImage(), diff --git a/tpgtools/api/containeraws/samples/basic.cluster.json b/tpgtools/api/containeraws/samples/basic.cluster.json deleted file mode 100755 index 3f44c545e72c..000000000000 --- a/tpgtools/api/containeraws/samples/basic.cluster.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "{{cluster}}", - "project": "{{project}}", - "location": "us-west1", - "description": "A sample aws cluster", - "networking": { - "vpcId": "{{aws_vpc}}", - "podAddressCidrBlocks": ["10.2.0.0/16"], - "serviceAddressCidrBlocks": ["10.1.0.0/16"], - "serviceLoadBalancerSubnetIds": ["{{aws_subnet}}"] - }, - "awsRegion": "{{aws_region}}", - "controlPlane": { - "version": "1.21.3-gke.2001", - "instanceType": "t3.medium", - "sshConfig": { - "ec2KeyPair": "{{byo_multicloud_prefix}}-1p-dev-ssh" - }, - "subnetIds": ["{{aws_subnet}}"], - "configEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - }, - "securityGroupIds": ["{{aws_security_group}}"], - "iamInstanceProfile": "{{byo_multicloud_prefix}}-1p-dev-controlplane", - "rootVolume": { - "sizeGib": 10, - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}", - "volumeType": "GP3", - "iops": 3000 - }, - "mainVolume": { - "sizeGib": 10, - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}", - "volumeType": "GP3", - "iops": 3000 - }, - "databaseEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - }, - "awsServicesAuthentication": { - "roleArn": "arn:aws:iam::{{aws_account_id}}:role/{{byo_multicloud_prefix}}-1p-dev-oneplatform", - "roleSessionName": "{{byo_multicloud_prefix}}-1p-dev-session" - }, - "tags": { - "owner": "{{test_service_account}}" - }, - "proxyConfig": { - "secretArn": "arn:aws:secretsmanager:us-west-2:126285863215:secret:proxy_config20210824150329476300000001-ABCDEF", - "secretVersion": "12345678-ABCD-EFGH-IJKL-987654321098" - } - }, - "authorization": { - "adminUsers": [ - { - "username": "{{test_service_account}}" - } - ] - }, - "annotations": { - "label-one": "value-one" - }, - "fleet": { - "project": "{{project_number}}" - } -} diff --git a/tpgtools/api/containeraws/samples/basic.node_pool.json b/tpgtools/api/containeraws/samples/basic.node_pool.json deleted file mode 100755 index f8c2bc731d1a..000000000000 --- a/tpgtools/api/containeraws/samples/basic.node_pool.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "{{pool}}", - "project": "{{project}}", - "location": "us-west1", - "cluster": "{{ref:minimal.cluster.json:name}}", - "version": "1.21.3-gke.2001", - "autoscaling": { - "minNodeCount": 1, - "maxNodeCount": 5 - }, - "subnetId": "{{aws_subnet}}", - "maxPodsConstraint": { - "maxPodsPerNode": 110 - }, - "config": { - "instanceType": "t3.medium", - "configEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - }, - "rootVolume": { - "sizeGib": 10, - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}", - "volumeType": "GP3", - "iops": 3000 - }, - "taints": [ - { - "key": "taint-key", - "value": "taint-value", - "effect": "PREFER_NO_SCHEDULE" - } - ], - "labels": { - "label-one": "value-one" - }, - "tags": { - "tag-one": "value-one" - }, - "iamInstanceProfile": "{{byo_multicloud_prefix}}-1p-dev-nodepool", - "sshConfig": { - "ec2KeyPair": "{{byo_multicloud_prefix}}-1p-dev-ssh" - }, - "securityGroupIds": ["{{aws_security_group}}"] - }, - "annotations": { - "label-one": "value-one" - } -} diff --git a/tpgtools/api/containeraws/samples/basic_aws_cluster.yaml b/tpgtools/api/containeraws/samples/basic_aws_cluster.yaml deleted file mode 100755 index 41d5f0737a53..000000000000 --- a/tpgtools/api/containeraws/samples/basic_aws_cluster.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -description: A basic example of a containeraws aws cluster -name: basic_aws_cluster -resource: samples/basic.aws_cluster.json -type: aws_cluster -variables: -- name: aws_region - type: aws_region -- name: aws_subnet - type: aws_subnet -- name: test_service_account - type: test_service_account -- name: project - type: project -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: aws_account_id - type: aws_account_id -- name: aws_volume_encryption_key - type: aws_volume_encryption_key -- name: cluster - type: resource_name -- name: aws_vpc - type: aws_vpc -- name: aws_database_encryption_key - type: aws_database_encryption_key -- name: aws_security_group - type: aws_security_group -versions: -- ga diff --git a/tpgtools/api/containeraws/samples/basic_aws_node_pool.yaml b/tpgtools/api/containeraws/samples/basic_aws_node_pool.yaml deleted file mode 100755 index 744c2e58ee57..000000000000 --- a/tpgtools/api/containeraws/samples/basic_aws_node_pool.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -dependencies: -- samples/basic.aws_cluster.json -description: A basic example of a containeraws aws node pool -name: basic_aws_node_pool -resource: samples/basic.aws_node_pool.json -type: aws_node_pool -variables: -- name: aws_subnet - type: aws_subnet -- name: aws_region - type: aws_region -- name: aws_account_id - type: aws_account_id -- name: aws_volume_encryption_key - type: aws_volume_encryption_key -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: aws_database_encryption_key - type: aws_database_encryption_key -- name: aws_vpc - type: aws_vpc -- name: test_service_account - type: test_service_account -- name: aws_security_group - type: aws_security_group -- name: cluster - type: resource_name -- name: project - type: project -- name: pool - type: resource_name -versions: -- ga diff --git a/tpgtools/api/containeraws/samples/basic_cluster.yaml b/tpgtools/api/containeraws/samples/basic_cluster.yaml deleted file mode 100755 index d98a07da90a2..000000000000 --- a/tpgtools/api/containeraws/samples/basic_cluster.yaml +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: basic_cluster -description: A basic example of a containeraws aws cluster -type: cluster -versions: -- ga -resource: samples/basic.cluster.json -updates: -- resource: samples/update.cluster.json - dependencies: [] -variables: -- name: aws_account_id - type: aws_account_id -- name: aws_database_encryption_key - type: aws_database_encryption_key -- name: aws_region - type: aws_region -- name: aws_security_group - type: aws_security_group -- name: aws_subnet - type: aws_subnet -- name: aws_volume_encryption_key - type: aws_volume_encryption_key -- name: aws_vpc - type: aws_vpc -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: cluster - type: resource_name -- name: project - type: project -- name: project_number - type: project_number -- name: test_service_account - type: test_service_account diff --git a/tpgtools/api/containeraws/samples/basic_node_pool.yaml b/tpgtools/api/containeraws/samples/basic_node_pool.yaml deleted file mode 100755 index 680fc44032c1..000000000000 --- a/tpgtools/api/containeraws/samples/basic_node_pool.yaml +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: basic_node_pool -description: A basic example of a containeraws aws node pool -type: node_pool -versions: -- ga -resource: samples/basic.node_pool.json -dependencies: -- samples/minimal.cluster.json -updates: -- resource: samples/update.node_pool.json - dependencies: - - samples/minimal.cluster.json -variables: -- name: aws_account_id - type: aws_account_id -- name: aws_database_encryption_key - type: aws_database_encryption_key -- name: aws_region - type: aws_region -- name: aws_security_group - type: aws_security_group -- name: aws_subnet - type: aws_subnet -- name: aws_volume_encryption_key - type: aws_volume_encryption_key -- name: aws_vpc - type: aws_vpc -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: cluster - type: resource_name -- name: pool - type: resource_name -- name: project - type: project -- name: project_number - type: project_number -- name: test_service_account - type: test_service_account diff --git a/tpgtools/api/containeraws/samples/minimal.cluster.json b/tpgtools/api/containeraws/samples/minimal.cluster.json deleted file mode 100755 index 64f4615afd4b..000000000000 --- a/tpgtools/api/containeraws/samples/minimal.cluster.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "{{cluster}}", - "project": "{{project}}", - "location": "us-west1", - "networking": { - "vpcId": "{{aws_vpc}}", - "podAddressCidrBlocks": ["10.2.0.0/16"], - "serviceAddressCidrBlocks": ["10.1.0.0/16"], - "serviceLoadBalancerSubnetIds": ["{{aws_subnet}}"] - }, - "awsRegion": "{{aws_region}}", - "controlPlane": { - "version": "1.21.3-gke.2001", - "subnetIds": ["{{aws_subnet}}"], - "iamInstanceProfile": "{{byo_multicloud_prefix}}-1p-dev-controlplane", - "databaseEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - }, - "configEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - }, - "awsServicesAuthentication": { - "roleArn": "arn:aws:iam::{{aws_account_id}}:role/{{byo_multicloud_prefix}}-1p-dev-oneplatform" - } - }, - "authorization": { - "adminUsers": [ - { - "username": "{{test_service_account}}" - } - ] - }, - "fleet": { - "project": "{{project_number}}" - } -} diff --git a/tpgtools/api/containeraws/samples/minimal.node_pool.json b/tpgtools/api/containeraws/samples/minimal.node_pool.json deleted file mode 100755 index c642b86113ba..000000000000 --- a/tpgtools/api/containeraws/samples/minimal.node_pool.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "{{pool}}", - "project": "{{project}}", - "location": "us-west1", - "cluster": "{{ref:minimal.cluster.json:name}}", - "version": "1.21.3-gke.2001", - "autoscaling": { - "minNodeCount": 1, - "maxNodeCount": 5 - }, - "subnetId": "{{aws_subnet}}", - "maxPodsConstraint": { - "maxPodsPerNode": 110 - }, - "config": { - "iamInstanceProfile": "{{byo_multicloud_prefix}}-1p-dev-nodepool", - "configEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - } - } -} diff --git a/tpgtools/api/containeraws/samples/minimal_cluster.yaml b/tpgtools/api/containeraws/samples/minimal_cluster.yaml deleted file mode 100755 index 115e6faa6b2a..000000000000 --- a/tpgtools/api/containeraws/samples/minimal_cluster.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: minimal_cluster -description: A minimal example of a containeraws aws cluster -type: cluster -versions: -- ga -resource: samples/minimal.cluster.json -variables: -- name: aws_account_id - type: aws_account_id -- name: aws_database_encryption_key - type: aws_database_encryption_key -- name: aws_region - type: aws_region -- name: aws_subnet - type: aws_subnet -- name: aws_vpc - type: aws_vpc -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: cluster - type: resource_name -- name: project - type: project -- name: project_number - type: project_number -- name: test_service_account - type: test_service_account diff --git a/tpgtools/api/containeraws/samples/minimal_node_pool.yaml b/tpgtools/api/containeraws/samples/minimal_node_pool.yaml deleted file mode 100755 index f7cf89a4372d..000000000000 --- a/tpgtools/api/containeraws/samples/minimal_node_pool.yaml +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: minimal_node_pool -description: A minimal example of a containeraws aws node pool -type: node_pool -versions: -- ga -resource: samples/minimal.node_pool.json -dependencies: -- samples/minimal.cluster.json -variables: -- name: aws_account_id - type: aws_account_id -- name: aws_database_encryption_key - type: aws_database_encryption_key -- name: aws_region - type: aws_region -- name: aws_subnet - type: aws_subnet -- name: aws_vpc - type: aws_vpc -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: cluster - type: resource_name -- name: pool - type: resource_name -- name: project - type: project -- name: project_number - type: project_number -- name: test_service_account - type: test_service_account diff --git a/tpgtools/api/containeraws/samples/update.cluster.json b/tpgtools/api/containeraws/samples/update.cluster.json deleted file mode 100755 index 47ed29deccd2..000000000000 --- a/tpgtools/api/containeraws/samples/update.cluster.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "{{cluster}}", - "project": "{{project}}", - "location": "us-west1", - "description": "An updated sample aws cluster", - "networking": { - "vpcId": "{{aws_vpc}}", - "podAddressCidrBlocks": ["10.2.0.0/16"], - "serviceAddressCidrBlocks": ["10.1.0.0/16"], - "serviceLoadBalancerSubnetIds": ["{{aws_subnet}}"] - }, - "awsRegion": "{{aws_region}}", - "controlPlane": { - "version": "1.21.5-gke.2800", - "instanceType": "t3.medium", - "sshConfig": { - "ec2KeyPair": "{{byo_multicloud_prefix}}-1p-dev-ssh" - }, - "subnetIds": ["{{aws_subnet}}"], - "securityGroupIds": ["{{aws_security_group}}"], - "iamInstanceProfile": "{{byo_multicloud_prefix}}-1p-dev-controlplane", - "rootVolume": { - "sizeGib": 10, - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}", - "volumeType": "GP3", - "iops": 3000 - }, - "mainVolume": { - "sizeGib": 10, - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}", - "volumeType": "GP3", - "iops": 3000 - }, - "configEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - }, - "databaseEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - }, - "awsServicesAuthentication": { - "roleArn": "arn:aws:iam::{{aws_account_id}}:role/{{byo_multicloud_prefix}}-1p-dev-oneplatform", - "roleSessionName": "{{byo_multicloud_prefix}}-1p-dev-session" - }, - "tags": { - "owner": "{{test_service_account}}" - }, - "proxyConfig": { - "secretArn": "arn:aws:secretsmanager:us-west-2:126285863215:secret:proxy_config20210824150329476300000001-ABCDEF", - "secretVersion": "12345678-ABCD-EFGH-IJKL-987654321098" - } - }, - "authorization": { - "adminUsers": [ - { - "username": "{{test_service_account}}" - } - ] - }, - "annotations": { - "label-two": "value-two" - }, - "fleet": { - "project": "{{project_number}}" - } -} diff --git a/tpgtools/api/containeraws/samples/update.node_pool.json b/tpgtools/api/containeraws/samples/update.node_pool.json deleted file mode 100755 index 2308c273c944..000000000000 --- a/tpgtools/api/containeraws/samples/update.node_pool.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "{{pool}}", - "project": "{{project}}", - "location": "us-west1", - "cluster": "{{ref:minimal.cluster.json:name}}", - "version": "1.21.3-gke.2001", - "autoscaling": { - "minNodeCount": 1, - "maxNodeCount": 5 - }, - "subnetId": "{{aws_subnet}}", - "maxPodsConstraint": { - "maxPodsPerNode": 110 - }, - "config": { - "instanceType": "t3.medium", - "configEncryption": { - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" - }, - "rootVolume": { - "sizeGib": 10, - "kmsKeyArn": "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}", - "volumeType": "GP3", - "iops": 3000 - }, - "taints": [ - { - "key": "taint-key", - "value": "taint-value", - "effect": "PREFER_NO_SCHEDULE" - } - ], - "labels": { - "label-one": "value-one" - }, - "tags": { - "tag-one": "value-one" - }, - "iamInstanceProfile": "{{byo_multicloud_prefix}}-1p-dev-nodepool", - "sshConfig": { - "ec2KeyPair": "{{byo_multicloud_prefix}}-1p-dev-ssh" - }, - "securityGroupIds": ["{{aws_security_group}}"] - }, - "annotations": { - "label-two": "value-two" - } -} diff --git a/tpgtools/api/containerazure/samples/basic.azure_client.json b/tpgtools/api/containerazure/samples/basic.azure_client.json deleted file mode 100755 index 6e69df37d25c..000000000000 --- a/tpgtools/api/containerazure/samples/basic.azure_client.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "{{client}}", - "project": "{{project}}", - "location": "us-west1", - "tenantId": "{{azure_ad_tenant}}", - "applicationId": "{{azure_application}}" -} diff --git a/tpgtools/api/containerazure/samples/basic.cluster.json b/tpgtools/api/containerazure/samples/basic.cluster.json deleted file mode 100755 index d3892a404506..000000000000 --- a/tpgtools/api/containerazure/samples/basic.cluster.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "{{cluster}}", - "project": "{{project}}", - "location": "us-west1", - "client": "projects/{{project_number}}/locations/us-west1/azureClients/{{ref:basic.azure_client.json:name}}", - "description": "A sample azure cluster", - "azureRegion": "westus2", - "networking": { - "virtualNetworkId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet", - "podAddressCidrBlocks": ["10.200.0.0/16"], - "serviceAddressCidrBlocks": ["10.32.0.0/24"] - }, - "resourceGroupId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster", - "controlPlane": { - "version": "1.21.3-gke.2001", - "subnetId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default", - "vmSize": "Standard_DS2_v2", - "sshConfig": { - "authorizedKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" - }, - "rootVolume": { - "sizeGib": 32 - }, - "mainVolume": { - "sizeGib": 8 - }, - "databaseEncryption": { - "keyId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster/providers/Microsoft.KeyVault/vaults/{{byo_multicloud_prefix}}-dev-keyvault/keys/{{byo_multicloud_prefix}}-dev-key" - }, - "tags": { - "owner": "mmv2" - }, - "proxyConfig": { - "resourceGroupId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster", - "secretId": "https://{{byo_multicloud_prefix}}-dev-keyvault.vault.azure.net/secrets/{{byo_multicloud_prefix}}-dev-secret/{{azure_proxy_config_secret_version}}" - }, - "replicaPlacements": [ - { - "subnetId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default", - "azureAvailabilityZone": "1" - } - ] - }, - "authorization": { - "adminUsers": [ - { - "username": "mmv2@google.com" - } - ] - }, - "annotations": { - "annotation-one": "value-one" - }, - "fleet": { - "project": "{{project_number}}" - } -} diff --git a/tpgtools/api/containerazure/samples/basic.node_pool.json b/tpgtools/api/containerazure/samples/basic.node_pool.json deleted file mode 100755 index f38293a8ac62..000000000000 --- a/tpgtools/api/containerazure/samples/basic.node_pool.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "{{node-pool}}", - "project": "{{project}}", - "location": "us-west1", - "cluster": "{{ref:minimal.cluster.json:name}}", - "version": "1.21.3-gke.2001", - "config": { - "rootVolume": { - "sizeGib": 32 - }, - "vmSize": "Standard_DS2_v2", - "tags": { - "owner": "mmv2" - }, - "sshConfig": { - "authorizedKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" - } - }, - "subnetId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default", - "autoscaling": { - "minNodeCount": 2, - "maxNodeCount": 3 - }, - "annotations": { - "annotation-one": "value-one" - }, - "maxPodsConstraint": { - "maxPodsPerNode": 110 - } -} diff --git a/tpgtools/api/containerazure/samples/basic_azure_client.yaml b/tpgtools/api/containerazure/samples/basic_azure_client.yaml deleted file mode 100755 index 29fd20a80fc4..000000000000 --- a/tpgtools/api/containerazure/samples/basic_azure_client.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: basic_azure_client -description: A basic example of a containerazure azure client -type: azure_client -versions: -- ga -resource: samples/basic.azure_client.json -variables: -- name: azure_ad_tenant - type: azure_ad_tenant -- name: azure_application - type: azure_application -- name: client - type: resource_name -- name: project - type: project diff --git a/tpgtools/api/containerazure/samples/basic_azure_cluster.yaml b/tpgtools/api/containerazure/samples/basic_azure_cluster.yaml deleted file mode 100755 index 3a974b530711..000000000000 --- a/tpgtools/api/containerazure/samples/basic_azure_cluster.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -description: A basic example of a containerazure azure cluster -name: basic_azure_cluster -resource: samples/basic.azure_cluster.json -type: azure_cluster -variables: -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: azure_database_encryption_key_version - type: azure_database_encryption_key_version -- name: azure_subscription - type: azure_subscription -- name: cluster - type: resource_name -- name: project - type: project -versions: -- ga diff --git a/tpgtools/api/containerazure/samples/basic_azure_node_pool.yaml b/tpgtools/api/containerazure/samples/basic_azure_node_pool.yaml deleted file mode 100755 index c96fdd239411..000000000000 --- a/tpgtools/api/containerazure/samples/basic_azure_node_pool.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -dependencies: -- samples/basic.azure_cluster.json -description: A basic example of a containerazure azure node pool -name: basic_azure_node_pool -resource: samples/basic.azure_node_pool.json -type: azure_node_pool -variables: -- name: azure_subscription - type: azure_subscription -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: cluster - type: resource_name -- name: azure_database_encryption_key_version - type: azure_database_encryption_key_version -- name: project - type: project -- name: node_pool - type: resource_name -versions: -- ga diff --git a/tpgtools/api/containerazure/samples/basic_cluster.yaml b/tpgtools/api/containerazure/samples/basic_cluster.yaml deleted file mode 100755 index 013079867b5a..000000000000 --- a/tpgtools/api/containerazure/samples/basic_cluster.yaml +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: basic_cluster -description: A basic example of a containerazure azure cluster -type: cluster -versions: -- ga -resource: samples/basic.cluster.json -dependencies: -- samples/basic.azure_client.json -updates: -- resource: samples/update.cluster.json - dependencies: - # note that this has been changed from the exported sample. - # the client here cannot be deleted while it is still in use, - # and terraform currently cannot handle switching between two - # dependent resources in the right order without significant - # manual work - which doesn't seem worth doing here. - # The swap is tested well in the DCL. - # We could have rewritten it / handwritten it, but it seems - # worth taking advantage of the samples work already done, - # even if this diff is annoying to maintain. - - samples/basic.azure_client.json -variables: -- name: azure_ad_tenant - type: azure_ad_tenant -- name: azure_application - type: azure_application -- name: azure_proxy_config_secret_version - type: azure_proxy_config_secret_version -- name: azure_subscription - type: azure_subscription -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: client - type: resource_name -- name: cluster - type: resource_name -- name: project - type: project -- name: project_number - type: project_number diff --git a/tpgtools/api/containerazure/samples/basic_node_pool.yaml b/tpgtools/api/containerazure/samples/basic_node_pool.yaml deleted file mode 100755 index 5f6a099d79cf..000000000000 --- a/tpgtools/api/containerazure/samples/basic_node_pool.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: basic_node_pool -description: A basic example of a containerazure azure node pool -type: node_pool -versions: -- ga -resource: samples/basic.node_pool.json -dependencies: -- samples/minimal.cluster.json -- samples/basic.azure_client.json -updates: -- resource: samples/update.node_pool.json - dependencies: - - samples/minimal.cluster.json - - samples/basic.azure_client.json -variables: -- name: azure_ad_tenant - type: azure_ad_tenant -- name: azure_application - type: azure_application -- name: azure_subscription - type: azure_subscription -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: client - type: resource_name -- name: cluster - type: resource_name -- name: node-pool - type: resource_name -- name: project - type: project -- name: project_number - type: project_number diff --git a/tpgtools/api/containerazure/samples/minimal.cluster.json b/tpgtools/api/containerazure/samples/minimal.cluster.json deleted file mode 100755 index fe30ac049b37..000000000000 --- a/tpgtools/api/containerazure/samples/minimal.cluster.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "{{cluster}}", - "project": "{{project}}", - "location": "us-west1", - "client": "projects/{{project_number}}/locations/us-west1/azureClients/{{ref:basic.azure_client.json:name}}", - "azureRegion": "westus2", - "networking": { - "virtualNetworkId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet", - "podAddressCidrBlocks": ["10.200.0.0/16"], - "serviceAddressCidrBlocks": ["10.32.0.0/24"] - }, - "resourceGroupId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster", - "controlPlane": { - "version": "1.21.5-gke.2800", - "subnetId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default", - "sshConfig": { - "authorizedKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" - } - }, - "authorization": { - "adminUsers": [ - { - "username": "mmv2@google.com" - } - ] - }, - "fleet": { - "project": "{{project_number}}" - } -} diff --git a/tpgtools/api/containerazure/samples/minimal.node_pool.json b/tpgtools/api/containerazure/samples/minimal.node_pool.json deleted file mode 100755 index 825ff088c421..000000000000 --- a/tpgtools/api/containerazure/samples/minimal.node_pool.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "{{node-pool}}", - "project": "{{project}}", - "location": "us-west1", - "cluster": "{{ref:minimal.cluster.json:name}}", - "version": "1.21.3-gke.2001", - "config": { - "sshConfig": { - "authorizedKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" - } - }, - "subnetId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default", - "autoscaling": { - "minNodeCount": 2, - "maxNodeCount": 3 - }, - "maxPodsConstraint": { - "maxPodsPerNode": 110 - } -} diff --git a/tpgtools/api/containerazure/samples/minimal_cluster.yaml b/tpgtools/api/containerazure/samples/minimal_cluster.yaml deleted file mode 100755 index 6a8e9cfc9e5a..000000000000 --- a/tpgtools/api/containerazure/samples/minimal_cluster.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: minimal_cluster -description: A minimal example of a containerazure azure cluster -type: cluster -versions: -- ga -resource: samples/minimal.cluster.json -dependencies: -- samples/basic.azure_client.json -variables: -- name: azure_ad_tenant - type: azure_ad_tenant -- name: azure_application - type: azure_application -- name: azure_subscription - type: azure_subscription -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: client - type: resource_name -- name: cluster - type: resource_name -- name: project - type: project -- name: project_number - type: project_number diff --git a/tpgtools/api/containerazure/samples/minimal_node_pool.yaml b/tpgtools/api/containerazure/samples/minimal_node_pool.yaml deleted file mode 100755 index 7462cc16158a..000000000000 --- a/tpgtools/api/containerazure/samples/minimal_node_pool.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -name: minimal_node_pool -description: A minimal example of a containerazure azure node pool -type: node_pool -versions: -- ga -resource: samples/minimal.node_pool.json -dependencies: -- samples/minimal.cluster.json -- samples/basic.azure_client.json -variables: -- name: azure_ad_tenant - type: azure_ad_tenant -- name: azure_application - type: azure_application -- name: azure_subscription - type: azure_subscription -- name: byo_multicloud_prefix - type: byo_multicloud_prefix -- name: client - type: resource_name -- name: cluster - type: resource_name -- name: node-pool - type: resource_name -- name: project - type: project -- name: project_number - type: project_number diff --git a/tpgtools/api/containerazure/samples/update.azure_client.json b/tpgtools/api/containerazure/samples/update.azure_client.json deleted file mode 100755 index e9a3b11be9b1..000000000000 --- a/tpgtools/api/containerazure/samples/update.azure_client.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "{{client}}-update", - "project": "{{project}}", - "location": "us-west1", - "tenantId": "{{azure_ad_tenant}}", - "applicationId": "{{azure_application}}" -} diff --git a/tpgtools/api/containerazure/samples/update.cluster.json b/tpgtools/api/containerazure/samples/update.cluster.json deleted file mode 100755 index 32aa3edf4198..000000000000 --- a/tpgtools/api/containerazure/samples/update.cluster.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "{{cluster}}", - "project": "{{project}}", - "location": "us-west1", - "client": "projects/{{project_number}}/locations/us-west1/azureClients/{{ref:basic.azure_client.json:name}}", - "description": "An updated sample azure cluster", - "azureRegion": "westus2", - "networking": { - "virtualNetworkId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet", - "podAddressCidrBlocks": ["10.200.0.0/16"], - "serviceAddressCidrBlocks": ["10.32.0.0/24"] - }, - "resourceGroupId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster", - "controlPlane": { - "version": "1.21.5-gke.2800", - "subnetId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default", - "vmSize": "Standard_DS2_v2", - "sshConfig": { - "authorizedKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" - }, - "rootVolume": { - "sizeGib": 32 - }, - "mainVolume": { - "sizeGib": 8 - }, - "databaseEncryption": { - "resourceGroupId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster", - "keyId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster/providers/Microsoft.KeyVault/vaults/{{byo_multicloud_prefix}}-dev-keyvault/keys/{{byo_multicloud_prefix}}-dev-key" - }, - "tags": { - "owner": "mmv2" - }, - "proxyConfig": { - "resourceGroupId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster", - "secretId": "https://{{byo_multicloud_prefix}}-dev-keyvault.vault.azure.net/secrets/{{byo_multicloud_prefix}}-dev-secret/{{azure_proxy_config_secret_version}}" - }, - "replicaPlacements": [ - { - "subnetId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default", - "azureAvailabilityZone": "1" - } - ] - }, - "authorization": { - "adminUsers": [ - { - "username": "mmv2@google.com" - } - ] - }, - "annotations": { - "annotation-one": "value-one" - }, - "fleet": { - "project": "{{project_number}}" - } -} diff --git a/tpgtools/api/containerazure/samples/update.node_pool.json b/tpgtools/api/containerazure/samples/update.node_pool.json deleted file mode 100755 index 205009091acf..000000000000 --- a/tpgtools/api/containerazure/samples/update.node_pool.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "{{node-pool}}", - "project": "{{project}}", - "location": "us-west1", - "cluster": "{{ref:minimal.cluster.json:name}}", - "version": "1.21.5-gke.2800", - "config": { - "rootVolume": { - "sizeGib": 32 - }, - "vmSize": "Standard_DS2_v2", - "tags": { - "owner": "mmv2" - }, - "sshConfig": { - "authorizedKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" - } - }, - "subnetId": "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default", - "autoscaling": { - "minNodeCount": 2, - "maxNodeCount": 3 - }, - "annotations": { - "annotation-two": "value-two" - }, - "maxPodsConstraint": { - "maxPodsPerNode": 110 - } -} diff --git a/tpgtools/go.mod b/tpgtools/go.mod index 570dc67eddb7..114ea38041d1 100644 --- a/tpgtools/go.mod +++ b/tpgtools/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( bitbucket.org/creachadair/stringset v0.0.9 - github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211203235203-8447c7fb5d37 + github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211209025336-809317629d25 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/hcl v1.0.0 diff --git a/tpgtools/go.sum b/tpgtools/go.sum index f4e4b5332a65..0da36966fede 100644 --- a/tpgtools/go.sum +++ b/tpgtools/go.sum @@ -36,8 +36,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211203235203-8447c7fb5d37 h1:ZP6ooWRrhphOPgdAk/W4kjiviVOu9jqyoGA85syyc0Q= -github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211203235203-8447c7fb5d37/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU= +github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211209025336-809317629d25 h1:ZtvhfSquCMVsEbbHW2cCmnvmvmmBzo2z8xdqWgZu10k= +github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20211209025336-809317629d25/go.mod h1:oEeBHikdF/NrnUy0ornVaY1OT+jGvTqm+LQS0+ZDKzU= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= diff --git a/tpgtools/overrides/containeraws/samples/cluster/basic.tf.tmpl b/tpgtools/overrides/containeraws/samples/cluster/basic.tf.tmpl new file mode 100644 index 000000000000..ffa75537965e --- /dev/null +++ b/tpgtools/overrides/containeraws/samples/cluster/basic.tf.tmpl @@ -0,0 +1,84 @@ +data "google_container_aws_versions" "versions" { + project = "{{project}}" + location = "us-west1" +} + +resource "google_container_aws_cluster" "primary" { + authorization { + admin_users { + username = "{{test_service_account}}" + } + } + + aws_region = "{{aws_region}}" + + control_plane { + aws_services_authentication { + role_arn = "arn:aws:iam::{{aws_account_id}}:role/{{byo_multicloud_prefix}}-1p-dev-oneplatform" + role_session_name = "{{byo_multicloud_prefix}}-1p-dev-session" + } + + config_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + database_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + iam_instance_profile = "{{byo_multicloud_prefix}}-1p-dev-controlplane" + subnet_ids = ["{{aws_subnet}}"] + version = "${data.google_container_aws_versions.versions.valid_versions[0]}" + instance_type = "t3.medium" + + main_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + proxy_config { + secret_arn = "arn:aws:secretsmanager:us-west-2:126285863215:secret:proxy_config20210824150329476300000001-ABCDEF" + secret_version = "12345678-ABCD-EFGH-IJKL-987654321098" + } + + root_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + security_group_ids = ["{{aws_security_group}}"] + + ssh_config { + ec2_key_pair = "{{byo_multicloud_prefix}}-1p-dev-ssh" + } + + tags = { + owner = "{{test_service_account}}" + } + } + + fleet { + project = "{{project_number}}" + } + + location = "us-west1" + name = "{{name}}" + + networking { + pod_address_cidr_blocks = ["10.2.0.0/16"] + service_address_cidr_blocks = ["10.1.0.0/16"] + vpc_id = "{{aws_vpc}}" + } + + annotations = { + label-one = "value-one" + } + + description = "A sample aws cluster" + project = "{{project}}" +} + diff --git a/tpgtools/overrides/containeraws/samples/cluster/basic.yaml b/tpgtools/overrides/containeraws/samples/cluster/basic.yaml new file mode 100644 index 000000000000..e5e4d10edf13 --- /dev/null +++ b/tpgtools/overrides/containeraws/samples/cluster/basic.yaml @@ -0,0 +1,32 @@ +description: A basic example of a containeraws cluster +name: basic_aws_cluster +type: aws_cluster +updates: +- resource: ./basic_update.tf.tmpl +variables: +- name: byo_multicloud_prefix + type: byo_multicloud_prefix +- name: name + type: resource_name +- name: project + type: project +- name: project_number + type: project_number +- name: aws_account_id + type: aws_account_id +- name: aws_volume_encryption_key + type: aws_volume_encryption_key +- name: aws_vpc + type: aws_vpc +- name: aws_database_encryption_key + type: aws_database_encryption_key +- name: aws_security_group + type: aws_security_group +- name: aws_subnet + type: aws_subnet +- name: aws_security_group + type: aws_security_group +- name: aws_region + type: aws_region +- name: test_service_account + type: test_service_account diff --git a/tpgtools/overrides/containeraws/samples/cluster/basic_update.tf.tmpl b/tpgtools/overrides/containeraws/samples/cluster/basic_update.tf.tmpl new file mode 100644 index 000000000000..c20cc9b2345d --- /dev/null +++ b/tpgtools/overrides/containeraws/samples/cluster/basic_update.tf.tmpl @@ -0,0 +1,84 @@ +data "google_container_aws_versions" "versions" { + project = "{{project}}" + location = "us-west1" +} + +resource "google_container_aws_cluster" "primary" { + authorization { + admin_users { + username = "{{test_service_account}}" + } + } + + aws_region = "{{aws_region}}" + + control_plane { + aws_services_authentication { + role_arn = "arn:aws:iam::{{aws_account_id}}:role/{{byo_multicloud_prefix}}-1p-dev-oneplatform" + role_session_name = "{{byo_multicloud_prefix}}-1p-dev-session" + } + + config_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + database_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + iam_instance_profile = "{{byo_multicloud_prefix}}-1p-dev-controlplane" + subnet_ids = ["{{aws_subnet}}"] + version = "${data.google_container_aws_versions.versions.valid_versions[0]}" + instance_type = "t3.medium" + + main_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + proxy_config { + secret_arn = "arn:aws:secretsmanager:us-west-2:126285863215:secret:proxy_config20210824150329476300000001-ABCDEF" + secret_version = "12345678-ABCD-EFGH-IJKL-987654321098" + } + + root_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + security_group_ids = ["{{aws_security_group}}"] + + ssh_config { + ec2_key_pair = "{{byo_multicloud_prefix}}-1p-dev-ssh" + } + + tags = { + owner = "{{test_service_account}}" + } + } + + fleet { + project = "{{project_number}}" + } + + location = "us-west1" + name = "{{name}}" + + networking { + pod_address_cidr_blocks = ["10.2.0.0/16"] + service_address_cidr_blocks = ["10.1.0.0/16"] + vpc_id = "{{aws_vpc}}" + } + + annotations = { + label-two = "value-two" + } + + description = "An updated sample aws cluster" + project = "{{project}}" +} + diff --git a/tpgtools/overrides/containeraws/samples/nodepool/basic.tf.tmpl b/tpgtools/overrides/containeraws/samples/nodepool/basic.tf.tmpl new file mode 100644 index 000000000000..bbca9e5916f6 --- /dev/null +++ b/tpgtools/overrides/containeraws/samples/nodepool/basic.tf.tmpl @@ -0,0 +1,146 @@ +data "google_container_aws_versions" "versions" { + project = "{{project}}" + location = "us-west1" +} + +resource "google_container_aws_cluster" "primary" { + authorization { + admin_users { + username = "{{test_service_account}}" + } + } + + aws_region = "{{aws_region}}" + + control_plane { + aws_services_authentication { + role_arn = "arn:aws:iam::{{aws_account_id}}:role/{{byo_multicloud_prefix}}-1p-dev-oneplatform" + role_session_name = "{{byo_multicloud_prefix}}-1p-dev-session" + } + + config_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + database_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + iam_instance_profile = "{{byo_multicloud_prefix}}-1p-dev-controlplane" + subnet_ids = ["{{aws_subnet}}"] + version = "${data.google_container_aws_versions.versions.valid_versions[0]}" + instance_type = "t3.medium" + + main_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + proxy_config { + secret_arn = "arn:aws:secretsmanager:us-west-2:126285863215:secret:proxy_config20210824150329476300000001-ABCDEF" + secret_version = "12345678-ABCD-EFGH-IJKL-987654321098" + } + + root_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + security_group_ids = ["{{aws_security_group}}"] + + ssh_config { + ec2_key_pair = "{{byo_multicloud_prefix}}-1p-dev-ssh" + } + + tags = { + owner = "{{test_service_account}}" + } + } + + fleet { + project = "{{project_number}}" + } + + location = "us-west1" + name = "{{name}}" + + networking { + pod_address_cidr_blocks = ["10.2.0.0/16"] + service_address_cidr_blocks = ["10.1.0.0/16"] + vpc_id = "{{aws_vpc}}" + } + + annotations = { + label-one = "value-one" + } + + description = "A sample aws cluster" + project = "{{project}}" +} + + +resource "google_container_aws_node_pool" "primary" { + autoscaling { + max_node_count = 5 + min_node_count = 1 + } + + cluster = google_container_aws_cluster.primary.name + + config { + config_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + iam_instance_profile = "{{byo_multicloud_prefix}}-1p-dev-nodepool" + instance_type = "t3.medium" + + labels = { + label-one = "value-one" + } + + root_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + security_group_ids = ["{{aws_security_group}}"] + + ssh_config { + ec2_key_pair = "{{byo_multicloud_prefix}}-1p-dev-ssh" + } + + tags = { + tag-one = "value-one" + } + + taints { + effect = "PREFER_NO_SCHEDULE" + key = "taint-key" + value = "taint-value" + } + } + + location = "us-west1" + + max_pods_constraint { + max_pods_per_node = 110 + } + + name = "{{node-pool-name}}" + subnet_id = "{{aws_subnet}}" + version = "1.21.3-gke.2001" + + annotations = { + label-one = "value-one" + } + + project = "{{project}}" +} + diff --git a/tpgtools/overrides/containeraws/samples/nodepool/basic.yaml b/tpgtools/overrides/containeraws/samples/nodepool/basic.yaml new file mode 100644 index 000000000000..1a4f78ca5f87 --- /dev/null +++ b/tpgtools/overrides/containeraws/samples/nodepool/basic.yaml @@ -0,0 +1,34 @@ +description: A basic example of a containeraws node pool +name: basic_aws_cluster +type: aws_cluster +updates: +- resource: ./basic_update.tf.tmpl +variables: +- name: byo_multicloud_prefix + type: byo_multicloud_prefix +- name: name + type: resource_name +- name: node-pool-name + type: resource_name +- name: project + type: project +- name: project_number + type: project_number +- name: aws_account_id + type: aws_account_id +- name: aws_volume_encryption_key + type: aws_volume_encryption_key +- name: aws_vpc + type: aws_vpc +- name: aws_database_encryption_key + type: aws_database_encryption_key +- name: aws_security_group + type: aws_security_group +- name: aws_subnet + type: aws_subnet +- name: aws_security_group + type: aws_security_group +- name: aws_region + type: aws_region +- name: test_service_account + type: test_service_account diff --git a/tpgtools/overrides/containeraws/samples/nodepool/basic_update.tf.tmpl b/tpgtools/overrides/containeraws/samples/nodepool/basic_update.tf.tmpl new file mode 100644 index 000000000000..96c59d439f67 --- /dev/null +++ b/tpgtools/overrides/containeraws/samples/nodepool/basic_update.tf.tmpl @@ -0,0 +1,145 @@ +data "google_container_aws_versions" "versions" { + project = "{{project}}" + location = "us-west1" +} + +resource "google_container_aws_cluster" "primary" { + authorization { + admin_users { + username = "{{test_service_account}}" + } + } + + aws_region = "{{aws_region}}" + + control_plane { + aws_services_authentication { + role_arn = "arn:aws:iam::{{aws_account_id}}:role/{{byo_multicloud_prefix}}-1p-dev-oneplatform" + role_session_name = "{{byo_multicloud_prefix}}-1p-dev-session" + } + + config_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + database_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + iam_instance_profile = "{{byo_multicloud_prefix}}-1p-dev-controlplane" + subnet_ids = ["{{aws_subnet}}"] + version = "${data.google_container_aws_versions.versions.valid_versions[0]}" + instance_type = "t3.medium" + + main_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + proxy_config { + secret_arn = "arn:aws:secretsmanager:us-west-2:126285863215:secret:proxy_config20210824150329476300000001-ABCDEF" + secret_version = "12345678-ABCD-EFGH-IJKL-987654321098" + } + + root_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + security_group_ids = ["{{aws_security_group}}"] + + ssh_config { + ec2_key_pair = "{{byo_multicloud_prefix}}-1p-dev-ssh" + } + + tags = { + owner = "{{test_service_account}}" + } + } + + fleet { + project = "{{project_number}}" + } + + location = "us-west1" + name = "{{name}}" + + networking { + pod_address_cidr_blocks = ["10.2.0.0/16"] + service_address_cidr_blocks = ["10.1.0.0/16"] + vpc_id = "{{aws_vpc}}" + } + + annotations = { + label-one = "value-one" + } + + description = "A sample aws cluster" + project = "{{project}}" +} + +resource "google_container_aws_node_pool" "primary" { + autoscaling { + max_node_count = 5 + min_node_count = 1 + } + + cluster = google_container_aws_cluster.primary.name + + config { + config_encryption { + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_database_encryption_key}}" + } + + iam_instance_profile = "{{byo_multicloud_prefix}}-1p-dev-nodepool" + instance_type = "t3.medium" + + labels = { + label-one = "value-one" + } + + root_volume { + iops = 3000 + kms_key_arn = "arn:aws:kms:{{aws_region}}:{{aws_account_id}}:key/{{aws_volume_encryption_key}}" + size_gib = 10 + volume_type = "GP3" + } + + security_group_ids = ["{{aws_security_group}}"] + + ssh_config { + ec2_key_pair = "{{byo_multicloud_prefix}}-1p-dev-ssh" + } + + tags = { + tag-one = "value-one" + } + + taints { + effect = "PREFER_NO_SCHEDULE" + key = "taint-key" + value = "taint-value" + } + } + + location = "us-west1" + + max_pods_constraint { + max_pods_per_node = 110 + } + + name = "{{node-pool-name}}" + subnet_id = "{{aws_subnet}}" + version = "1.21.3-gke.2001" + + annotations = { + label-two = "value-two" + } + + project = "{{project}}" +} + diff --git a/tpgtools/overrides/containeraws/samples/nodepool/meta.yaml b/tpgtools/overrides/containeraws/samples/nodepool/meta.yaml new file mode 100644 index 000000000000..2020260bfb34 --- /dev/null +++ b/tpgtools/overrides/containeraws/samples/nodepool/meta.yaml @@ -0,0 +1,2 @@ +ignore_read: + - fleet.0.project diff --git a/tpgtools/overrides/containerazure/samples/client/basic.tf.tmpl b/tpgtools/overrides/containerazure/samples/client/basic.tf.tmpl new file mode 100644 index 000000000000..4e009497410e --- /dev/null +++ b/tpgtools/overrides/containerazure/samples/client/basic.tf.tmpl @@ -0,0 +1,7 @@ +resource "google_container_azure_client" "primary" { + application_id = "{{azure_app}}" + location = "us-west1" + name = "{{client-name}}" + tenant_id = "{{azure_tenant}}" + project = "{{project}}" +} diff --git a/tpgtools/overrides/containerazure/samples/client/basic.yaml b/tpgtools/overrides/containerazure/samples/client/basic.yaml new file mode 100644 index 000000000000..a68565b78fbd --- /dev/null +++ b/tpgtools/overrides/containerazure/samples/client/basic.yaml @@ -0,0 +1,12 @@ +description: A basic example of a containerazure azure client +name: basic_azure_client +type: client +variables: +- name: client-name + type: resource_name +- name: project + type: project +- name: azure_app + type: azure_application +- name: azure_tenant + type: azure_ad_tenant diff --git a/tpgtools/overrides/containerazure/samples/azureclient/meta.yaml b/tpgtools/overrides/containerazure/samples/client/meta.yaml similarity index 100% rename from tpgtools/overrides/containerazure/samples/azureclient/meta.yaml rename to tpgtools/overrides/containerazure/samples/client/meta.yaml diff --git a/tpgtools/overrides/containerazure/samples/cluster/basic.tf.tmpl b/tpgtools/overrides/containerazure/samples/cluster/basic.tf.tmpl new file mode 100644 index 000000000000..06704dfcae35 --- /dev/null +++ b/tpgtools/overrides/containerazure/samples/cluster/basic.tf.tmpl @@ -0,0 +1,51 @@ +data "google_container_azure_versions" "versions" { + project = "{{project}}" + location = "us-west1" +} + +resource "google_container_azure_cluster" "primary" { + authorization { + admin_users { + username = "mmv2@google.com" + } + } + + azure_region = "westus2" + client = "projects/{{project_number}}/locations/us-west1/azureClients/${google_container_azure_client.basic.name}" + + control_plane { + ssh_config { + authorized_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" + } + + subnet_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default" + version = "${data.google_container_azure_versions.versions.valid_versions[0]}" + tags = {} + } + + fleet { + project = "{{project_number}}" + } + + location = "us-west1" + name = "{{name}}" + + networking { + pod_address_cidr_blocks = ["10.200.0.0/16"] + service_address_cidr_blocks = ["10.32.0.0/24"] + virtual_network_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet" + } + + resource_group_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster" + annotations = {} + project = "{{project}}" +} + +resource "google_container_azure_client" "basic" { + application_id = "{{azure_app}}" + location = "us-west1" + name = "{{client-name}}" + tenant_id = "{{azure_tenant}}" + project = "{{project}}" +} + diff --git a/tpgtools/overrides/containerazure/samples/cluster/basic.yaml b/tpgtools/overrides/containerazure/samples/cluster/basic.yaml new file mode 100644 index 000000000000..7b543e4f97a0 --- /dev/null +++ b/tpgtools/overrides/containerazure/samples/cluster/basic.yaml @@ -0,0 +1,24 @@ +description: A basic example of a containerazure azure cluster +name: basic_azure_cluster +type: azure_cluster +updates: +- resource: ./basic_update.tf.tmpl +variables: +- name: byo_multicloud_prefix + type: byo_multicloud_prefix +- name: azure_subscription + type: azure_subscription +- name: client-name + type: resource_name +- name: name + type: resource_name +- name: project + type: project +- name: project_number + type: project_number +- name: azure_app + type: azure_application +- name: azure_tenant + type: azure_ad_tenant +- name: azure_config_secret + type: azure_proxy_config_secret_version diff --git a/tpgtools/overrides/containerazure/samples/cluster/basic_update.tf.tmpl b/tpgtools/overrides/containerazure/samples/cluster/basic_update.tf.tmpl new file mode 100644 index 000000000000..cbc4f8192df5 --- /dev/null +++ b/tpgtools/overrides/containerazure/samples/cluster/basic_update.tf.tmpl @@ -0,0 +1,79 @@ +resource "google_container_azure_cluster" "primary" { + authorization { + admin_users { + username = "mmv2@google.com" + } + } + + azure_region = "westus2" + client = "projects/{{project_number}}/locations/us-west1/azureClients/${google_container_azure_client.basic.name}" + + control_plane { + ssh_config { + authorized_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" + } + + subnet_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default" + version = "1.21.5-gke.2800" + + database_encryption { + key_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster/providers/Microsoft.KeyVault/vaults/{{byo_multicloud_prefix}}-dev-keyvault/keys/{{byo_multicloud_prefix}}-dev-key" + } + + main_volume { + size_gib = 8 + } + + proxy_config { + resource_group_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster" + secret_id = "https://{{byo_multicloud_prefix}}-dev-keyvault.vault.azure.net/secrets/{{byo_multicloud_prefix}}-dev-secret/{{azure_config_secret}}" + } + + replica_placements { + azure_availability_zone = "1" + subnet_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default" + } + + root_volume { + size_gib = 32 + } + + tags = { + owner = "mmv2" + } + + vm_size = "Standard_DS2_v2" + } + + fleet { + project = "{{project_number}}" + } + + location = "us-west1" + name = "{{name}}" + + networking { + pod_address_cidr_blocks = ["10.200.0.0/16"] + service_address_cidr_blocks = ["10.32.0.0/24"] + virtual_network_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet" + } + + resource_group_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster" + + annotations = { + annotation-one = "value-one" + } + + description = "An updated sample azure cluster" + project = "{{project}}" +} + +resource "google_container_azure_client" "basic" { + application_id = "{{azure_app}}" + location = "us-west1" + name = "{{client-name}}" + tenant_id = "{{azure_tenant}}" + project = "{{project}}" +} + + diff --git a/tpgtools/overrides/containerazure/samples/nodepool/basic.tf.tmpl b/tpgtools/overrides/containerazure/samples/nodepool/basic.tf.tmpl new file mode 100644 index 000000000000..500a781bb19b --- /dev/null +++ b/tpgtools/overrides/containerazure/samples/nodepool/basic.tf.tmpl @@ -0,0 +1,92 @@ +data "google_container_azure_versions" "versions" { + project = "{{project}}" + location = "us-west1" +} + +resource "google_container_azure_cluster" "primary" { + authorization { + admin_users { + username = "mmv2@google.com" + } + } + + azure_region = "westus2" + client = "projects/{{project_number}}/locations/us-west1/azureClients/${google_container_azure_client.basic.name}" + + control_plane { + ssh_config { + authorized_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" + } + + subnet_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default" + version = "${data.google_container_azure_versions.versions.valid_versions[0]}" + tags = {} + } + + fleet { + project = "{{project_number}}" + } + + location = "us-west1" + name = "{{name}}" + + networking { + pod_address_cidr_blocks = ["10.200.0.0/16"] + service_address_cidr_blocks = ["10.32.0.0/24"] + virtual_network_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet" + } + + resource_group_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster" + annotations = {} + project = "{{project}}" +} + +resource "google_container_azure_client" "basic" { + application_id = "{{azure_app}}" + location = "us-west1" + name = "{{client-name}}" + tenant_id = "{{azure_tenant}}" + project = "{{project}}" +} + +resource "google_container_azure_node_pool" "primary" { + autoscaling { + max_node_count = 3 + min_node_count = 2 + } + + cluster = google_container_azure_cluster.primary.name + + config { + ssh_config { + authorized_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" + } + + root_volume { + size_gib = 32 + } + + tags = { + owner = "mmv2" + } + + vm_size = "Standard_DS2_v2" + } + + location = "us-west1" + + max_pods_constraint { + max_pods_per_node = 110 + } + + name = "{{node-pool-name}}" + subnet_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default" + version = "${data.google_container_azure_versions.versions.valid_versions[0]}" + + annotations = { + annotation-one = "value-one" + } + + project = "{{project}}" +} + diff --git a/tpgtools/overrides/containerazure/samples/nodepool/basic.yaml b/tpgtools/overrides/containerazure/samples/nodepool/basic.yaml new file mode 100644 index 000000000000..fabaa90c0ded --- /dev/null +++ b/tpgtools/overrides/containerazure/samples/nodepool/basic.yaml @@ -0,0 +1,26 @@ +description: A basic example of a containerazure azure node pool +name: basic_azure_node_pool +type: azure_node_pool +updates: +- resource: ./basic_update.tf.tmpl +variables: +- name: byo_multicloud_prefix + type: byo_multicloud_prefix +- name: azure_subscription + type: azure_subscription +- name: node-pool-name + type: resource_name +- name: client-name + type: resource_name +- name: name + type: resource_name +- name: project + type: project +- name: project_number + type: project_number +- name: azure_app + type: azure_application +- name: azure_tenant + type: azure_ad_tenant +- name: azure_config_secret + type: azure_proxy_config_secret_version diff --git a/tpgtools/overrides/containerazure/samples/nodepool/basic_update.tf.tmpl b/tpgtools/overrides/containerazure/samples/nodepool/basic_update.tf.tmpl new file mode 100644 index 000000000000..70628ecf67aa --- /dev/null +++ b/tpgtools/overrides/containerazure/samples/nodepool/basic_update.tf.tmpl @@ -0,0 +1,93 @@ +data "google_container_azure_versions" "versions" { + project = "{{project}}" + location = "us-west1" +} + + +resource "google_container_azure_cluster" "primary" { + authorization { + admin_users { + username = "mmv2@google.com" + } + } + + azure_region = "westus2" + client = "projects/{{project_number}}/locations/us-west1/azureClients/${google_container_azure_client.basic.name}" + + control_plane { + ssh_config { + authorized_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" + } + + subnet_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default" + version = "${data.google_container_azure_versions.versions.valid_versions[0]}" + tags = {} + } + + fleet { + project = "{{project_number}}" + } + + location = "us-west1" + name = "{{name}}" + + networking { + pod_address_cidr_blocks = ["10.200.0.0/16"] + service_address_cidr_blocks = ["10.32.0.0/24"] + virtual_network_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet" + } + + resource_group_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-cluster" + annotations = {} + project = "{{project}}" +} + +resource "google_container_azure_client" "basic" { + application_id = "{{azure_app}}" + location = "us-west1" + name = "{{client-name}}" + tenant_id = "{{azure_tenant}}" + project = "{{project}}" +} + +resource "google_container_azure_node_pool" "primary" { + autoscaling { + max_node_count = 3 + min_node_count = 2 + } + + cluster = google_container_azure_cluster.primary.name + + config { + ssh_config { + authorized_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8yaayO6lnb2v+SedxUMa2c8vtIEzCzBjM3EJJsv8Vm9zUDWR7dXWKoNGARUb2mNGXASvI6mFIDXTIlkQ0poDEPpMaXR0g2cb5xT8jAAJq7fqXL3+0rcJhY/uigQ+MrT6s+ub0BFVbsmGHNrMQttXX9gtmwkeAEvj3mra9e5pkNf90qlKnZz6U0SVArxVsLx07vHPHDIYrl0OPG4zUREF52igbBPiNrHJFDQJT/4YlDMJmo/QT/A1D6n9ocemvZSzhRx15/Arjowhr+VVKSbaxzPtEfY0oIg2SrqJnnr/l3Du5qIefwh5VmCZe4xopPUaDDoOIEFriZ88sB+3zz8ib8sk8zJJQCgeP78tQvXCgS+4e5W3TUg9mxjB6KjXTyHIVhDZqhqde0OI3Fy1UuVzRUwnBaLjBnAwP5EoFQGRmDYk/rEYe7HTmovLeEBUDQocBQKT4Ripm/xJkkWY7B07K/tfo56dGUCkvyIVXKBInCh+dLK7gZapnd4UWkY0xBYcwo1geMLRq58iFTLA2j/JmpmHXp7m0l7jJii7d44uD3tTIFYThn7NlOnvhLim/YcBK07GMGIN7XwrrKZKmxXaspw6KBWVhzuw1UPxctxshYEaMLfFg/bwOw8HvMPr9VtrElpSB7oiOh91PDIPdPBgHCi7N2QgQ5l/ZDBHieSpNrQ== thomasrodgers" + } + + root_volume { + size_gib = 32 + } + + tags = { + owner = "mmv2" + } + + vm_size = "Standard_DS2_v2" + } + + location = "us-west1" + + max_pods_constraint { + max_pods_per_node = 110 + } + + name = "{{node-pool-name}}" + subnet_id = "/subscriptions/{{azure_subscription}}/resourceGroups/{{byo_multicloud_prefix}}-dev-byo/providers/Microsoft.Network/virtualNetworks/{{byo_multicloud_prefix}}-dev-vnet/subnets/default" + version = "1.21.5-gke.2800" + + annotations = { + annotation-two = "value-two" + } + + project = "{{project}}" +} + diff --git a/tpgtools/resource.go b/tpgtools/resource.go index 4d0e11c92b95..f66dfa2a1646 100644 --- a/tpgtools/resource.go +++ b/tpgtools/resource.go @@ -817,6 +817,7 @@ func (r *Resource) loadHandWrittenSamples() []Sample { } if !versionMatch { + glog.Errorf("skipping %q due to no version match", file.Name()) continue } @@ -897,7 +898,6 @@ func (r *Resource) loadDCLSamples() []Sample { if !versionMatch { continue } else if !strings.EqualFold(primaryResourceName, resourceType) { - glog.Errorf("skipping %s since no match with %s.", primaryResourceName, resourceType) continue }