Skip to content

feat(services): add Terraform #1907

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

Draft
wants to merge 49 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4132e63
chore: correct TS errors for new API changes
rmnbrd May 27, 2025
51a45ae
chore: remove unused API endpoint for listDatabaseInstanceTypes
rmnbrd May 22, 2025
30e3f27
chore: update comments
rmnbrd May 23, 2025
154aaaf
fix: update API version
rmnbrd May 23, 2025
645375a
impr: bump qovery-typescript-axios version
rmnbrd May 23, 2025
912b327
chore: bump api version
rmnbrd May 27, 2025
037e484
feat: add the basis for Terraform
rmnbrd May 21, 2025
b819474
chore: correct some TS errors
rmnbrd May 23, 2025
d768e2a
fix: correct some TS errors
rmnbrd May 26, 2025
2101a0b
chore: fix more TS errors
rmnbrd May 27, 2025
95c0729
feat: general step of Terraform creation flow
rmnbrd May 27, 2025
fbc5762
Merge branch 'staging' into feat/services-add-terraform-QOV-821
rmnbrd May 28, 2025
42b2df9
feat: improve Terraform creation flow
rmnbrd May 28, 2025
ac58754
Merge branch 'staging' into feat/services-add-terraform-QOV-821
rmnbrd May 28, 2025
653c274
feat: improve Terraform creation flow
rmnbrd May 28, 2025
50338ba
impr: add missing env id to terraform creation payload
rmnbrd May 28, 2025
c719d34
impr: clean up
rmnbrd May 28, 2025
3cc3d9b
impr: add TF services to the list
rmnbrd May 30, 2025
e3bf5e4
impr: bump API version
rmnbrd May 30, 2025
4e81757
impr: bump WS API version
rmnbrd May 30, 2025
19c3521
test: correct unit tests
rmnbrd May 30, 2025
ff2096b
impr: add git info for TF services in list of services
rmnbrd Jun 2, 2025
10bffe5
impr: add missing sidebar to the TF service's settings
rmnbrd Jun 2, 2025
1baee3b
chore: update comment
rmnbrd Jun 2, 2025
3c7485c
fix: terraform version cannot be left undefined
rmnbrd Jun 2, 2025
24c2699
feat: add TF variables step to the creation flow
rmnbrd Jun 2, 2025
6f088ce
chore: correct lint issues
rmnbrd Jun 2, 2025
e091380
impr: bump API and update tf_vars payload
rmnbrd Jun 3, 2025
f3e0b36
impr: remove empty state for variable step in TF creation flow
rmnbrd Jun 3, 2025
843f1cd
impr: bump API version and rename storage_gib
rmnbrd Jun 3, 2025
5860e7d
feat: add "deploy" feature for Terraform
rmnbrd Jun 3, 2025
3032175
feat: bind getTerraformDeploymentRestrictions endpoint
rmnbrd Jun 3, 2025
1836f98
feat: bind cloneTerraform endpoint
rmnbrd Jun 3, 2025
fe219c5
test: update outdated snapshot
rmnbrd Jun 4, 2025
f7f988c
chore: clean ValuesOverrideArguments component
rmnbrd Jun 4, 2025
096204c
chore: clean up commented or unused code
rmnbrd Jun 4, 2025
3930edb
impr: update StepSummaryFeature
rmnbrd Jun 4, 2025
20b790f
feat: add ability to deploy from specific commit
rmnbrd Jun 5, 2025
62cb088
fix: add missing request payload for commit deployment
rmnbrd Jun 5, 2025
ee414b4
feat: add ability to dry-run
rmnbrd Jun 5, 2025
e8a26fd
impr: WIP settings
rmnbrd Jun 6, 2025
ef1655b
Merge branch 'staging' into feat/services-add-terraform-QOV-821
rmnbrd Jun 10, 2025
1dad597
chore: temporarily bypass TS error
rmnbrd Jun 10, 2025
9300e24
feat: add toggle for usage of cluster credentials
rmnbrd Jun 10, 2025
f01783d
fix: update provider value according to new backend spec
rmnbrd Jun 11, 2025
ef2d6ee
chore: correct TS error
rmnbrd Jun 11, 2025
4af3913
chore: bump API version
rmnbrd Jun 11, 2025
8d504e2
Merge branch 'staging' into feat/services-add-terraform-QOV-821
rmnbrd Jun 11, 2025
a77ca0b
test: fix failing unit test
rmnbrd Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ node_modules
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.zed

# misc
/.sass-cache
Expand All @@ -66,4 +67,4 @@ testem.log
Thumbs.db

.nx/cache
.nx/workspace-data
.nx/workspace-data
8 changes: 8 additions & 0 deletions apps/console/src/app/router/main.router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
PageHelmCreateFeature,
PageJobCreateFeature,
PageServices,
PageTerraformCreateFeature,
} from '@qovery/pages/services'
import { PageSettings } from '@qovery/pages/settings'
import { PageUser } from '@qovery/pages/user'
Expand Down Expand Up @@ -44,6 +45,7 @@ import {
SERVICES_HELM_TEMPLATE_CREATION_URL,
SERVICES_LIFECYCLE_CREATION_URL,
SERVICES_LIFECYCLE_TEMPLATE_CREATION_URL,
SERVICES_TERRAFORM_CREATION_URL,
SERVICES_URL,
SETTINGS_URL,
USER_URL,
Expand Down Expand Up @@ -178,6 +180,12 @@ export const ROUTER: RouterProps[] = [
protected: true,
layout: false,
},
{
path: `${SERVICES_URL()}${SERVICES_TERRAFORM_CREATION_URL}/*`,
component: <PageTerraformCreateFeature />,
protected: true,
layout: false,
},
{
path: `${APPLICATION_URL()}/*`,
component: <PageApplication />,
Expand Down
18 changes: 18 additions & 0 deletions libs/domains/service-terraform/data-access/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
3 changes: 3 additions & 0 deletions libs/domains/service-terraform/data-access/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# domains-service-terraform-data-access

This library was generated with [Nx](https://nx.dev).
9 changes: 9 additions & 0 deletions libs/domains/service-terraform/data-access/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "domains-service-terraform-data-access",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/domains/service-terraform/data-access/src",
"projectType": "library",
"tags": ["scope:domain", "type:data-access", "slice:services"],
"// targets": "to see all targets run: nx show project domains-service-terraform-data-access --web",
"targets": {}
}
1 change: 1 addition & 0 deletions libs/domains/service-terraform/data-access/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/domains-service-terraform-data-access'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { type TerraformRequest, TerraformsApi } from 'qovery-typescript-axios'

const terraformsApi = new TerraformsApi()

export const mutations = {
async createTerraformService({
environmentId,
terraformRequest,
}: {
environmentId: string
terraformRequest: TerraformRequest
}) {
const response = await terraformsApi.createTerraform(environmentId, terraformRequest)
return response.data
},
}
19 changes: 19 additions & 0 deletions libs/domains/service-terraform/data-access/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
10 changes: 10 additions & 0 deletions libs/domains/service-terraform/data-access/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
12 changes: 12 additions & 0 deletions libs/domains/service-terraform/feature/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions libs/domains/service-terraform/feature/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/domains/service-terraform/feature/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# domains-service-terraform-feature

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test domains-service-terraform-feature` to execute the unit tests via [Jest](https://jestjs.io).
11 changes: 11 additions & 0 deletions libs/domains/service-terraform/feature/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'domains-service-helm-feature',
preset: '../../../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../../../coverage/libs/domains/service-helm/feature',
}
21 changes: 21 additions & 0 deletions libs/domains/service-terraform/feature/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "domains-service-terraform-feature",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/domains/service-terraform/feature/src",
"projectType": "library",
"tags": ["scope:domain", "type:feature", "slice:service-terraform"],
"implicitDependencies": ["!shared-console-shared"],
"targets": {
"test": {
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"coverage": true
}
}
}
}
}
3 changes: 3 additions & 0 deletions libs/domains/service-terraform/feature/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './lib/hooks/use-create-terraform-service/use-create-terraform-service'
export * from './source-setting/source-setting'
export * from './values-override-arguments-setting/values-override-arguments-setting'
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { mutations } from '@qovery/domains/service-terraform/data-access'
import { queries } from '@qovery/state/util-queries'

export function useCreateTerraformService() {
const queryClient = useQueryClient()

return useMutation(mutations.createTerraformService, {
onSuccess(_, { environmentId }) {
queryClient.invalidateQueries({
queryKey: queries.services.list(environmentId).queryKey,
})
},
meta: {
notifyOnSuccess: {
title: 'Your Terraform service has been created',
},
notifyOnError: true,
},
})
}

export default useCreateTerraformService
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Controller, useFormContext } from 'react-hook-form'
import { InputSelect } from '@qovery/shared/ui'

export function SourceSetting() {
const { control, resetField } = useFormContext()

return (
<div className="flex flex-col gap-3">
<Controller
name="source_provider"
control={control}
rules={{
required: 'Please select a Terraform source.',
}}
render={({ field, fieldState: { error } }) => (
<InputSelect
label="Terraform source"
disabled={true}
options={[
{
label: 'Git provider',
value: 'GIT',
},
]}
onChange={(value) => {
resetField('repository')
field.onChange(value)
}}
value={field.value}
error={error?.message}
/>
)}
/>
</div>
)
}

export default SourceSetting
Loading