Skip to content

Commit

Permalink
fix: k8 fromstate (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCoelhoo authored Jun 10, 2022
1 parent c501d30 commit bde3a1b
Show file tree
Hide file tree
Showing 5 changed files with 356 additions and 343 deletions.
6 changes: 6 additions & 0 deletions resources/types/aws/kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ func (r AwsKubernetesCluster) FromState(state *output.TfState) (*resourcespb.Kub
result.KubeConfigRaw = kubeCgfRaw
}

var err error
result.DefaultNodePool, err = AwsKubernetesNodePool{r.DefaultNodePool}.FromState(state)
if err != nil {
return nil, err
}

return result, nil
}

Expand Down
6 changes: 6 additions & 0 deletions resources/types/azure/kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ func (r AzureKubernetesCluster) FromState(state *output.TfState) (*resourcespb.K
result.KubeConfigRaw = values["kube_config_raw"].(string)
}

var err error
result.DefaultNodePool, err = AzureKubernetesNodePool{r.DefaultNodePool}.FromState(state)
if err != nil {
return nil, err
}

return result, nil
}

Expand Down
142 changes: 71 additions & 71 deletions test/_configs/network_interface/network_interface/config.textproto
Original file line number Diff line number Diff line change
@@ -1,103 +1,103 @@
resources: {
resource_id: "example_vn_azure"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.VirtualNetworkArgs]: {
common_parameters: {
resource_group_id: "rg1"
location: EU_WEST_1
cloud_provider: AZURE
resources: {
resource_id: "example_vn_azure"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.VirtualNetworkArgs]: {
common_parameters: {
resource_group_id: "rg1"
location: EU_WEST_1
cloud_provider: AZURE
}
name: "example_vn"
cidr_block: "10.0.0.0/16"
name: "example_vn"
cidr_block: "10.0.0.0/16"
}
}
}
}
resources: {
resource_id: "example_vn_aws"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.VirtualNetworkArgs]: {
common_parameters: {
resource_group_id: "rg1"
location: EU_WEST_1
cloud_provider: AWS
resources: {
resource_id: "example_vn_aws"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.VirtualNetworkArgs]: {
common_parameters: {
resource_group_id: "rg1"
location: EU_WEST_1
cloud_provider: AWS
}
name: "example_vn"
cidr_block: "10.0.0.0/16"
name: "example_vn"
cidr_block: "10.0.0.0/16"
}
}
}
}
resources: {
resource_id: "subnet_aws"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.SubnetArgs]: {
name: "subnet"
cidr_block: "10.0.2.0/24"
virtual_network_id: "example_vn_aws"
availability_zone: 2
resources: {
resource_id: "subnet_aws"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.SubnetArgs]: {
name: "subnet"
cidr_block: "10.0.2.0/24"
virtual_network_id: "example_vn_aws"
availability_zone: 2
}
}
}
}
resources: {
resource_id: "subnet_azure"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.SubnetArgs]: {
name: "subnet"
cidr_block: "10.0.2.0/24"
virtual_network_id: "example_vn_azure"
availability_zone: 2
resources: {
resource_id: "subnet_azure"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.SubnetArgs]: {
name: "subnet"
cidr_block: "10.0.2.0/24"
virtual_network_id: "example_vn_azure"
availability_zone: 2
}
}
}
}
resources: {
resource_id: "nic_azure"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.NetworkInterfaceArgs]: {
common_parameters: {
resource_group_id: "rg1"
location: EU_WEST_1
cloud_provider: AZURE
resources: {
resource_id: "nic_azure"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.NetworkInterfaceArgs]: {
common_parameters: {
resource_group_id: "rg1"
location: EU_WEST_1
cloud_provider: AZURE
}
name: "test-nic"
subnet_id: "subnet_azure"
name: "test-nic"
subnet_id: "subnet_azure"
}
}
}
}
resources: {
resource_id: "nic_aws"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.NetworkInterfaceArgs]: {
common_parameters: {
resource_group_id: "rg1"
location: EU_WEST_1
cloud_provider: AWS
resources: {
resource_id: "nic_aws"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.NetworkInterfaceArgs]: {
common_parameters: {
resource_group_id: "rg1"
location: EU_WEST_1
cloud_provider: AWS
}
name: "test-nic"
subnet_id: "subnet_aws"
name: "test-nic"
subnet_id: "subnet_aws"
}
}
}
}
resources: {
resource_id: "rg1"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.ResourceGroupArgs]: {
common_parameters: {
location: EU_WEST_1
cloud_provider: AZURE
resources: {
resource_id: "rg1"
resource_args: {
resource_args: {
[type.googleapis.com/dev.multy.resources.ResourceGroupArgs]: {
common_parameters: {
location: EU_WEST_1
cloud_provider: AZURE
}
name: "rg1"
name: "rg1"
}
}
}
Expand Down
Loading

0 comments on commit bde3a1b

Please sign in to comment.