-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PhysicalAddress and CapabilitiesManagedBySatellite to Terraform SatelliteLocation for both resource and data-source #5530
Conversation
…ddress and Capabilities
…rraform with Address and Capabilities
…ddress and Capabilities
…AndFrog/terraform-provider-ibm into add_satloc_address_and_capabilities
Add Capabilities tests for Create and Get Satellite Location.
Add capabilities to the tests in satloc_nlb_dns
Add SDK Version, documentation and others
@@ -31,6 +32,18 @@ func DataSourceIBMSatelliteLocation() *schema.Resource { | |||
Computed: true, | |||
Description: "The IBM Cloud metro from which the Satellite location is managed", | |||
}, | |||
"physical_address": { | |||
Type: schema.TypeString, | |||
Optional: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In datasource physical_address
is computed n't optional where user can provide some input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Done
@@ -85,6 +87,8 @@ Review the argument references that you can specify for your resource. | |||
Nested scheme for `cos_credentials`: | |||
- `access_key-id` - (Required, String)The `HMAC` secret access key ID. | |||
- `secret_access_key`- (Optional, String) The `HMAC` secret access key. | |||
- `physical_address` - (Optional, String) The physical address of the new Satellite location which is deployed on premise. | |||
- `capabilities` - (Optional, Array of Strings) Satellite capabilities attached to the location. It is mandatory to add the value 'on-prem' to 'capabilitiesManagedBySatellite', if a value has been set for 'physicalAddress'. On the other hand, value can be added to 'capabilitiesManagedBySatellite' without setting any value to 'physicalAddress'. In other words, 'capabilitiesManagedBySatellite' is optional, unless 'physicalAddress' gets set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description is n't clear what do you mean capabilitiesManagedBySatellite
here
Can you check if you can add any RequiredWith
at schema level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because, in Kubernetes API, capabilities is called capabilitiesManagedBySatellite. Now, I also added the API link with this info to the markdown.
Thanks for the RequiredWith tipp. Also, added RequiredWith-physical_address to capabilities in resource code.
@@ -31,6 +32,18 @@ func DataSourceIBMSatelliteLocation() *schema.Resource { | |||
Computed: true, | |||
Description: "The IBM Cloud metro from which the Satellite location is managed", | |||
}, | |||
"physical_address": { | |||
Type: schema.TypeString, | |||
Optional: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
Optional: true, | |
Computed: true, |
This is a data source and the physical address is not helping to retrieve the resource from the provider. This is meant to be a field that is "read" from the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better if we just not set the physical address and capabilities here, there is no need to test this change in every unrelated test
"physical_address": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "An optional physical address of the new Satellite location which is deployed on premise", | ||
}, | ||
"capabilities": { | ||
Type: schema.TypeSet, | ||
Optional: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
Set: schema.HashString, | ||
Description: "The satellite capabilities attached to the location", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with the API, but in case these can be only set once during create time and not updated we need DiffSuppressFunc: flex.ApplyOnce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right that physical_address and capabilites cannot be changed after creation.
Thanks. Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PhysicalAddress and CapabilitiesManagedBySatellite have been added as new parameters to SatelliteLocationAPIs already. Here, Address has been added to Create and Get APIs, whereas Capabilities has been added to Create, Get and List APIs.
I would like to submit this Pull-Request, in order to extend Address and Capabilities in the resource and data-source methods of Terraform-Provider-IBM for Satellite-Location Create and Get.
Output from acceptance testing:
Resource Test:
![image](https://private-user-images.githubusercontent.com/130282547/352166807-eb822a3f-1a3d-402a-b984-0fde10eddbbb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMTMzODEsIm5iZiI6MTczOTIxMzA4MSwicGF0aCI6Ii8xMzAyODI1NDcvMzUyMTY2ODA3LWViODIyYTNmLTFhM2QtNDAyYS1iOTg0LTBmZGUxMGVkZGJiYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxODQ0NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zNmQ4NjU2YmRkZTY1MTI2MWM0MGYwMTNlNmQ0NjdlN2FhZDI0YmZhYTBhNDlhODU3ZDc0NzIyMDZmNDI2NWNkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ji7k7E9pbcM-x9D9SA5sp9HEtDxGRvBCXdFm7YlsPcY)
![image](https://private-user-images.githubusercontent.com/130282547/352167131-a4faa29b-8ee2-40b9-84a0-d97bfa476c1e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMTMzODEsIm5iZiI6MTczOTIxMzA4MSwicGF0aCI6Ii8xMzAyODI1NDcvMzUyMTY3MTMxLWE0ZmFhMjliLThlZTItNDBiOS04NGEwLWQ5N2JmYTQ3NmMxZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxODQ0NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hMDJhZTI5OGVjYmJhNDAxYzM5NTNjNjg1NzViOGJmNWE2NzhkNzJhOGE3Mjk1ZmU5ZDAyNzRmMDFhMWFkMGIxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.2Q6fi4OVj0gzazuwitcH7KXTA7IQywTBZRLH1Y3WDmM)
In the following test output, some test fail due to coreos_enabled and post-test destroy issues. But the test TestAccSatelliteLocation_PodAndServiceSubnet does pass and does contain the two new parameter of Satellite-Location (physical_address and capabilities) for test. Thus, the two coreos_enabled and post-test destroy issues can be solved post merging the changes from this Pull Request.
https://ibm-argonauts.slack.com/archives/GDAE57ZPA/p1721633692291339?thread_ts=1721042399.405719&cid=GDAE57ZPA
Data-Source Test:
![image](https://private-user-images.githubusercontent.com/130282547/352166969-b8198e77-b6a6-4323-94c6-5e62a9c1528c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMTMzODEsIm5iZiI6MTczOTIxMzA4MSwicGF0aCI6Ii8xMzAyODI1NDcvMzUyMTY2OTY5LWI4MTk4ZTc3LWI2YTYtNDMyMy05NGM2LTVlNjJhOWMxNTI4Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMFQxODQ0NDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NTAyNTJiZTY1OTA5MWVjZWYyOTc1NTIxNTA3MTY4ZDdkZWIyZTNhYzU5MTE4MjRkYmM0ZmMyY2Q3ZjIxNjE2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.TgTFoVSK6bzcXdTv6IYB2xtdk6INoL2cFnLMMjm-tVI)
The data-source tests for physical-address and capabilities do pass:
Community Note