Skip to content

feat: include terraform modules for dynamic parameters #17541

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE template_version_terraform_values
DROP COLUMN IF EXISTS modules;
4 changes: 4 additions & 0 deletions coderd/database/migrations/000318_template_module_data.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE template_version_terraform_values
ADD COLUMN IF NOT EXISTS tfstate bytea DEFAULT null;

COMMENT ON COLUMN template_version_terraform_values.tfstate IS 'Tarball of the relevant tfstate directory files for dynamic parameters. Not all files are included.'
2 changes: 2 additions & 0 deletions coderd/database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 17 additions & 4 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions coderd/database/queries/templateversionterraformvalues.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ INSERT INTO
template_version_terraform_values (
template_version_id,
cached_plan,
tfstate,
updated_at
)
VALUES
(
(select id from template_versions where job_id = @job_id),
@cached_plan,
@tfstate,
@updated_at
);
1 change: 1 addition & 0 deletions coderd/provisionerdserver/provisionerdserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,7 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)
err := s.Database.InsertTemplateVersionTerraformValuesByJobID(ctx, database.InsertTemplateVersionTerraformValuesByJobIDParams{
JobID: jobID,
CachedPlan: jobType.TemplateImport.Plan,
Tfstate: nil,
UpdatedAt: now,
})
if err != nil {
Expand Down
Loading