Skip to content

Commit

Permalink
Upgrade DCL to v1.51.0 (#8876) (#15862)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Sep 15, 2023
1 parent 8d489a1 commit e80963c
Show file tree
Hide file tree
Showing 16 changed files with 455 additions and 22 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=
56 changes: 55 additions & 1 deletion google/services/containeraws/resource_container_aws_node_pool.go
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 @@ -214,7 +223,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 @@ -418,6 +426,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 @@ -435,6 +456,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 @@ -492,6 +514,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 @@ -544,6 +567,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 @@ -585,6 +611,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 @@ -637,6 +664,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 @@ -986,3 +1014,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 @@ -272,6 +272,10 @@ resource "google_container_aws_node_pool" "primary" {
label-one = "value-one"
}
management {
auto_repair = true
}
project = "%{project_name}"
}
Expand Down Expand Up @@ -428,6 +432,10 @@ resource "google_container_aws_node_pool" "primary" {
label-two = "value-two"
}
management {
auto_repair = false
}
project = "%{project_name}"
}
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 @@ -301,6 +310,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 @@ -319,6 +341,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 @@ -377,6 +400,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 @@ -432,6 +456,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 @@ -474,6 +501,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 @@ -527,6 +555,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 @@ -743,3 +772,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}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ func TestAccContainerAzureNodePool_BasicHandWritten(t *testing.T) {
Config: testAccContainerAzureNodePool_BasicHandWritten(context),
},
{
ResourceName: "google_container_azure_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_container_azure_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"management.#", "management.0.%", "management.0.auto_repair"},
},
{
Config: testAccContainerAzureNodePool_BasicHandWrittenUpdate0(context),
},
{
ResourceName: "google_container_azure_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ResourceName: "google_container_azure_node_pool.primary",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"management.#", "management.0.%", "management.0.auto_repair"},
},
},
})
Expand Down Expand Up @@ -166,6 +168,10 @@ resource "google_container_azure_node_pool" "primary" {
annotation-one = "value-one"
}
management {
auto_repair = true
}
project = "%{project_name}"
}
Expand Down Expand Up @@ -268,6 +274,10 @@ resource "google_container_azure_node_pool" "primary" {
annotation-two = "value-two"
}
management {
auto_repair = false
}
project = "%{project_name}"
}
Expand Down
Loading

0 comments on commit e80963c

Please sign in to comment.