Skip to content
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

Convert Cloud resources to new "resource" framework #1391

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

julienduchesne
Copy link
Member

@julienduchesne julienduchesne commented Feb 29, 2024

Brings the cloud package under a new framework where each resource is wrapped in a Resource struct. The benefit for this is that it simplifies declaring new resources as everything is packages.

Benefits:

  • Forces the use of the ID helpers, therefore ensuring that every resource has a consistent ID format and generated import documentation
  • Paves the way for Terraform code generation. Under this new resource, a new "list" function will be added, providing a standard way to list any TF resource
  • Will simplify the migration to the newest TF provider framework. The new schema will simply be a new attribute within the Resource struct, allowing to have a standard way to define either SDK (old provider framework) vs Plugin Framework (newest) resources

Copy link

In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically.
To do so, a Grafana Labs employee must trigger the cloud acceptance tests workflow manually.

julienduchesne added a commit that referenced this pull request Mar 2, 2024
Split from #1391
- Makes the resource functions private (exposed via a single map attribute) rather than each resource individually
- Puts the client validation in the cloud package
julienduchesne added a commit that referenced this pull request Mar 2, 2024
Split from #1391
- Makes the resource functions private (exposed via a single map attribute) rather than each resource individually
- Puts the client validation in the cloud package
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch from 46e676a to 1716fe8 Compare March 2, 2024 04:01
@julienduchesne julienduchesne changed the base branch from main to julienduchesne/cloud-private March 2, 2024 04:01
julienduchesne added a commit that referenced this pull request Mar 2, 2024
Reducing diff from #1391
julienduchesne added a commit that referenced this pull request Mar 2, 2024
Reducing diff from #1391
julienduchesne added a commit that referenced this pull request Mar 2, 2024
Split from #1391
- Makes the resource functions private (exposed via a single map attribute) rather than each resource individually
- Puts the client validation in the cloud package
@julienduchesne julienduchesne force-pushed the julienduchesne/cloud-private branch from 0b826cb to 9b26801 Compare March 2, 2024 13:37
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch 2 times, most recently from 6fd6cd6 to e6ddd1b Compare March 2, 2024 13:43
julienduchesne added a commit that referenced this pull request Mar 2, 2024
Each resource's ID is composed of n (>=1) string or integer elements
We can generalize this behavior and do the parsing/formatting in the helper function
This is extracted from #1391 and is part of a push to have standardized IDs for all resources, allowing for easier generation of TF code!
julienduchesne added a commit that referenced this pull request Mar 2, 2024
Each resource's ID is composed of n (>=1) string or integer elements
We can generalize this behavior and do the parsing/formatting in the helper function
This is extracted from #1391 and is part of a push to have standardized IDs for all resources, allowing for easier generation of TF code!
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch from e6ddd1b to 21808d4 Compare March 2, 2024 14:29
@julienduchesne julienduchesne changed the base branch from julienduchesne/cloud-private to julienduchesne/typed-resource-id March 2, 2024 14:30
@julienduchesne julienduchesne marked this pull request as ready for review March 2, 2024 14:32
@julienduchesne julienduchesne requested review from a team as code owners March 2, 2024 14:32
julienduchesne added a commit that referenced this pull request Mar 5, 2024
Split from #1391
- Makes the resource functions private (exposed via a single map attribute) rather than each resource individually
- Puts the client validation in the cloud package
julienduchesne added a commit that referenced this pull request Mar 5, 2024
Split from #1391
- Makes the resource functions private (exposed via a single map attribute) rather than each resource individually
- Puts the client validation in the cloud package
julienduchesne added a commit that referenced this pull request Mar 5, 2024
Each resource's ID is composed of n (>=1) string or integer elements
We can generalize this behavior and do the parsing/formatting in the helper function
This is extracted from #1391 and is part of a push to have standardized IDs for all resources, allowing for easier generation of TF code!
@julienduchesne julienduchesne force-pushed the julienduchesne/typed-resource-id branch from 2e5a47a to 83eecfc Compare March 5, 2024 13:47
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch from 21808d4 to 5e78429 Compare March 5, 2024 13:49
Base automatically changed from julienduchesne/typed-resource-id to main March 6, 2024 19:19
julienduchesne added a commit that referenced this pull request Mar 6, 2024
Each resource's ID is composed of n (>=1) string or integer elements
We can generalize this behavior and do the parsing/formatting in the helper function
This is extracted from #1391 and is part of a push to have standardized IDs for all resources, allowing for easier generation of TF code!
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch from 5e78429 to d23a3c6 Compare March 7, 2024 12:48
@julienduchesne julienduchesne marked this pull request as draft March 11, 2024 12:50
@julienduchesne julienduchesne removed request for a team March 11, 2024 12:51
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch from d23a3c6 to 49a21e2 Compare March 11, 2024 14:05
julienduchesne added a commit that referenced this pull request Mar 11, 2024
Split from #1391
Convert the `stack` and `stack_service_account` resources to the new ID system that validates the ID format
julienduchesne added a commit that referenced this pull request Mar 11, 2024
Split from #1391
Convert the `stack` and `stack_service_account` resources to the new ID system that validates the ID format
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch from 49a21e2 to 53a53a4 Compare March 11, 2024 15:34
@julienduchesne julienduchesne marked this pull request as ready for review March 11, 2024 16:06
@julienduchesne julienduchesne requested a review from a team March 11, 2024 16:09
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch 2 times, most recently from 5607ebf to 51ed6f1 Compare March 14, 2024 16:25
- Add typing to the resource ID system. Makes it more robust and easier to use.
- Makes sure all resources have an ID helper (to generate imports)
- Paves the way for Terraform code gen
@julienduchesne julienduchesne force-pushed the julienduchesne/new-resource-framework branch from 51ed6f1 to 468f349 Compare March 18, 2024 13:49
@julienduchesne julienduchesne merged commit aeca83b into main Mar 18, 2024
25 checks passed
@julienduchesne julienduchesne deleted the julienduchesne/new-resource-framework branch March 18, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants