Add ability to query single Terraform State
What does this MR do?
Our GraphQL currently has a way to query a list of terraformStates, but we are missing the option to query one terraformState.
This MR wil add the following query to GraphQL
project(fullPath: "project_path") {
terraformState(name: "name") {
...
}
}
SQL for Terraform::StatesFinder.new(project, current_user, params: { name: 'test'}).execute
SELECT "terraform_states".* FROM "terraform_states" WHERE "terraform_states"."project_id" = 278964 AND "terraform_states"."name" = 'test' ORDER BY "terraform_states"."name" ASC
QUERY PLAN
Index Scan using index_terraform_states_on_project_id_and_name on public.terraform_states (cost=0.28..3.30 rows=1 width=177) (actual time=2.000..2.001 rows=0 loops=1)
Index Cond: ((terraform_states.project_id = 278964) AND ((terraform_states.name)::text = 'test'::text))
Buffers: shared hit=3 read=2
I/O Timings: read=1.965
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Related to #291140
Edited by Emily Ring