-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add support for regional secret resource google_secret_manager_regional_secret
#11678
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 support for regional secret resource google_secret_manager_regional_secret
#11678
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
aceb2d5
to
f3ed8a0
Compare
3d69eba
to
cebddcc
Compare
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @hao-nan-li, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
# limitations under the License. | ||
-%> | ||
// As the API expects only one of ttl or expireTime | ||
if d.HasChange("ttl") && !d.HasChange("expire_time") { |
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.
Shouldn't there be an opposite condition here:
To remove ttl if expiry_time is introduced in the update.
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.
As the API expects only one of the ttl
or expireTime
field, I've added this condition for switching between ttl and expireTime field. I've confirmed this behaviour and I've also added respective test case for the same. This test case can be found here: https://github.com/GoogleCloudPlatform/magic-modules/pull/11678/files#diff-11e793af43830f42f81e70d049956097a6df58b14f018cb62e7f1727f2bcd211R407
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.
We should add a test case to prove it.
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.
Yeah I've already added the test case that handles the switching between these fields.
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.
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
-%> | ||
// As the API expects only one of ttl or expireTime |
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.
Corresponding Secrets files seems to be doing a bit more than this:
https://github.com/gptSanyam/magic-modules/blob/main/mmv1/templates/terraform/pre_update/secret_manager_secret.go.erb
Let's make a list of things it is doing and then reason about what needs to be removed for regional secrets.
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.
Sure.
The corresponding file does two tasks:
- To enable the updation of
replication
field explicitly and updating the updateMask and ultimately the url to incorporate the changes in updateMask. - To handle the behaviour of ttl and expireTime as mentioned in the comment (Add support for regional secret resource
google_secret_manager_regional_secret
#11678 (comment))
In regional secrets, there is no field for replication
that requires explicit handling for updation. Hence, I need to only handle the ttl and expireTime scenario
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.
Got it. Thanks.
@@ -616,6 +616,11 @@ var ServicesListBeta = mapOf( | |||
"displayName" to "Secretmanager", | |||
"path" to "./google-beta/services/secretmanager" | |||
), | |||
"secretmanagerregional" to mapOf( | |||
"name" to "secretmanagerregional", | |||
"displayName" to "Secretmanagerregional", |
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.
Why is this needed?
We are setting displayName = Secrets Manager in products.yaml, is this an override.
I think this is the name used in the terrafrom registry to list the products, we want both regional and non-regional resources to be listed under the same listing.
https://github.com/GoogleCloudPlatform/magic-modules/pull/11678/files#diff-c1cff9a2fbc2183ca2638f5cc05943ff90a42751de6dad07cece718f78bf9fe3R16
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.
Verified, existing resources like IAM are also adding this.
@@ -611,6 +611,11 @@ var ServicesListGa = mapOf( | |||
"displayName" to "Secretmanager", | |||
"path" to "./google/services/secretmanager" | |||
), | |||
"secretmanagerregional" to mapOf( | |||
"name" to "secretmanagerregional", | |||
"displayName" to "Secretmanagerregional", |
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.
Same as beta.
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.
The Action for teamcity was failing regarding this. Before I've added this snippet, the workflow was failing: https://github.com/GoogleCloudPlatform/magic-modules/actions/runs/10806885008/job/29976554704. I am not sure if we need to add this snippet.
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.
Verified, existing resources like IAM are also adding this.
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.
LGTM
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 4018 Click here to see the affected service packages
Tests were added that are skipped in VCR:
Action takenFound 25 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made. Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer. |
I think that |
I don't think that test is affected by your change. |
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 for adding the new resource in
Add support for new regional secret resource
google_secret_manager_regional_secret
. I have also defined theiam_policy
field in the RegionalSecret.yaml file to include the IAM resources and IAM datasources as well.More info about regional secrets: https://cloud.google.com/secret-manager/docs/regional-secrets-overview
Notes:
RegionalSecret.yaml
file, the versionAliases field is commented and the respective test cases covered in theresource_secret_manager_regional_secret_test.go.erb
file are also commented because this field depends on creating regional_secret_version_resource. We intend to uncomment once this PR is merged and dependent tests can pass.ResourceSecret.yaml
file will be updated later.Release Note Template for Downstream PRs (will be copied)