terraform: always output node cidr (#2481)

* terraform: always output node cidr
This commit is contained in:
3u13r 2023-10-23 15:06:48 +02:00 committed by GitHub
parent 5d640ff4f9
commit e053d1fa71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 74 additions and 46 deletions

View file

@ -106,6 +106,9 @@ type Infrastructure struct {
// Name used in the cluster's named resources.
Name string `yaml:"name"`
// description: |
// CIDR range of the cluster's nodes.
IPCidrNode string `yaml:"ipCidrNode"`
// description: |
// Values specific to a Constellation cluster running on Azure.
Azure *Azure `yaml:"azure,omitempty"`
// description: |
@ -119,9 +122,6 @@ type GCP struct {
// Project ID of the GCP project the cluster is running in.
ProjectID string `yaml:"projectID"`
// description: |
// CIDR range of the cluster's nodes.
IPCidrNode string `yaml:"ipCidrNode"`
// description: |
// CIDR range of the cluster's pods.
IPCidrPod string `yaml:"ipCidrPod"`
}

View file

@ -74,7 +74,7 @@ func init() {
FieldName: "infrastructure",
},
}
InfrastructureDoc.Fields = make([]encoder.Doc, 8)
InfrastructureDoc.Fields = make([]encoder.Doc, 9)
InfrastructureDoc.Fields[0].Name = "uid"
InfrastructureDoc.Fields[0].Type = "string"
InfrastructureDoc.Fields[0].Note = ""
@ -105,16 +105,21 @@ func init() {
InfrastructureDoc.Fields[5].Note = ""
InfrastructureDoc.Fields[5].Description = "Name used in the cluster's named resources."
InfrastructureDoc.Fields[5].Comments[encoder.LineComment] = "Name used in the cluster's named resources."
InfrastructureDoc.Fields[6].Name = "azure"
InfrastructureDoc.Fields[6].Type = "Azure"
InfrastructureDoc.Fields[6].Name = "ipCidrNode"
InfrastructureDoc.Fields[6].Type = "string"
InfrastructureDoc.Fields[6].Note = ""
InfrastructureDoc.Fields[6].Description = "Values specific to a Constellation cluster running on Azure."
InfrastructureDoc.Fields[6].Comments[encoder.LineComment] = "Values specific to a Constellation cluster running on Azure."
InfrastructureDoc.Fields[7].Name = "gcp"
InfrastructureDoc.Fields[7].Type = "GCP"
InfrastructureDoc.Fields[6].Description = "CIDR range of the cluster's nodes."
InfrastructureDoc.Fields[6].Comments[encoder.LineComment] = "CIDR range of the cluster's nodes."
InfrastructureDoc.Fields[7].Name = "azure"
InfrastructureDoc.Fields[7].Type = "Azure"
InfrastructureDoc.Fields[7].Note = ""
InfrastructureDoc.Fields[7].Description = "Values specific to a Constellation cluster running on GCP."
InfrastructureDoc.Fields[7].Comments[encoder.LineComment] = "Values specific to a Constellation cluster running on GCP."
InfrastructureDoc.Fields[7].Description = "Values specific to a Constellation cluster running on Azure."
InfrastructureDoc.Fields[7].Comments[encoder.LineComment] = "Values specific to a Constellation cluster running on Azure."
InfrastructureDoc.Fields[8].Name = "gcp"
InfrastructureDoc.Fields[8].Type = "GCP"
InfrastructureDoc.Fields[8].Note = ""
InfrastructureDoc.Fields[8].Description = "Values specific to a Constellation cluster running on GCP."
InfrastructureDoc.Fields[8].Comments[encoder.LineComment] = "Values specific to a Constellation cluster running on GCP."
GCPDoc.Type = "GCP"
GCPDoc.Comments[encoder.LineComment] = "GCP describes the infra state related to GCP."
@ -125,22 +130,17 @@ func init() {
FieldName: "gcp",
},
}
GCPDoc.Fields = make([]encoder.Doc, 3)
GCPDoc.Fields = make([]encoder.Doc, 2)
GCPDoc.Fields[0].Name = "projectID"
GCPDoc.Fields[0].Type = "string"
GCPDoc.Fields[0].Note = ""
GCPDoc.Fields[0].Description = "Project ID of the GCP project the cluster is running in."
GCPDoc.Fields[0].Comments[encoder.LineComment] = "Project ID of the GCP project the cluster is running in."
GCPDoc.Fields[1].Name = "ipCidrNode"
GCPDoc.Fields[1].Name = "ipCidrPod"
GCPDoc.Fields[1].Type = "string"
GCPDoc.Fields[1].Note = ""
GCPDoc.Fields[1].Description = "CIDR range of the cluster's nodes."
GCPDoc.Fields[1].Comments[encoder.LineComment] = "CIDR range of the cluster's nodes."
GCPDoc.Fields[2].Name = "ipCidrPod"
GCPDoc.Fields[2].Type = "string"
GCPDoc.Fields[2].Note = ""
GCPDoc.Fields[2].Description = "CIDR range of the cluster's pods."
GCPDoc.Fields[2].Comments[encoder.LineComment] = "CIDR range of the cluster's pods."
GCPDoc.Fields[1].Description = "CIDR range of the cluster's pods."
GCPDoc.Fields[1].Comments[encoder.LineComment] = "CIDR range of the cluster's pods."
AzureDoc.Type = "Azure"
AzureDoc.Comments[encoder.LineComment] = "Azure describes the infra state related to Azure."

View file

@ -29,6 +29,7 @@ func defaultState() *State {
"api-server-cert-san-test",
"api-server-cert-san-test-2",
},
IPCidrNode: "test-cidr-node",
Azure: &Azure{
ResourceGroup: "test-rg",
SubscriptionID: "test-sub",
@ -38,9 +39,8 @@ func defaultState() *State {
AttestationURL: "test-maaUrl",
},
GCP: &GCP{
ProjectID: "test-project",
IPCidrNode: "test-cidr-node",
IPCidrPod: "test-cidr-pod",
ProjectID: "test-project",
IPCidrPod: "test-cidr-pod",
},
},
ClusterValues: ClusterValues{