Skip to content

Commit

Permalink
Upgrade DCL to v1.51.0 (#8876) (#6282)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Sep 15, 2023
1 parent f6de623 commit 7e62e2b
Show file tree
Hide file tree
Showing 16 changed files with 483 additions and 32 deletions.
12 changes: 12 additions & 0 deletions .changelog/8876.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```release-note:enhancement
containeraws: added support for `auto_repair` in `container_aws_node_pool`
```
```release-note:enhancement
containerazure: added support for `auto_repair` in `container_azure_node_pool`
```
```release-note:enhancement
networkconnectivity: added support for `linked_vpc_network` in `network_connectivity_spoke`
```
```release-note:bug
eventarc: field `event_data_content_type` in `eventarc_trigger` now marked as computed
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ go 1.19

require (
cloud.google.com/go/bigtable v1.19.0
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.50.0
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.51.0
github.com/apparentlymart/go-cidr v1.1.0
github.com/davecgh/go-spew v1.1.1
github.com/dnaeon/go-vcr v1.0.1
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+K
cloud.google.com/go/longrunning v0.5.1 h1:Fr7TXftcqTudoyRJa113hyaqlGdiBQkp0Gq7tErFDWI=
cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.50.0 h1:tsuB2FrGmDXIPUdhRD6YdUuvIzAly6+RYpyRkKWwk9E=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.50.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.51.0 h1:YhWTPhOf6gVpA9mSfnLOuL8Y6j8W5pzmHE7flXjTke4=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.51.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
Expand Down Expand Up @@ -466,3 +466,5 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.51.0 h1:YhWTPhOf6gVpA9mSfnLOuL8Y6j8W5pzmHE7flXjTke4=
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.51.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ func ResourceContainerAwsNodePool() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
},

"management": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Description: "The Management configuration for this node pool.",
MaxItems: 1,
Elem: ContainerAwsNodePoolManagementSchema(),
},

"project": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -232,7 +241,6 @@ func ContainerAwsNodePoolConfigSchema() *schema.Resource {
Type: schema.TypeString,
Computed: true,
Optional: true,
ForceNew: true,
Description: "Optional. The AWS instance type. When unspecified, it defaults to `m5.large`.",
},

Expand Down Expand Up @@ -474,6 +482,19 @@ func ContainerAwsNodePoolMaxPodsConstraintSchema() *schema.Resource {
}
}

func ContainerAwsNodePoolManagementSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"auto_repair": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
Description: "Optional. Whether or not the nodes will be automatically repaired.",
},
},
}
}

func resourceContainerAwsNodePoolCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*transport_tpg.Config)
project, err := tpgresource.GetProject(d, config)
Expand All @@ -491,6 +512,7 @@ func resourceContainerAwsNodePoolCreate(d *schema.ResourceData, meta interface{}
SubnetId: dcl.String(d.Get("subnet_id").(string)),
Version: dcl.String(d.Get("version").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("annotations")),
Management: expandContainerAwsNodePoolManagement(d.Get("management")),
Project: dcl.String(project),
}

Expand Down Expand Up @@ -548,6 +570,7 @@ func resourceContainerAwsNodePoolRead(d *schema.ResourceData, meta interface{})
SubnetId: dcl.String(d.Get("subnet_id").(string)),
Version: dcl.String(d.Get("version").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("annotations")),
Management: expandContainerAwsNodePoolManagement(d.Get("management")),
Project: dcl.String(project),
}

Expand Down Expand Up @@ -600,6 +623,9 @@ func resourceContainerAwsNodePoolRead(d *schema.ResourceData, meta interface{})
if err = d.Set("annotations", res.Annotations); err != nil {
return fmt.Errorf("error setting annotations in state: %s", err)
}
if err = d.Set("management", tpgresource.FlattenContainerAwsNodePoolManagement(res.Management, d, config)); err != nil {
return fmt.Errorf("error setting management in state: %s", err)
}
if err = d.Set("project", res.Project); err != nil {
return fmt.Errorf("error setting project in state: %s", err)
}
Expand Down Expand Up @@ -641,6 +667,7 @@ func resourceContainerAwsNodePoolUpdate(d *schema.ResourceData, meta interface{}
SubnetId: dcl.String(d.Get("subnet_id").(string)),
Version: dcl.String(d.Get("version").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("annotations")),
Management: expandContainerAwsNodePoolManagement(d.Get("management")),
Project: dcl.String(project),
}
directive := tpgdclresource.UpdateDirective
Expand Down Expand Up @@ -693,6 +720,7 @@ func resourceContainerAwsNodePoolDelete(d *schema.ResourceData, meta interface{}
SubnetId: dcl.String(d.Get("subnet_id").(string)),
Version: dcl.String(d.Get("version").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("annotations")),
Management: expandContainerAwsNodePoolManagement(d.Get("management")),
Project: dcl.String(project),
}

Expand Down Expand Up @@ -1100,3 +1128,29 @@ func flattenContainerAwsNodePoolMaxPodsConstraint(obj *containeraws.NodePoolMaxP
return []interface{}{transformed}

}

func expandContainerAwsNodePoolManagement(o interface{}) *containeraws.NodePoolManagement {
if o == nil {
return nil
}
objArr := o.([]interface{})
if len(objArr) == 0 || objArr[0] == nil {
return nil
}
obj := objArr[0].(map[string]interface{})
return &containeraws.NodePoolManagement{
AutoRepair: dcl.Bool(obj["auto_repair"].(bool)),
}
}

func flattenContainerAwsNodePoolManagement(obj *containeraws.NodePoolManagement) interface{} {
if obj == nil || obj.Empty() {
return nil
}
transformed := map[string]interface{}{
"auto_repair": obj.AutoRepair,
}

return []interface{}{transformed}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestAccContainerAwsNodePool_BasicHandWritten(t *testing.T) {
ResourceName: "google_container_aws_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"fleet.0.project"},
ImportStateVerifyIgnore: []string{"fleet.0.project", "management.#", "management.0.%", "management.0.auto_repair"},
},
{
Config: testAccContainerAwsNodePool_BasicHandWrittenUpdate0(context),
Expand All @@ -72,7 +72,7 @@ func TestAccContainerAwsNodePool_BasicHandWritten(t *testing.T) {
ResourceName: "google_container_aws_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"fleet.0.project"},
ImportStateVerifyIgnore: []string{"fleet.0.project", "management.#", "management.0.%", "management.0.auto_repair"},
},
},
})
Expand Down Expand Up @@ -107,7 +107,7 @@ func TestAccContainerAwsNodePool_BasicEnumHandWritten(t *testing.T) {
ResourceName: "google_container_aws_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"fleet.0.project"},
ImportStateVerifyIgnore: []string{"fleet.0.project", "management.#", "management.0.%", "management.0.auto_repair"},
},
{
Config: testAccContainerAwsNodePool_BasicEnumHandWrittenUpdate0(context),
Expand All @@ -116,7 +116,7 @@ func TestAccContainerAwsNodePool_BasicEnumHandWritten(t *testing.T) {
ResourceName: "google_container_aws_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"fleet.0.project"},
ImportStateVerifyIgnore: []string{"fleet.0.project", "management.#", "management.0.%", "management.0.auto_repair"},
},
},
})
Expand Down Expand Up @@ -152,7 +152,7 @@ func TestAccContainerAwsNodePool_BetaBasicHandWritten(t *testing.T) {
ResourceName: "google_container_aws_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"fleet.0.project"},
ImportStateVerifyIgnore: []string{"fleet.0.project", "management.#", "management.0.%", "management.0.auto_repair"},
},
{
Config: testAccContainerAwsNodePool_BetaBasicHandWrittenUpdate0(context),
Expand All @@ -161,7 +161,7 @@ func TestAccContainerAwsNodePool_BetaBasicHandWritten(t *testing.T) {
ResourceName: "google_container_aws_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"fleet.0.project"},
ImportStateVerifyIgnore: []string{"fleet.0.project", "management.#", "management.0.%", "management.0.auto_repair"},
},
},
})
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestAccContainerAwsNodePool_BetaBasicEnumHandWritten(t *testing.T) {
ResourceName: "google_container_aws_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"fleet.0.project"},
ImportStateVerifyIgnore: []string{"fleet.0.project", "management.#", "management.0.%", "management.0.auto_repair"},
},
{
Config: testAccContainerAwsNodePool_BetaBasicEnumHandWrittenUpdate0(context),
Expand All @@ -206,7 +206,7 @@ func TestAccContainerAwsNodePool_BetaBasicEnumHandWritten(t *testing.T) {
ResourceName: "google_container_aws_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"fleet.0.project"},
ImportStateVerifyIgnore: []string{"fleet.0.project", "management.#", "management.0.%", "management.0.auto_repair"},
},
},
})
Expand Down Expand Up @@ -362,6 +362,10 @@ resource "google_container_aws_node_pool" "primary" {
label-one = "value-one"
}
management {
auto_repair = true
}
project = "%{project_name}"
}
Expand Down Expand Up @@ -518,6 +522,10 @@ resource "google_container_aws_node_pool" "primary" {
label-two = "value-two"
}
management {
auto_repair = false
}
project = "%{project_name}"
}
Expand Down Expand Up @@ -992,6 +1000,10 @@ resource "google_container_aws_node_pool" "primary" {
name = "tf-test-node-pool-name%{random_suffix}"
subnet_id = "%{aws_subnet}"
version = "${data.google_container_aws_versions.versions.valid_versions[0]}"
management {
auto_repair = true
}
annotations = {
label-one = "value-one"
Expand Down Expand Up @@ -1158,6 +1170,10 @@ resource "google_container_aws_node_pool" "primary" {
subnet_id = "%{aws_subnet}"
version = "${data.google_container_aws_versions.versions.valid_versions[0]}"
management {
auto_repair = false
}
annotations = {
label-two = "value-two"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ func ResourceContainerAzureNodePool() *schema.Resource {
Description: "Optional. The Azure availability zone of the nodes in this nodepool. When unspecified, it defaults to `1`.",
},

"management": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Description: "The Management configuration for this node pool.",
MaxItems: 1,
Elem: ContainerAzureNodePoolManagementSchema(),
},

"project": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -309,6 +318,19 @@ func ContainerAzureNodePoolMaxPodsConstraintSchema() *schema.Resource {
}
}

func ContainerAzureNodePoolManagementSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"auto_repair": {
Type: schema.TypeBool,
Computed: true,
Optional: true,
Description: "Optional. Whether or not the nodes will be automatically repaired.",
},
},
}
}

func resourceContainerAzureNodePoolCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*transport_tpg.Config)
project, err := tpgresource.GetProject(d, config)
Expand All @@ -327,6 +349,7 @@ func resourceContainerAzureNodePoolCreate(d *schema.ResourceData, meta interface
Version: dcl.String(d.Get("version").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("annotations")),
AzureAvailabilityZone: dcl.StringOrNil(d.Get("azure_availability_zone").(string)),
Management: expandContainerAzureNodePoolManagement(d.Get("management")),
Project: dcl.String(project),
}

Expand Down Expand Up @@ -385,6 +408,7 @@ func resourceContainerAzureNodePoolRead(d *schema.ResourceData, meta interface{}
Version: dcl.String(d.Get("version").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("annotations")),
AzureAvailabilityZone: dcl.StringOrNil(d.Get("azure_availability_zone").(string)),
Management: expandContainerAzureNodePoolManagement(d.Get("management")),
Project: dcl.String(project),
}

Expand Down Expand Up @@ -440,6 +464,9 @@ func resourceContainerAzureNodePoolRead(d *schema.ResourceData, meta interface{}
if err = d.Set("azure_availability_zone", res.AzureAvailabilityZone); err != nil {
return fmt.Errorf("error setting azure_availability_zone in state: %s", err)
}
if err = d.Set("management", tpgresource.FlattenContainerAzureNodePoolManagement(res.Management, d, config)); err != nil {
return fmt.Errorf("error setting management in state: %s", err)
}
if err = d.Set("project", res.Project); err != nil {
return fmt.Errorf("error setting project in state: %s", err)
}
Expand Down Expand Up @@ -482,6 +509,7 @@ func resourceContainerAzureNodePoolUpdate(d *schema.ResourceData, meta interface
Version: dcl.String(d.Get("version").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("annotations")),
AzureAvailabilityZone: dcl.StringOrNil(d.Get("azure_availability_zone").(string)),
Management: expandContainerAzureNodePoolManagement(d.Get("management")),
Project: dcl.String(project),
}
directive := tpgdclresource.UpdateDirective
Expand Down Expand Up @@ -535,6 +563,7 @@ func resourceContainerAzureNodePoolDelete(d *schema.ResourceData, meta interface
Version: dcl.String(d.Get("version").(string)),
Annotations: tpgresource.CheckStringMap(d.Get("annotations")),
AzureAvailabilityZone: dcl.StringOrNil(d.Get("azure_availability_zone").(string)),
Management: expandContainerAzureNodePoolManagement(d.Get("management")),
Project: dcl.String(project),
}

Expand Down Expand Up @@ -753,3 +782,29 @@ func flattenContainerAzureNodePoolMaxPodsConstraint(obj *containerazure.NodePool
return []interface{}{transformed}

}

func expandContainerAzureNodePoolManagement(o interface{}) *containerazure.NodePoolManagement {
if o == nil {
return nil
}
objArr := o.([]interface{})
if len(objArr) == 0 || objArr[0] == nil {
return nil
}
obj := objArr[0].(map[string]interface{})
return &containerazure.NodePoolManagement{
AutoRepair: dcl.Bool(obj["auto_repair"].(bool)),
}
}

func flattenContainerAzureNodePoolManagement(obj *containerazure.NodePoolManagement) interface{} {
if obj == nil || obj.Empty() {
return nil
}
transformed := map[string]interface{}{
"auto_repair": obj.AutoRepair,
}

return []interface{}{transformed}

}
Loading

0 comments on commit 7e62e2b

Please sign in to comment.