terraform-provider-ibm icon indicating copy to clipboard operation
terraform-provider-ibm copied to clipboard

On second apply terraform wants to change existing default env variables using ibm_code_engine_app

Open akocbek opened this issue 11 months ago • 4 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When using ibm_code_engine_app to create code engine app, default env variables are set. On second apply terraform wants to change these env variables, although I do not specify that I want to make changes.

terraform state file

"resources": [
    {
      "mode": "managed",
      "type": "ibm_code_engine_app",
      "name": "ce_app",
      "provider": "provider[\"registry.terraform.io/ibm-cloud/ibm\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "app_id": "34d49f16-65ab-4870-8ba5-025cd957871d",
            "created_at": "2024-03-19T14:32:48Z",
            "endpoint": "https://test-project-app.1eqotehmakcr.us-south.codeengine.appdomain.cloud",
            "endpoint_internal": "http://test-project-app.1eqotehmakcr.svc.cluster.local",
            "entity_tag": "4754982598",
            "etag": "4754982598",
            "href": "https://api.us-south.codeengine.cloud.ibm.com/v2/projects/6d810e3c-8133-4eac-a19b-06c1d198245a/apps/test-project-app",
            "id": "6d810e3c-8133-4eac-a19b-06c1d198245a/test-project-app",
            "image_port": 8080,
            "image_reference": "icr.io/codeengine/helloworld",
            "image_secret": null,
            "managed_domain_mappings": "local_public",
            "name": "test-project-app",
            "project_id": "6d810e3c-8133-4eac-a19b-06c1d198245a",
            "resource_type": "app_v2",
            "run_arguments": [],
            "run_as_user": null,
            "run_commands": [],
            "run_env_variables": [
              {
                "key": "",
                "name": "CE_SUBDOMAIN",
                "prefix": "",
                "reference": "",
                "type": "literal",
                "value": "1eqotehmakcr"
              },
              {
                "key": "",
                "name": "CE_PROJECT_ID",
                "prefix": "",
                "reference": "",
                "type": "literal",
                "value": "6d810e3c-8133-4eac-a19b-06c1d198245a"
              },
              {
                "key": "",
                "name": "CE_APP",
                "prefix": "",
                "reference": "",
                "type": "literal",
                "value": "test-project-app"
              },
              {
                "key": "",
                "name": "CE_DOMAIN",
                "prefix": "",
                "reference": "",
                "type": "literal",
                "value": "us-south.codeengine.appdomain.cloud"
              },
              {
                "key": "",
                "name": "CE_REGION",
                "prefix": "",
                "reference": "",
                "type": "literal",
                "value": "us-south"
              },
              {
                "key": "",
                "name": "CE_API_BASE_URL",
                "prefix": "",
                "reference": "",
                "type": "literal",
                "value": "https://api.private.us-south.codeengine.cloud.ibm.com"
              }
            ],
            "run_service_account": "default",
            "run_volume_mounts": [],
            "scale_concurrency": 100,
            "scale_concurrency_target": null,
            "scale_cpu_limit": "1",
            "scale_ephemeral_storage_limit": "400M",
            "scale_initial_instances": 1,
            "scale_max_instances": 10,
            "scale_memory_limit": "4G",
            "scale_min_instances": 0,
            "scale_request_timeout": 300,
            "status": "ready",
            "status_details": [
              {
                "latest_created_revision": "test-project-app-00001",
                "latest_ready_revision": "test-project-app-00001",
                "reason": ""
              }
            ],
            "timeouts": null
          },
          "sensitive_attributes": [],
          "private": "xyz",
          "dependencies": [
            "ibm_code_engine_project.ce_project"
          ]
        }
      ]
    },

Terraform CLI and Terraform IBM Provider Version

Terraform v1.5.7
on darwin_amd64
+ provider registry.terraform.io/ibm-cloud/ibm v1.63.0

Affected Resource(s)

  • ibm_code_engine_app

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "ibm_resource_group" "resourceGroup" {
  name     = "test-code-engine"
}

resource "ibm_code_engine_project" "ce_project" {
  name              = "test-project-name"
  resource_group_id = resource.ibm_resource_group.resourceGroup.id
}

resource "ibm_code_engine_app" "ce_app" {
  project_id      = resource.ibm_code_engine_project.ce_project.project_id
  name            = "test-project-app"
  image_reference = "icr.io/codeengine/helloworld"
}

Debug Output

https://gist.github.com/akocbek/e86322bc356b47b9a9ffd61a245bfacd

--->

Panic Output

Expected Behavior

On second apply the existing env variables shouldn't change

Actual Behavior

On second apply the existing env variables are forced to change.

Steps to Reproduce

  1. terraform apply
  2. terraform apply

Important Factoids

References

  • #0000

akocbek avatar Mar 19 '24 14:03 akocbek

Hey @akocbek,

thanks for reporting the issue. We are aware and there is another issue that raised this problem a while back: https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4719 I suggest you comment in there to add an additional data point for us and we can close this issue to keep everything in one spot. In case you have any other problem please feel free to raise it in this repo.

michael-magrian avatar Mar 19 '24 15:03 michael-magrian

Thank you @michael-magrian . Is there any ETA to fix that behavior?

akocbek avatar Mar 20 '24 14:03 akocbek

Can't really give you a feasible ETA, sorry. I will update the issue https://github.com/IBM-Cloud/terraform-provider-ibm/issues/4719 when I have more information, as soon as I have any.

michael-magrian avatar Mar 20 '24 21:03 michael-magrian

Hi @akocbek, while we continue to work on a fix for this issue, we have updated the Code Engine documentation to include a troubleshooting page on working around this issue: https://cloud.ibm.com/docs/codeengine?topic=codeengine-ts-terraform-environment-variables

I hope this can be of some help until our fix is complete

jaksart1 avatar May 07 '24 15:05 jaksart1