Skip to content
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

Add support for Code Engine functions #5596

Merged
merged 3 commits into from
Sep 17, 2024
Merged

Conversation

jasonpet
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Output from acceptance testing:

$ make testacc
TF_ACC=1 go test -timeout 1800s -v $(go list ./... |grep -v 'vendor') 
?   	github.com/IBM-Cloud/terraform-provider-ibm	[no test files]
?   	github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest	[no test files]
?   	github.com/IBM-Cloud/terraform-provider-ibm/ibm/provider	[no test files]
?   	github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate	[no test files]
?   	github.com/IBM-Cloud/terraform-provider-ibm/version	[no test files]
=== RUN   TestString
--- PASS: TestString (0.00s)
=== RUN   TestString_positiveIndex
--- PASS: TestString_positiveIndex (0.00s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns	0.709s
=== RUN   TestTerraformProblemEmbedsIBMProblem
--- PASS: TestTerraformProblemEmbedsIBMProblem (0.00s)
=== RUN   TestTerraformProblemGetConsoleMessage
--- PASS: TestTerraformProblemGetConsoleMessage (0.00s)
=== RUN   TestTerraformProblemGetDebugMessage
--- PASS: TestTerraformProblemGetDebugMessage (0.00s)
=== RUN   TestTerraformProblemGetID
--- PASS: TestTerraformProblemGetID (0.00s)
=== RUN   TestTerraformProblemGetConsoleOrderedMaps
--- PASS: TestTerraformProblemGetConsoleOrderedMaps (0.00s)
=== RUN   TestTerraformProblemGetDebugOrderedMaps
--- PASS: TestTerraformProblemGetDebugOrderedMaps (0.00s)
=== RUN   TestTerraformProblemGetDiag
--- PASS: TestTerraformProblemGetDiag (0.00s)
=== RUN   TestTerraformErrorf
--- PASS: TestTerraformErrorf (0.00s)
=== RUN   TestFmtErrorfWithProblem
--- PASS: TestFmtErrorfWithProblem (0.00s)
=== RUN   TestFmtErrorfWithNoError
--- PASS: TestFmtErrorfWithNoError (0.00s)
=== RUN   TestFmtErrorfWithProblemInServiceErrorResponse
--- PASS: TestFmtErrorfWithProblemInServiceErrorResponse (0.00s)
=== RUN   TestGetComponentInfo
--- PASS: TestGetComponentInfo (0.00s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex	0.956s
=== RUN   TestAccIbmCodeEngineAppDataSourceBasic
--- PASS: TestAccIbmCodeEngineAppDataSourceBasic (72.79s)
=== RUN   TestAccIbmCodeEngineAppDataSourceExtended
--- PASS: TestAccIbmCodeEngineAppDataSourceExtended (70.80s)
=== RUN   TestAccIbmCodeEngineBindingDataSourceBasic
--- PASS: TestAccIbmCodeEngineBindingDataSourceBasic (73.65s)
=== RUN   TestAccIbmCodeEngineBuildDataSourceBasic
--- PASS: TestAccIbmCodeEngineBuildDataSourceBasic (9.43s)
=== RUN   TestAccIbmCodeEngineConfigMapDataSourceBasic
--- PASS: TestAccIbmCodeEngineConfigMapDataSourceBasic (8.85s)
=== RUN   TestAccIbmCodeEngineDomainMappingDataSourceBasic
--- PASS: TestAccIbmCodeEngineDomainMappingDataSourceBasic (130.79s)
=== RUN   TestAccIbmCodeEngineFunctionDataSourceBasic
--- PASS: TestAccIbmCodeEngineFunctionDataSourceBasic (69.84s)
=== RUN   TestAccIbmCodeEngineFunctionDataSourceExtended
--- PASS: TestAccIbmCodeEngineFunctionDataSourceExtended (71.01s)
=== RUN   TestAccIbmCodeEngineJobDataSourceBasic
--- PASS: TestAccIbmCodeEngineJobDataSourceBasic (10.45s)
=== RUN   TestAccIbmCodeEngineJobDataSourceExtended
--- PASS: TestAccIbmCodeEngineJobDataSourceExtended (9.36s)
=== RUN   TestAccIbmCodeEngineProjectDataSourceBasic
--- PASS: TestAccIbmCodeEngineProjectDataSourceBasic (7.59s)
=== RUN   TestAccIbmCodeEngineSecretDataSourceGeneric
--- PASS: TestAccIbmCodeEngineSecretDataSourceGeneric (9.18s)
=== RUN   TestAccIbmCodeEngineSecretDataSourceBasicAuth
--- PASS: TestAccIbmCodeEngineSecretDataSourceBasicAuth (9.95s)
=== RUN   TestAccIbmCodeEngineSecretDataSourceRegistry
--- PASS: TestAccIbmCodeEngineSecretDataSourceRegistry (9.70s)
=== RUN   TestAccIbmCodeEngineSecretDataSourceSSHAuth
--- PASS: TestAccIbmCodeEngineSecretDataSourceSSHAuth (9.64s)
=== RUN   TestAccIbmCodeEngineSecretDataSourceTls
--- PASS: TestAccIbmCodeEngineSecretDataSourceTls (9.55s)
=== RUN   TestAccIbmCodeEngineSecretDataSourceServiceAccess
--- PASS: TestAccIbmCodeEngineSecretDataSourceServiceAccess (10.72s)
=== RUN   TestAccIbmCodeEngineAppBasic
--- PASS: TestAccIbmCodeEngineAppBasic (137.94s)
=== RUN   TestAccIbmCodeEngineAppExtended
--- PASS: TestAccIbmCodeEngineAppExtended (142.36s)
=== RUN   TestAccIbmCodeEngineBindingBasic
--- PASS: TestAccIbmCodeEngineBindingBasic (73.62s)
=== RUN   TestAccIbmCodeEngineBuildBasic
--- PASS: TestAccIbmCodeEngineBuildBasic (9.63s)
=== RUN   TestAccIbmCodeEngineConfigMapBasic
--- PASS: TestAccIbmCodeEngineConfigMapBasic (17.21s)
=== RUN   TestAccIbmCodeEngineDomainMappingBasic
--- PASS: TestAccIbmCodeEngineDomainMappingBasic (138.52s)
=== RUN   TestAccIbmCodeEngineFunctionBasic
--- PASS: TestAccIbmCodeEngineFunctionBasic (76.45s)
=== RUN   TestAccIbmCodeEngineFunctionExtended
--- PASS: TestAccIbmCodeEngineFunctionExtended (76.94s)
=== RUN   TestAccIbmCodeEngineJobBasic
--- PASS: TestAccIbmCodeEngineJobBasic (20.96s)
=== RUN   TestAccIbmCodeEngineJobExtended
--- PASS: TestAccIbmCodeEngineJobExtended (25.55s)
=== RUN   TestAccIbmCodeEngineProjectBasic
--- PASS: TestAccIbmCodeEngineProjectBasic (36.93s)
=== RUN   TestAccIbmCodeEngineSecretGeneric
--- PASS: TestAccIbmCodeEngineSecretGeneric (18.68s)
=== RUN   TestAccIbmCodeEngineSecretBasicAuth
--- PASS: TestAccIbmCodeEngineSecretBasicAuth (17.83s)
=== RUN   TestAccIbmCodeEngineSecretRegistry
--- PASS: TestAccIbmCodeEngineSecretRegistry (20.21s)
=== RUN   TestAccIbmCodeEngineSecretSSHAuth
--- PASS: TestAccIbmCodeEngineSecretSSHAuth (19.38s)
=== RUN   TestAccIbmCodeEngineSecretTls
--- PASS: TestAccIbmCodeEngineSecretTls (19.47s)
=== RUN   TestAccIbmCodeEngineSecretServiceAccess
--- PASS: TestAccIbmCodeEngineSecretServiceAccess (12.57s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/codeengine	1458.601s

...

hasChange := false

patchVals := &codeenginev2.FunctionPatch{}
if d.HasChange("project_id") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this block is n't required when you mark ForceNew : true on "project_id" argument

Description: "The name of the function.",
},
"run_env_variables": {
Type: schema.TypeList,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use TypeSet .
With TypeList when the order changes in user tf and in state file it always show a diff when more than one element is provided

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything else that would change when switching from TypeList to TypeSet or are they mostly interchangeable?

value = "value"
}

lifecycle {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is n't required when we use TypeSet.
Adding this block restricts user's to do update of run_env_variables

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you very much for reviewing our PR. I have a question from our side though. We ignore changes here, because our system injects some run_env_variables on the server-side, resulting in diffs during testing and obviously from the user's perspective. Users can react by adding those system-generated variables to the definition alongside the user-defined ones.
Are you saying that if we changed it to TypeSet, Terraform would be able to identify changes in the user-set variables only and ignore outside changes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No TypeSet doesn't identify the changes . Can we loop , identify system-generated variables before setting back in read method?
Typeset is unordered list so it will help in controlling diff on the order of items in the list

@hkantare
Copy link
Collaborator

Resolve confiicts in .secretbaseline file

@hkantare
Copy link
Collaborator

I think we use to have same behavior in deprecated function to filter system-defined parameters/annotation

@jasonpet
Copy link
Contributor Author

Do you think we can get this in September? We are addressing the environment variable issue in a future PR by introducing a new computed env variable field to hold the system-defined env vars. As I mentioned before, this issue is not at all related to the current PR. So, I see no reason to hold the current PR up. The env var fields in functions are not unique to functions and exist in our existing jobs and applications resources as well.

@hkantare hkantare merged commit 1e82c33 into IBM-Cloud:master Sep 17, 2024
1 check passed
srikant-sahu pushed a commit to srikant-sahu/terraform-provider-ibm that referenced this pull request Sep 24, 2024
* Add support for Code Engine functions

* update .secrets.baseline

* remove unnecessary check
@jasonpet jasonpet deleted the functionsCE branch January 15, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants