-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add crn parser submodule #2
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
Conversation
/run pipeline |
…-common-utilities into crn-parser
/run pipeline |
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.
Left some comments.
Also can you address these:
- remove the root level tf files
- we dont need an upgrade test do we? we are not creating any resources in the crn parser module
- since there is no root level module, I would move the Usage, Required IAM access policies, and Requirements section to the individual subnmodule readme. And then delete the
terraform-ibm-common-utilities
heading
README.md
Outdated
@@ -20,16 +20,19 @@ For information, see "Module names and descriptions" at | |||
https://terraform-ibm-modules.github.io/documentation/#/implementation-guidelines?id=module-names-and-descriptions | |||
--> | |||
|
|||
TODO: Replace this with a description of the modules in this repo. | |||
This module serves as a repository to hold common Terraform utilities used in other modules in the terraform-ibm-modules organization. |
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 module" seems wrong wording here. There is no root level module. It should probably start with "This repository serves as a ..."
modules/crn-parser/version.tf
Outdated
terraform { | ||
required_version = ">= 1.3.0" | ||
# If your module requires any terraform providers, uncomment the "required_providers" section below and add all required providers. | ||
# Each required provider's version should be a flexible range to future proof the module's usage with upcoming minor and patch versions. |
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 remove the code comments
SKIP UPGRADE TEST because we moved the examples from the basic/advanced to one example for the submodule upgrade test fails
/run pipeline |
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.
final few comments
README.md
Outdated
@@ -20,46 +20,22 @@ For information, see "Module names and descriptions" at | |||
https://terraform-ibm-modules.github.io/documentation/#/implementation-guidelines?id=module-names-and-descriptions | |||
--> | |||
|
|||
TODO: Replace this with a description of the modules in this repo. | |||
This repository serves as a repository to hold common Terraform utilities used in other modules in the terraform-ibm-modules organization. |
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 repository serves as a library" maybe reads batter? - cc @SirSpidey
.github/CODEOWNERS
Outdated
@@ -1,2 +1,2 @@ | |||
# Primary owner should be listed first in list of global owners, followed by any secondary owners | |||
* @SirSpidey @ocofaigh | |||
* @MatthewLemmond |
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.
add a secondary owner
examples/crn-parser/main.tf
Outdated
region = var.region | ||
key_protect_name = "${var.prefix}-kp" | ||
access_tags = var.resource_tags | ||
} |
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 really don't need to provision key protect instance here, or a resource group. It kind of doesn't make sense as a real use case, because that module already supports outputting region, guid etc, so you wouldn't use the CRN parser here.
I suggest that the example just takes in a CRN as a single input variable. In the test we can then pass it a mock CRN value. (it means updating the test to use TestOptionsDefault
instead of TestOptionsDefaultWithVars
)
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.
some style suggestions
README.md
Outdated
@@ -20,46 +20,22 @@ For information, see "Module names and descriptions" at | |||
https://terraform-ibm-modules.github.io/documentation/#/implementation-guidelines?id=module-names-and-descriptions | |||
--> | |||
|
|||
TODO: Replace this with a description of the modules in this repo. | |||
This repository serves as a repository to hold common Terraform utilities used in other modules in the terraform-ibm-modules organization. |
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 repository serves as a repository to hold common Terraform utilities used in other modules in the terraform-ibm-modules organization. | |
Common Terraform utilities that are used in other modules in the terraform-ibm-modules GitHub organization. |
I think you can shorten to get to the core info
README.md
Outdated
|
||
Each utility is placed under the [modules](./modules) directory so they may be individually referenced within a Terraform project, see the [Overview](#overview) section below for a list of available submodules. |
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.
Each utility is placed under the [modules](./modules) directory so they may be individually referenced within a Terraform project, see the [Overview](#overview) section below for a list of available submodules. | |
You can reference any utility in this repo from your Terraform project by pointing to the utility in the [modules](/modules) directory. For a list of available submodules, see the Submodules in the [Overview](#overview) section. |
examples/crn-parser/README.md
Outdated
An example that will provision the following: | ||
|
||
- A new resource group if one is not passed in. | ||
- A new Key Protect instance. | ||
|
||
The output of the example will be the CRN of the Key Protect instance and the parsed fields of the CRN using the CRN parser submodule. |
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.
An example that will provision the following: | |
- A new resource group if one is not passed in. | |
- A new Key Protect instance. | |
The output of the example will be the CRN of the Key Protect instance and the parsed fields of the CRN using the CRN parser submodule. | |
This example provisions the following resources: | |
- A new resource group, if one is not passed in. | |
- A new Key Protect instance. | |
The outputs are the CRN of the Key Protect instance and the fields of the CRN that are parsed by using the CRN parser utility. |
Using utility
instead of submodule to stay consistent with the main readme file.
But it looks like this won't need the KP instance, based on Conall's comment. So readme could have something instead like,
This example takes a CRN as the input. The outputs are the fields of the CRN that are parsed by using the CRN parser utility.
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.
@MatthewLemmond You should use segments
instead of fields for the parts of the CRN to stay internally consistent and consistent with the cloud docs.
examples/crn-parser/version.tf
Outdated
terraform { | ||
required_version = ">= 1.3.0" | ||
|
||
# As the CRN parser does not utilize the IBM Terraform provider, the provider does not need to be locked to any version |
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.
Not critical, but I'd replace As
with Because
to make it easier for non-native English speakers to understand. And replace utilize
with use
.
# As the CRN parser does not utilize the IBM Terraform provider, the provider does not need to be locked to any version | |
# Because the CRN parser doesn't use the IBM Terraform provider, the provider doesn't need to be locked to a version. |
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.
No longer necessary, version.tf is now just the required terraform version and dropped the need for the IBM provider.
modules/crn-parser/README.md
Outdated
@@ -0,0 +1,51 @@ | |||
# Terraform IBM common utilities CRN parser | |||
|
|||
This module takes a CRN string input and returns each of the fields in the provided CRN as a separate output, for more information on what each of these fields represent see <https://cloud.ibm.com/docs/account?topic=account-crn>. |
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 module takes a CRN string input and returns each of the fields in the provided CRN as a separate output, for more information on what each of these fields represent see <https://cloud.ibm.com/docs/account?topic=account-crn>. | |
This module takes a CRN string input, parses the CRN, and returns the segments in the CRN as separate output fields. For more information about what each CRN segment represents, see [Cloud Resource Names](https://cloud.ibm.com/docs/account?topic=account-crn). |
modules/crn-parser/variables.tf
Outdated
#} | ||
variable "crn" { | ||
type = string | ||
description = "The CRN to be parsed." |
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.
description = "The CRN to be parsed." | |
description = "The CRN to parse." |
/run pipeline |
/run pipeline |
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.
one really small update. otherwise 👍
examples/crn-parser/README.md
Outdated
- A new Key Protect instance. | ||
|
||
The output of the example will be the CRN of the Key Protect instance and the parsed fields of the CRN using the CRN parser submodule. | ||
This example takes a CRN as the input. The outputs are the fields of the CRN that are parsed by using the CRN parser utility. |
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 example takes a CRN as the input. The outputs are the fields of the CRN that are parsed by using the CRN parser utility. | |
This example takes a CRN as the input. The outputs are the segments of the CRN that are parsed by using the CRN parser utility. |
just want to keep this consistent with modules/crn-parser/README.md
/run pipeline |
@ocofaigh one thing I thought about while fixing a test failure, do we need the CRA scan since this is just a local? I presume any utilities we'd add in the future would be similar in that they don't need the provider so might be better to just pull it from the module |
/run pipeline |
…-common-utilities into crn-parser
/run pipeline |
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Add the crn parser submodule and initial module cleanup from template
Release required?
x.x.X
)x.X.x
)X.x.x
)Release notes content
Add CRN parser submodule
Run the pipeline
If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.
Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:
Checklist for reviewers
For mergers