Skip to content

Commit

Permalink
Merge branch 'main' into do_not_check_region_for_azure_cloud_environment
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsxu authored Dec 7, 2024
2 parents 02dad0e + d6e32bc commit af6e5bf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cloud/resource_cloud_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func resourceCloudEnvironment() *schema.Resource {
"network": {
Type: schema.TypeList,
Required: true,
MaxItems: 1,
Description: descriptions["network"],
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -254,6 +255,16 @@ func resourceCloudEnvironmentCreate(ctx context.Context, d *schema.ResourceData,
return diag.FromErr(fmt.Errorf("ERROR_CREATE_CLOUD_ENVIRONMENT: " + "One of network.id or network.cidr must be set"))
}

if cloudEnvironment.Spec.Network.ID != "" {
cc, err := clientSet.CloudV1alpha1().CloudConnections(namespace).Get(ctx, cloudConnectionName, metav1.GetOptions{})
if err != nil {
return diag.FromErr(err)
}
if cc.Spec.ConnectionType == cloudv1alpha1.ConnectionTypeAzure {
return diag.FromErr(fmt.Errorf("ERROR_CREATE_CLOUD_ENVIRONMENT: Azure doesn't support specify network id yet. Please use network cidr"))
}
}

expandDns := func() error {
for _, l := range dns {
if l == nil {
Expand Down
18 changes: 18 additions & 0 deletions cloud/resource_pulsar_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,38 +106,56 @@ func resourcePulsarCluster() *schema.Resource {
Default: "rapid",
Description: descriptions["release_channel"],
ValidateFunc: validateReleaseChannel,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
},
},
"bookie_replicas": {
Type: schema.TypeInt,
Optional: true,
Default: 3,
Description: descriptions["bookie_replicas"],
ValidateFunc: validateBookieReplicas,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
},
},
"broker_replicas": {
Type: schema.TypeInt,
Optional: true,
Default: 2,
Description: descriptions["broker_replicas"],
ValidateFunc: validateBrokerReplicas,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
},
},
"compute_unit": {
Type: schema.TypeFloat,
Optional: true,
Default: 0.5,
Description: descriptions["compute_unit"],
ValidateFunc: validateCUSU,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
},
},
"storage_unit": {
Type: schema.TypeFloat,
Optional: true,
Default: 0.5,
Description: descriptions["storage_unit"],
ValidateFunc: validateCUSU,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
},
},
"config": {
Type: schema.TypeList,
Optional: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
},
MinItems: 0,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down

0 comments on commit af6e5bf

Please sign in to comment.