You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by "shwstppr (via GitHub)" <gi...@apache.org> on 2025/08/27 11:11:33 UTC

[PR] serviceoffering: add params for custom offering, storage tags, encryptroot [cloudstack-terraform-provider]

shwstppr opened a new pull request, #212:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/212

   Fixes #182 
   
   Adds params for Custom offerings. Constrained custom offerings allow min/max values for CPU and memory. Also adds params for encrypt root and storage tags.
   
   New params added,
   - min_cpu_number
   - max_cpu_number
   - min_memory
   - max_memory
   - encrypt_root
   - storage_tags


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] serviceoffering: add params for custom offering, storage tags, encryptroot [cloudstack-terraform-provider]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 commented on PR #212:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/212#issuecomment-3228792070

   @shwstppr Acceptance tests are failing. Please check.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] serviceoffering: add params for custom offering, storage tags, encryptroot [cloudstack-terraform-provider]

Posted by "vishesh92 (via GitHub)" <gi...@apache.org>.
vishesh92 merged PR #212:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/212


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] serviceoffering: add params for custom offering, storage tags, encryptroot [cloudstack-terraform-provider]

Posted by "CodeBleu (via GitHub)" <gi...@apache.org>.
CodeBleu commented on PR #212:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/212#issuecomment-3234777719

   @vishesh92 @shwstppr I see this service offering changes were merged, but why are we not moving forward with [this](https://github.com/apache/cloudstack-terraform-provider/pull/138)?  It has some significant changes in it , and the new way of creating these resources going forward


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] serviceoffering: add params for custom offering, storage tags, encryptroot [cloudstack-terraform-provider]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #212:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/212#discussion_r2303678254


##########
cloudstack/resource_cloudstack_service_offering.go:
##########
@@ -177,6 +248,53 @@ func resourceCloudStackServiceOfferingRead(d *schema.ResourceData, meta interfac
 		"memory":        s.Memory,
 		"offer_ha":      s.Offerha,
 		"storage_type":  s.Storagetype,
+		"customized":    s.Iscustomized,
+		"min_cpu_number": func() interface{} {
+			if s.Serviceofferingdetails == nil {
+				return nil
+			}
+			if v, ok := s.Serviceofferingdetails["mincpunumber"]; ok {
+				if i, err := strconv.Atoi(v); err == nil {
+					return i
+				}
+			}
+			return nil
+		}(),
+		"max_cpu_number": func() interface{} {
+			if s.Serviceofferingdetails == nil {
+				return nil
+			}
+			if v, ok := s.Serviceofferingdetails["maxcpunumber"]; ok {
+				if i, err := strconv.Atoi(v); err == nil {
+					return i
+				}
+			}
+			return nil
+		}(),
+		"min_memory": func() interface{} {
+			if s.Serviceofferingdetails == nil {
+				return nil
+			}
+			if v, ok := s.Serviceofferingdetails["minmemory"]; ok {
+				if i, err := strconv.Atoi(v); err == nil {
+					return i
+				}
+			}
+			return nil
+		}(),
+		"max_memory": func() interface{} {
+			if s.Serviceofferingdetails == nil {
+				return nil
+			}
+			if v, ok := s.Serviceofferingdetails["maxmemory"]; ok {
+				if i, err := strconv.Atoi(v); err == nil {
+					return i
+				}
+			}
+			return nil
+		}(),

Review Comment:
   The repeated pattern for extracting integer values from Serviceofferingdetails creates code duplication. Consider extracting this logic into a helper function like `getIntFromDetails(details map[string]string, key string) interface{}`.
   ```suggestion
   		"min_cpu_number": getIntFromDetails(s.Serviceofferingdetails, "mincpunumber"),
   		"max_cpu_number": getIntFromDetails(s.Serviceofferingdetails, "maxcpunumber"),
   		"min_memory":     getIntFromDetails(s.Serviceofferingdetails, "minmemory"),
   		"max_memory":     getIntFromDetails(s.Serviceofferingdetails, "maxmemory"),
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org