Skip to content

Commit 4e9df55

Browse files
committed
Add run_compute_resource_token_enabled parameter to Code Engine job resource
1 parent a3d30cc commit 4e9df55

File tree

5 files changed

+47
-20
lines changed

5 files changed

+47
-20
lines changed

.secrets.baseline

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.mod|go.sum|.*.map|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-04-30T11:08:26Z",
6+
"generated_at": "2025-05-20T15:39:33Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -846,47 +846,47 @@
846846
"hashed_secret": "9184b0c38101bf24d78b2bb0d044deb1d33696fc",
847847
"is_secret": false,
848848
"is_verified": false,
849-
"line_number": 144,
849+
"line_number": 145,
850850
"type": "Secret Keyword",
851851
"verified_result": null
852852
},
853853
{
854854
"hashed_secret": "c427f185ddcb2440be9b77c8e45f1cd487a2e790",
855855
"is_secret": false,
856856
"is_verified": false,
857-
"line_number": 1558,
857+
"line_number": 1559,
858858
"type": "Base64 High Entropy String",
859859
"verified_result": null
860860
},
861861
{
862862
"hashed_secret": "1f7e33de15e22de9d2eaf502df284ed25ca40018",
863863
"is_secret": false,
864864
"is_verified": false,
865-
"line_number": 1625,
865+
"line_number": 1626,
866866
"type": "Secret Keyword",
867867
"verified_result": null
868868
},
869869
{
870870
"hashed_secret": "1f614c2eb6b3da22d89bd1b9fd47d7cb7c8fc670",
871871
"is_secret": false,
872872
"is_verified": false,
873-
"line_number": 3705,
873+
"line_number": 3720,
874874
"type": "Secret Keyword",
875875
"verified_result": null
876876
},
877877
{
878878
"hashed_secret": "7abfce65b8504403afc25c9790f358d513dfbcc6",
879879
"is_secret": false,
880880
"is_verified": false,
881-
"line_number": 3718,
881+
"line_number": 3733,
882882
"type": "Secret Keyword",
883883
"verified_result": null
884884
},
885885
{
886886
"hashed_secret": "0c2d85bf9a9b1579b16f220a4ea8c3d62b2e24b1",
887887
"is_secret": false,
888888
"is_verified": false,
889-
"line_number": 3760,
889+
"line_number": 3775,
890890
"type": "Secret Keyword",
891891
"verified_result": null
892892
}
@@ -3468,7 +3468,7 @@
34683468
"hashed_secret": "a2277f800807615d59cc7925271ea2c54de5fb96",
34693469
"is_secret": false,
34703470
"is_verified": false,
3471-
"line_number": 1376,
3471+
"line_number": 1388,
34723472
"type": "Secret Keyword",
34733473
"verified_result": null
34743474
}
@@ -5698,7 +5698,7 @@
56985698
}
56995699
]
57005700
},
5701-
"version": "0.13.1+ibm.62.dss",
5701+
"version": "0.13.1+ibm.61.dss",
57025702
"word_list": {
57035703
"file": null,
57045704
"hash": null

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/IBM/cloud-databases-go-sdk v0.7.1
1212
github.com/IBM/cloud-db2-go-sdk v0.2.3
1313
github.com/IBM/cloudant-go-sdk v0.8.0
14-
github.com/IBM/code-engine-go-sdk v0.0.0-20241217191651-e1821f8c58c3
14+
github.com/IBM/code-engine-go-sdk v0.0.0-20250402033120-47ba37a7f7ce
1515
github.com/IBM/configuration-aggregator-go-sdk v0.0.2
1616
github.com/IBM/container-registry-go-sdk v1.1.0
1717
github.com/IBM/continuous-delivery-go-sdk/v2 v2.0.2
@@ -203,15 +203,15 @@ require (
203203
go.uber.org/automaxprocs v1.6.0 // indirect
204204
go.uber.org/ratelimit v0.2.0 // indirect
205205
go.uber.org/zap v1.27.0 // indirect
206-
golang.org/x/mod v0.21.0 // indirect
206+
golang.org/x/mod v0.24.0 // indirect
207207
golang.org/x/net v0.38.0 // indirect
208208
golang.org/x/oauth2 v0.22.0 // indirect
209209
golang.org/x/sync v0.12.0 // indirect
210210
golang.org/x/sys v0.32.0 // indirect
211211
golang.org/x/term v0.30.0 // indirect
212212
golang.org/x/text v0.23.0 // indirect
213213
golang.org/x/time v0.3.0 // indirect
214-
golang.org/x/tools v0.26.0 // indirect
214+
golang.org/x/tools v0.31.0 // indirect
215215
google.golang.org/appengine v1.6.8 // indirect
216216
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
217217
google.golang.org/grpc v1.67.1 // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ github.com/IBM/cloud-db2-go-sdk v0.2.3 h1:R+8uFXSZFOsBDC7nKqW9DgyGgT9Pop589ziUIa
108108
github.com/IBM/cloud-db2-go-sdk v0.2.3/go.mod h1:jEJMNXX2KOE+Hhk3M8CBq0qi9CZ0eRK36xmhuBPSiNA=
109109
github.com/IBM/cloudant-go-sdk v0.8.0 h1:XzaqZFy5fm1Q9+iK52X5zRW39SHaahT9pf5SRgVTsTY=
110110
github.com/IBM/cloudant-go-sdk v0.8.0/go.mod h1:zDGBs8ideVtn9MehXbIQNI3852B68BsMtKJvq3iPn/Q=
111-
github.com/IBM/code-engine-go-sdk v0.0.0-20241217191651-e1821f8c58c3 h1:bNopmSDZEmWf+Q4ZqwnT3LY7vNt7S3oVH3PXTZHuLmE=
112-
github.com/IBM/code-engine-go-sdk v0.0.0-20241217191651-e1821f8c58c3/go.mod h1:OiTumANXHfRr89a+0GjGWI70yzwZI+7ja2JFGpfnPFY=
111+
github.com/IBM/code-engine-go-sdk v0.0.0-20250402033120-47ba37a7f7ce h1:UPNjuG/VFzC94kQSpYhbOG/2mk7i8sn1rGywHo2SPuk=
112+
github.com/IBM/code-engine-go-sdk v0.0.0-20250402033120-47ba37a7f7ce/go.mod h1:BLqe6JiME0CgG1x1v85Tx9fpbG5YzesYhI482gSGaEY=
113113
github.com/IBM/configuration-aggregator-go-sdk v0.0.2 h1:IRDIrGyLNXq+wQRj/js/Bzr74iQk7xaHiYB8g3TcMyY=
114114
github.com/IBM/configuration-aggregator-go-sdk v0.0.2/go.mod h1:Ql2N5j4d4Pj1/GoLzFwZw0DomCG4b1O33kKs3TZ+O+I=
115115
github.com/IBM/container-registry-go-sdk v1.1.0 h1:sYyknIod8R4RJZQqAheiduP6wbSTphE9Ag8ho28yXjc=
@@ -633,8 +633,8 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe
633633
github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
634634
github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
635635
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
636-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
637-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
636+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
637+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
638638
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
639639
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
640640
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -1376,8 +1376,8 @@ golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
13761376
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
13771377
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
13781378
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
1379-
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
1380-
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
1379+
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
1380+
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
13811381
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
13821382
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
13831383
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1764,8 +1764,8 @@ golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM
17641764
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
17651765
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
17661766
golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
1767-
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
1768-
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
1767+
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
1768+
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
17691769
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
17701770
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
17711771
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

ibm/service/codeengine/resource_ibm_code_engine_job.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ func ResourceIbmCodeEngineJob() *schema.Resource {
7474
Description: "Set commands for the job that are passed to start job run containers. If not specified an empty string array will be applied and the command specified by the container image, will be used to start the container.",
7575
Elem: &schema.Schema{Type: schema.TypeString},
7676
},
77+
"run_compute_resource_token_enabled": {
78+
Type: schema.TypeBool,
79+
Optional: true,
80+
Default: false,
81+
Description: "Enable the use of a compute resource token mounted to the container file system.",
82+
},
7783
"run_env_variables": {
7884
Type: schema.TypeList,
7985
Optional: true,
@@ -423,6 +429,9 @@ func resourceIbmCodeEngineJobCreate(context context.Context, d *schema.ResourceD
423429
}
424430
createJobOptions.SetRunCommands(runCommands)
425431
}
432+
if _, ok := d.GetOk("run_compute_resource_token_enabled"); ok {
433+
createJobOptions.SetRunComputeResourceTokenEnabled(d.Get("run_compute_resource_token_enabled").(bool))
434+
}
426435
if _, ok := d.GetOk("run_env_variables"); ok {
427436
var runEnvVariables []codeenginev2.EnvVarPrototype
428437
for _, v := range d.Get("run_env_variables").([]interface{}) {
@@ -549,6 +558,12 @@ func resourceIbmCodeEngineJobRead(context context.Context, d *schema.ResourceDat
549558
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_code_engine_job", "read", "set-run_commands").GetDiag()
550559
}
551560
}
561+
if !core.IsNil(job.RunComputeResourceTokenEnabled) {
562+
if err = d.Set("run_compute_resource_token_enabled", job.RunComputeResourceTokenEnabled); err != nil {
563+
err = fmt.Errorf("Error setting run_compute_resource_token_enabled: %s", err)
564+
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "ibm_code_engine_job", "read", "set-run_compute_resource_token_enabled").GetDiag()
565+
}
566+
}
552567
if !core.IsNil(job.RunEnvVariables) {
553568
runEnvVariables := []map[string]interface{}{}
554569
for _, runEnvVariablesItem := range job.RunEnvVariables {
@@ -751,6 +766,11 @@ func resourceIbmCodeEngineJobUpdate(context context.Context, d *schema.ResourceD
751766
patchVals.RunCommands = runCommands
752767
hasChange = true
753768
}
769+
if d.HasChange("run_compute_resource_token_enabled") {
770+
newRunComputeResourceTokenEnabled := d.Get("run_compute_resource_token_enabled").(bool)
771+
patchVals.RunComputeResourceTokenEnabled = &newRunComputeResourceTokenEnabled
772+
hasChange = true
773+
}
754774
if d.HasChange("run_env_variables") {
755775
var runEnvVariables []codeenginev2.EnvVarPrototype
756776
for _, v := range d.Get("run_env_variables").([]interface{}) {
@@ -954,6 +974,10 @@ func ResourceIbmCodeEngineJobJobPatchAsPatch(patchVals *codeenginev2.JobPatch, d
954974
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
955975
patch["run_commands"] = nil
956976
}
977+
path = "run_compute_resource_token_enabled"
978+
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
979+
patch["run_compute_resource_token_enabled"] = nil
980+
}
957981
path = "run_env_variables"
958982
if _, exists := d.GetOk(path); d.HasChange(path) && !exists {
959983
runEnvVariables := []map[string]interface{}{}

website/docs/d/code_engine_job.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ Nested schema for **computed_env_variables**:
8585
* `run_commands` - (List) Set commands for the job that are passed to start job run containers. If not specified an empty string array will be applied and the command specified by the container image, will be used to start the container.
8686
* Constraints: The list items must match regular expression `/^.*$/`. The maximum length is `100` items. The minimum length is `0` items.
8787

88+
* `run_compute_resource_token_enabled` - (Bool) Enable the use of a compute resource token mounted to the container file system.
89+
* Constraints: The default value is `false`.
90+
8891
* `run_env_variables` - (List) References to config maps, secrets or literal values, which are exposed as environment variables in the job run.
8992
* Constraints: The maximum length is `100` items. The minimum length is `0` items.
9093
Nested schema for **run_env_variables**:

0 commit comments

Comments
 (0)