- 
                Notifications
    You must be signed in to change notification settings 
- Fork 554
fix: Terraform plugin fix in v1.0.1 #6830
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            4 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      9471630
              
                update the terraform plugin script for bool value fix of RUN_TERRAFOR…
              
              
                ajaydevtron 748e44f
              
                update the sql query for plugin_step table
              
              
                ajaydevtron 2d702be
              
                make the query transactional
              
              
                ajaydevtron 033b3dc
              
                Merge branch 'main' into terraform-plugin-fix
              
              
                ajaydevtron File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| BEGIN; | ||
|  | ||
| -- Delete plugin step variable (for step index=1) | ||
| DELETE FROM plugin_step_variable | ||
| WHERE plugin_step_id = ( | ||
| SELECT ps.id | ||
| FROM plugin_metadata p | ||
| INNER JOIN plugin_step ps ON ps.plugin_id = p.id | ||
| WHERE p.plugin_version = '1.0.1' | ||
| AND p.name = 'Terraform CLI v1.0.0' | ||
| AND p.deleted = false | ||
| AND ps."index" = 1 | ||
| AND ps.deleted = false | ||
| ); | ||
|  | ||
| -- Delete plugin steps | ||
| DELETE FROM plugin_step | ||
| WHERE plugin_id = ( | ||
| SELECT id | ||
| FROM plugin_metadata | ||
| WHERE plugin_version = '1.0.1' | ||
| AND name = 'Terraform CLI v1.0.0' | ||
| AND deleted = false | ||
| ); | ||
|  | ||
| -- Delete pipeline script | ||
| DELETE FROM plugin_pipeline_script | ||
| WHERE id = ( | ||
| SELECT script_id | ||
| FROM plugin_step | ||
| WHERE plugin_id = ( | ||
| SELECT id | ||
| FROM plugin_metadata | ||
| WHERE plugin_version = '1.0.1' | ||
| AND name = 'Terraform CLI v1.0.0' | ||
| AND deleted = false | ||
| ) | ||
| ); | ||
|  | ||
| -- Delete stage mappings | ||
| DELETE FROM plugin_stage_mapping | ||
| WHERE plugin_id = ( | ||
| SELECT id | ||
| FROM plugin_metadata | ||
| WHERE plugin_version = '1.0.1' | ||
| AND name = 'Terraform CLI v1.0.0' | ||
| AND deleted = false | ||
| ); | ||
|  | ||
| -- Delete plugin metadata entry | ||
| DELETE FROM plugin_metadata | ||
| WHERE plugin_version = '1.0.1' | ||
| AND name = 'Terraform CLI v1.0.0' | ||
| AND deleted = false; | ||
|  | ||
| -- Mark previous version as latest | ||
| UPDATE plugin_metadata | ||
| SET is_latest = true | ||
| WHERE id = ( | ||
| SELECT id | ||
| FROM plugin_metadata | ||
| WHERE name = 'Terraform CLI v1.0.0' | ||
| AND is_latest = false | ||
| AND plugin_version = '1.0.0' | ||
| ); | ||
|  | ||
| COMMIT; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Copyright (c) 2025. Devtron Inc. | ||
| */ | ||
| BEGIN; | ||
|  | ||
| -- Update the existing entry is_latest false for terrfaorm plugin | ||
| UPDATE plugin_metadata SET is_latest = false WHERE id = (SELECT id FROM plugin_metadata WHERE name= 'Terraform CLI v1.0.0' and is_latest= true); | ||
|  | ||
| -- Insert an entry in plugin_metadata for new version v1.0.1 | ||
| INSERT INTO "plugin_metadata" ("id", "name", "description","deleted", "created_on", "created_by", "updated_on", "updated_by","plugin_parent_metadata_id","plugin_version","is_deprecated","is_latest") | ||
| VALUES (nextval('id_seq_plugin_metadata'), 'Terraform CLI v1.0.0','Terraform: Simplify infrastructure as code, manage resources effortlessly, and deploy with ease using this plugins','f', 'now()', 1, 'now()', 1, (SELECT id FROM plugin_parent_metadata WHERE identifier='terraform-cli-v1-0-0'),'1.0.1', false, true); | ||
|  | ||
| -- Insert the plugin stage mapping | ||
| INSERT INTO "plugin_stage_mapping" ("plugin_id","stage_type","created_on", "created_by", "updated_on", "updated_by") | ||
| VALUES ((SELECT id FROM plugin_metadata WHERE plugin_version='1.0.1' and name='Terraform CLI v1.0.0' and deleted= false),0,'now()', 1, 'now()', 1); | ||
|  | ||
| -- Insert updated script | ||
| INSERT INTO "plugin_pipeline_script" ("id", "script","type","deleted","created_on", "created_by", "updated_on", "updated_by") | ||
| VALUES (nextval('id_seq_plugin_pipeline_script'),E' | ||
| export DEFAULT_TF_IMAGE=docker.io/hashicorp/terraform:latest | ||
| if [ -n "$TERRAFORM_IMAGE" ]; then | ||
| echo "Using $TERRAFORM_IMAGE as the custom image." | ||
| DEFAULT_TF_IMAGE="$TERRAFORM_IMAGE" | ||
| else | ||
| echo "Using the default image --> $DEFAULT_TF_IMAGE" | ||
| fi | ||
|  | ||
| # RUNNING Terraform init | ||
| if [ $RUN_TERRAFORM_INIT == "TRUE" ]; then | ||
| #RUNNING Terraform init | ||
| docker run -v $PWD:$PWD -w $PWD/$WORKINGDIR -e HTTP_PROXY=$HTTP_PROXY -e HTTPS_PROXY=$HTTPS_PROXY -e NO_PROXY=$NO_PROXY $DEFAULT_TF_IMAGE init | ||
| fi | ||
|  | ||
|  | ||
| # exporting all the env variables | ||
| echo "$ADDITIONALPARAMS" > devtron-custom-values.env | ||
|  | ||
| # RUNNING Terraform command | ||
| echo "docker run -v $PWD:$PWD -w $PWD/$WORKINGDIR --env-file devtron-custom-values.env -e HTTP_PROXY=$HTTP_PROXY -e HTTPS_PROXY=$HTTPS_PROXY -e NO_PROXY=$NO_PROXY $DEFAULT_TF_IMAGE $ARGS" | ||
| docker run -v $PWD:$PWD -w $PWD/$WORKINGDIR --env-file devtron-custom-values.env -e HTTP_PROXY=$HTTP_PROXY -e HTTPS_PROXY=$HTTPS_PROXY -e NO_PROXY=$NO_PROXY $DEFAULT_TF_IMAGE $ARGS','SHELL','f','now()',1,'now()',1); | ||
|  | ||
| INSERT INTO "plugin_step" ("id", "plugin_id","name","description","index","step_type","script_id","deleted", "created_on", "created_by", "updated_on", "updated_by") | ||
| VALUES (nextval('id_seq_plugin_step'), (SELECT id FROM plugin_metadata WHERE name='Terraform CLI v1.0.0' and plugin_version='1.0.1'),'Step 1','Step 1 - Terraform CLI v1.0.0','1','INLINE',(SELECT last_value FROM id_seq_plugin_pipeline_script),'f','now()', 1, 'now()', 1); | ||
|  | ||
| INSERT INTO plugin_step_variable (id,plugin_step_id,name,format,description,is_exposed,allow_empty_value,default_value,value,variable_type,value_type,previous_step_index,variable_step_index,variable_step_index_in_plugin,reference_variable_name,deleted,created_on,created_by,updated_on,updated_by) | ||
| VALUES | ||
| (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Terraform CLI v1.0.0' and ps."index"=1 and p.plugin_version='1.0.1' and ps.deleted=false),'HTTP_PROXY','STRING','Specify the HTTP proxy server for non-SSL requests.','t','t',null,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1), | ||
| (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Terraform CLI v1.0.0' and ps."index"=1 and p.plugin_version='1.0.1' and ps.deleted=false),'HTTPS_PROXY','STRING','Specify the HTTPS proxy server for SSL requests.','t','t',null,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1), | ||
| (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Terraform CLI v1.0.0' and ps."index"=1 and p.plugin_version='1.0.1' and ps.deleted=false),'NO_PROXY','STRING','Opt out of proxying HTTP/HTTPS requests. Use this to specify hosts that should bypass the proxy.','t','t',null,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1), | ||
| (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Terraform CLI v1.0.0' and ps."index"=1 and p.plugin_version='1.0.1' and ps.deleted=false),'TERRAFORM_IMAGE','STRING','Specify a custom Terraform container image to use for the execution of Terraform commands.','t','t',null,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1), | ||
| (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Terraform CLI v1.0.0' and ps."index"=1 and p.plugin_version='1.0.1' and ps.deleted=false),'WORKINGDIR','STRING','Set the source directory for Terraform execution.Example: /path/to/terraform/project','t','t',null,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1), | ||
| (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Terraform CLI v1.0.0' and ps."index"=1 and p.plugin_version='1.0.1' and ps.deleted=false),'ARGS','STRING','Specifies Terraform CLI commands to run. Example: plan -var-file=myvars.tfvars','t','t','--help',null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1), | ||
| (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Terraform CLI v1.0.0' and ps."index"=1 and p.plugin_version='1.0.1' and ps.deleted=false),'RUN_TERRAFORM_INIT','BOOL','Determines whether to run the Terraform initialization command.','t','t','TRUE',null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1), | ||
| (nextval('id_seq_plugin_step_variable'),(SELECT ps.id FROM plugin_metadata p inner JOIN plugin_step ps on ps.plugin_id=p.id WHERE p.name='Terraform CLI v1.0.0' and ps."index"=1 and p.plugin_version='1.0.1' and ps.deleted=false),'ADDITIONALPARAMS','STRING','Provides key-value pairs to inject into the Terraform container.Example: VAR1=value1 VAR2=value2c','t','t',null,null,'INPUT','NEW',null,1,null,null,'f','now()',1,'now()',1); | ||
| COMMIT; | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.