Git Product home page Git Product logo

terraform-provider-qovery's Introduction

Qovery Terraform Provider

Requirements

  • Terraform >= 1.0
  • Go >= 1.19 (to build the provider)
  • Task v3 (to run Taskfile commands)
  • jq (to parse json from curl api calls)

Building The Provider

  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the task build command:
task build

Developing The Provider

If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).

To compile the provider, run the task build command:

task build

This will build the provider and put the provider binary in the repository /bin folder.

To be able to use the compiled provider binary, you will need to create a development override for this provider in your ~/.terraformrc pointing to the repository /bin folder. To create a development override, run the task install-dev-override command:

task install-dev-override

When you are finished using the compiled version of the provider, you can safely remove the ~/.terraformrc file. To remove a development override, run the task uninstall-dev-override command:

task uninstall-dev-override

Testing The Provider

In order to run the full suite of Acceptance tests, run task testacc command:

task testacc

Note: Acceptance tests create real resources, and often cost money to run.

The acceptance tests require a QOVERY_API_TOKEN environment variable to be set. It corresponds to your JWT token on the Qovery's console and can be acquired using the qovery-cli with the following command (needs jq):

qovery auth ; cat ~/.qovery/context.json | jq .access_token | cut -d '"' -f2 | sed 's/.*Authorization: Bearer \(*\)/\1/' | tr -d '\n'

This JWT needs to be put inside a .env file at the root of the repository. You can use the .env.example file as a base for you file.

QOVERY_API_TOKEN=<qovery-api-token>

Note: API tokens can be generated via the qovery-cli command qovery token.

In order to run the tests with extra debugging context, prefix with TF_LOG (see the terraform documentation for details).

TF_LOG=trace task testacc

To run a specific set of tests, use the -run flag and specify a regex pattern matching the test names.

task testacc -- -run 'TestAcc_Organization*'

Using Intellij IDEA Debugger

To be able to add breakpoints in you code and use the debugger provided by Intellij IDEA, you'll need to add --debug in Program arguments field in Idea configuration.

Once you run the project in debug mod, you'll find a line in terminal looking like TF_REATTACH_PROVIDERS='{"registry.terraform.io/Qovery/qovery":{"Protocol":"grpc","ProtocolVersion":6,"Pid":591078,"Test":true,"Addr":{"Network":"unix","String":"/tmp/plugin1516819738"}}}'

Copy and export this environment variable in the terminal you use to run Terraform Commands. Use any Terraform command in this terminal and Idea will listen to it and stop on breakpoints you set.

Generating The Provider Documentation

The documentation is autogenerated from Description fields within the provider, and the examples directory. Generating the documentation creates markdown in the docs folder, ready for deployment to Hashicorp. To generate the documentation, run the task docs command:

NOTE: To generate the documentation you need to have provided the environment variable QOVERY_API_TOKEN as it uses the api to fetch some data present in the doc.

task docs

You can preview the generated documentation by copying /docs Markdown file content into this preview tool.

terraform-provider-qovery's People

Contributors

benamib avatar benjaminch avatar deimosfr avatar dependabot[bot] avatar erebe avatar evoxmusic avatar maclikorne avatar mzottola avatar pggb25 avatar pjeziorowski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

terraform-provider-qovery's Issues

Smaller network for the cluster VPC

I want to put a smaller network to connect it to our infrastructure

Like this: 10.85.86.0/23

Response:
Could not create cluster 'test-dev', unexpected error: 400 Bad Request - Invalid Config: Invalid VPC IP: The VPC Subnet 10.85.86.0/23 is not valid.

Application deployment failure

Hello there πŸ––

There is apparently no way to deploy multiple application simultaneously. Actually, we need to set up depends_on attributes in order to serialize the whole deployment.

Also, deploying applications in a "STOPPED" state raises an exception about not being able to stop an application which is aleady stopped. It is automatically trying to stop it even if it's deployed as stopped isn't it ?

Thank you for your reading : )

Include terraform output in terraform resources

This is a useful feature to have.

  • I want to be able to export the output values of my resources and persist it in my statefile. If these values are in the statefile, then it can be read using the terraform data function from another terraform process.
  • Also terraform outputs are useful for debugging and diagnostic purposes

Use built-in environment variables into app

Hi @benamib πŸ‘‹πŸ½ ,

When using the Terraform provider with a database and an application. It's impossible to bind the application to the database without knowing the built-in environment variables and secrets injected at the Environment level. It would be great to have a way to predetermine those environment variables inject them into the application.

Here is a design suggestion:

resource "qovery_database" "psql" {
  //...
}

resource "qovery_application" "backend" {
  // ...
  environment_variables = [
    {
      key = "HOST"
      value = qovery_database.psql.internal_host
    }
  ] 
}

Note: the built-in environment variables can be known only after the database creation.

cc @alecarrano @florianlepont

Environment variable scope definition

Hi mates πŸƒ

We would like to share with you a proposal concerning the creation of environment variables.

We think it would be nice to have a scope field in this nested schema with the following possible values :

  • APPLICATION
  • ENVIRONMENT
  • PROJECT

Currently, this scope is defined according to whether the resource is an application or an environment.
Unfortunately we sometimes need to define an INTERNAL_HOST in an environment scope (e.g. databases, proxy applications, etc.) and this is not possible because the environment must be defined beforehand to be able to refer to it in the application or database definition.

Is this request accessible and at least understandable ?
Apologies for the lack of specific diagrams/examples, I will work on it if necessary.

Qovery Container Registry runtime error

When applying the qovery_container_registry, I get a runtime error:

resource "qovery_container_registry" "dockerhub" {
  organization_id = var.qovery_organization_id
  name            = "Dockerhub"
  kind            = "DOCKER_HUB"
  url             = "https://docker.io"
}
qovery_container_registry.dockerhub: Creating...                                                                                                                                                                                                              
β•·                                                                                                                                                                                                                                                             
β”‚ Error: Plugin did not respond                                                                                                                                                                                                                               
β”‚                                                                                                                                                                                                                                                             
β”‚ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.                                                                                                   
β•΅                                                                                                                                                                                                                                                             
β•·                                                                                                                                                                                                                                                             
β”‚ Error: Plugin did not respond                                                                                                                                                                                                                               
β”‚                                                                                                                                                                                                                                                             
β”‚ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.                                                                                                   
β•΅                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                              
Stack trace from the terraform-provider-qovery_v0.14.1 plugin:                                                                                                                                                                                                
                                                                                                                                                                                                                                                              
panic: runtime error: invalid memory address or nil pointer dereference                                                                                                                                                                                       
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xc94b0e]                                                                                                                                                                                        
                                                                                                                                                                                                                                                              
goroutine 55 [running]:                                                                                                                                                                                                                                       
github.com/qovery/terraform-provider-qovery/qovery.ContainerRegistry.toUpsertRequest({{0x1, 0x0, {0x0, 0x0}}, {0x0, 0x0, {0xc000720180, 0x24}}, {0x0, 0x0, ...}, ...})                                                                                        
        github.com/qovery/terraform-provider-qovery/qovery/resource_container_registry_model.go:45 +0xee                                                                                                                                                      
github.com/qovery/terraform-provider-qovery/qovery.containerRegistryResource.Create({{_, _}}, {_, _}, {{{{0x1054028, 0xc000621950}, {0xdb0580, 0xc000621380}}, {0xc0004dc4e0, 0x0, ...}}, ...}, ...)                                                          
        github.com/qovery/terraform-provider-qovery/qovery/resource_container_registry.go:154 +0x158                                                                                                                                                          
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0xc0002a8160, {0x104fbe0, 0xc000620d20}, 0xc000807410, 0xc0008073b0)                                                                                               
        github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:97 +0x8ce                                                                                                                                          
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x104fbe0?, {0x104fbe0, 0xc000620d20}, 0xc000356780, 0xc000807580)                                                                                            
        github.com/hashicorp/[email protected]/internal/fwserver/server_applyresourcechange.go:54 +0x4a8                                                                                                                                     
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0xc0002a8160, {0x104fbe0?, 0xc000620bd0?}, 0xc000356550)                                                                                                  
        github.com/hashicorp/[email protected]/internal/proto6server/server_applyresourcechange.go:52 +0x27b                                                                                                                                 
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc0006e61e0, {0x104fbe0?, 0xc0006203f0?}, 0xc0006f41c0)                                                                                                           
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:816 +0x574                                                                                                                                                             
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0xea6740?, 0xc0006e61e0}, {0x104fbe0, 0xc0006203f0}, 0xc0006f4000, 0x0)                                                                          
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:385 +0x170                                                                                                                                         
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000cc000, {0x1054318, 0xc000174b60}, 0xc0002e6480, 0xc0000b7e00, 0x168e300, 0x0)                                                                                                                         
        google.golang.org/[email protected]/server.go:1295 +0xb2b                                                                                                                                                                                                  
google.golang.org/grpc.(*Server).handleStream(0xc0000cc000, {0x1054318, 0xc000174b60}, 0xc0002e6480, 0x0)                                                                                                                                                     
        google.golang.org/[email protected]/server.go:1636 +0xa2f                                                                                                                                                                                                  
google.golang.org/grpc.(*Server).serveStreams.func1.2()                                                                                                                                                                                                       
        google.golang.org/[email protected]/server.go:932 +0x98                                                                                                                                                                                                    
created by google.golang.org/grpc.(*Server).serveStreams.func1                                                                                                                                                                                                
        google.golang.org/[email protected]/server.go:930 +0x28a                                                                                                                                                                                                   
                                                                                                                                                                                                                                                              
Error: The terraform-provider-qovery_v0.14.1 plugin crashed!                                                                                                                                                                                                  
                                                                                                                                                                                                                                                              
This is always indicative of a bug within the plugin. It would be immensely                                                                                                                                                                                   
helpful if you could report the crash with the plugin's maintainers so that it                                                                                                                                                                                
can be fixed. The output above should help diagnose the issue. 

Secret environment variables

Hello mates πŸƒ

Concerning the use of environment variables, we wanted to know if it was planned to allow the recovery of secrets, for example we want to create an alias on the URL of a managed database.
Unfortunately we have access problems :

image

image

Is there already a roadmap about this ?

Outdated Terraform documentation

Hi @benamib πŸ‘‹πŸ½ ,

The Qovery Terraform provider documentation is sometimes not correct. Some resource parameters are not flagged as "mandatory" when they must. Can we update the Terraform provider?

Project creation error if environment variables are not set

Hi @benamib πŸ‘‹πŸ½ ,

Environment variables must be optional. If we do not specify them at the project level (probably the same for Environment and Application) then the terraform apply crashes. Here is the error:

(venv) ~/I/q/c/romaric $ terraform apply
qovery_aws_credentials.romaric_aws_creds: Refreshing state...
qovery_cluster.my_test_cluster: Refreshing state... 

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  + create

Terraform will perform the following actions:

  # qovery_project.proj_test will be created
  + resource "qovery_project" "proj_test" {
      + description           = "test"
      + environment_variables = [
        ] -> (known after apply)
      + id                    = (known after apply)
      + name                  = "TestProj"
      + organization_id       = "<hidden>"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

qovery_project.proj_test: Creating...
β•·
β”‚ Error: Value Conversion Error
β”‚ 
β”‚   with qovery_project.proj_test,
β”‚   on main.tf line 36, in resource "qovery_project" "proj_test":
β”‚   36: resource "qovery_project" "proj_test" {
β”‚ 
β”‚ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the
β”‚ following to the provider developer:
β”‚ 
β”‚ unhandled unknown value
β•΅

My workaround at the moment is to initialize the environment_variables array.

...
resource "qovery_project" "proj_test" {
  organization_id       = var.organization_id
  name                  = "TestProj"
  environment_variables = []
}

Can you fix it? Thx

Cannot override environment variable

Hi there πŸƒ

We just encountered an issue about overriding environment variables.
This is something we can do on the web console interface but there's an issue through the terraform provider :

qovery_application.exa_app_ms_syncer: Creation complete after 1s [id=6d9eb82b-5190-4317-8bcc-a48e17e4b896]
β•·
β”‚ Error: Error on application environment variable create
β”‚ 
β”‚   with qovery_application.exa_app_finance_web_app,
β”‚   on exa_services.tf line 1135, in resource "qovery_application" "exa_app_finance_web_app":
β”‚ 1135: resource "qovery_application" "exa_app_finance_web_app" {
β”‚ 
β”‚ Could not create application environment variable
β”‚ 'EXA_APP_WEBSOCKET_PROTOCOL', unexpected error: 409 Conflict - Variable
β”‚ already exists: EXA_APP_WEBSOCKET_PROTOCOL
β•΅
Operation failed: failed running terraform apply (exit 1)

We want to override this EXA_APP_WEBSOCKET_PROTOCOL variable because it will be 'ws' for internal services and 'wss' for external services.
We used to do it like that with the console.

Do you think there is a simple way to quickly fix it on the provider or do we have to work with multiple services dedicated variables ?

Environment variables set to the empty string "" error out

resource "qovery_container" "some-container" {

  environment_variables = [
    {
      key = "FOO"
      value = ""
    },
  ]
}

Will result in:

β•·
β”‚ Error: Error on container create line 417
β”‚
β”‚   with qovery_container.registry-cache-container,
β”‚   on qovery.tf line 109, in resource "qovery_container" "registry-cache-container":
β”‚  109: resource "qovery_container" "registry-cache-container" {
β”‚
β”‚ failed to create container: invalid container upsert request: invalid variable diff request: invalid
β”‚ variable upsert request: Key: 'UpsertRequest.Value' Error:Field validation for 'Value' failed on the
β”‚ 'required' tag

(as the Value: "" seem to be dropped from the struct before / during validation, resulting in the validator complaining as it is marked required).

Note: this is useful when a container sets an env variable by default (eg: in the Dockerfile), and you want to change that to "".

Not possible to delete a credential with terraform provider

I tried to delete a credential (created with the same token) with terraform provider but it's not possible

Terraform will perform the following actions:

  # qovery_aws_credentials.xxxxxx will be destroyed
  # (because qovery_aws_credentials.xxxxxxx is not in configuration)
  - resource "qovery_aws_credentials" "altair" {
      - access_key_id     = (sensitive value)
      - id                = "xxxxxxxx" -> null
      - name              = "xxxxxxxx" -> null
      - organization_id   = "xxxxxxxx" -> null
      - secret_access_key = (sensitive value)
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

qovery_aws_credentials.xxxxxxx: Destroying... [id=xxxxxxxx]
β•·
β”‚ Error: Error on aws credentials delete
β”‚ 
β”‚ Could not delete aws credentials 'xxxxxxxx', unexpected error: 403 Forbidden - No message available

Get the VPC ID in the cluster ressource

Let the possibility to get the vpc_id (subnet, ...) in the qovery_cluster ressource

We need to make some change in our vpc network

quovery_cluster ressource datas

{
"cloud_provider" = "AWS"
"credentials_id" = "xxxxxx-xxxxxx-xxxxxx"
"description" = ""
"features" = {
"vpc_subnet" = "10.0.0.0/16"
}
"id" = "xxxxxx-xxxxxx-xxxxxx"
"instance_type" = "T3_LARGE"
"max_running_nodes" = 10
"min_running_nodes" = 3
"name" = "test-dev"
"organization_id" = "xxxxxx-xxxxxx-xxxxxx"
"region" = "eu-central-1"
"state" = "RUNNING"
}

SIGSEGV if `qovery_container_registry` miss `config`

resource "qovery_container_registry" "ghcr" {
  # Required
  organization_id = var.organization_id
  name            = "Foo"
  kind            = "PUBLIC_ECR"
  url             = "bar.io"

}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x1055ddd04]

goroutine 14 [running]:
github.com/qovery/terraform-provider-qovery/qovery.ContainerRegistry.toUpsertRequest({{0x1, 0x0, {0x0, 0x0}}, {0x0, 0x0, {0x140001c63c0, 0x24}}, {0x0, 0x0, ...}, ...})
	github.com/qovery/terraform-provider-qovery/qovery/resource_container_registry_model.go:45 +0xd4
github.com/qovery/terraform-provider-qovery/qovery.containerRegistryResource.Create({{_, _}}, {_, _}, {{{{0x105991f80, 0x14000382180}, {0x10585a580, 0x14000725b90}}, {0x140004b28d0, 0x0, ...}}, ...}, ...)
	github.com/qovery/terraform-provider-qovery/qovery/resource_container_registry.go:154 +0x140
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0x14000228160, {0x10598db40, 0x14000725530}, 0x140007b33e0, 0x140007b3380)
	github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:97 +0x540
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x10598db40?, {0x10598db40, 0x14000725530}, 0x140008065a0, 0x140007b3550)
	github.com/hashicorp/[email protected]/internal/fwserver/server_applyresourcechange.go:54 +0x370
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0x14000228160, {0x10598db40?, 0x140007253e0?}, 0x14000806550)
	github.com/hashicorp/[email protected]/internal/proto6server/server_applyresourcechange.go:52 +0x1a4
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0x1400015a0a0, {0x10598db40?, 0x14000724c00?}, 0x140000e6930)
	github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:816 +0x3b8
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x10594b8a0?, 0x1400015a0a0}, {0x10598db40, 0x14000724c00}, 0x140000e6850, 0x0)
	github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x140002ca000, {0x105992258, 0x140002949c0}, 0x140007038c0, 0x140002b8c60, 0x105f854c0, 0x0)
	google.golang.org/[email protected]/server.go:1295 +0x9c4
google.golang.org/grpc.(*Server).handleStream(0x140002ca000, {0x105992258, 0x140002949c0}, 0x140007038c0, 0x0)
	google.golang.org/[email protected]/server.go:1636 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/[email protected]/server.go:932 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:930 +0x290

Points to https://github.com/Qovery/terraform-provider-qovery/blob/main/qovery/resource_container_registry_model.go#L45

where very likely Config is nil.

Qovery provider cannot access the account of the git account

Hi there 🐼

Since we switched on v0.4.1, we started to encounter a new issue about accessing the git account when creating new applications resources.

β”‚ Error: Error on application create
β”‚ 
β”‚   with qovery_application.exa_app_crossbar,
β”‚   on exa_services.tf line 356, in resource "qovery_application" "exa_app_crossbar":
β”‚  356: resource "qovery_application" "exa_app_crossbar" {
β”‚ 
β”‚ Could not create application 'crossbar', unexpected error: 424 Failed
β”‚ Dependency - Cannot access the account of the provided git account:
β”‚ https://github.com/exa-finance/exa-app.git cannot get last commit id for
β”‚ branch reverse-proxy

TOPO

  • The reverse-proxy git branch exists βœ”οΈ
  • qovery auth for auth token refresh βœ”οΈ
  • qovery token for api token refresh, stored on terraform cloud βœ”οΈ

Any suggestions ? πŸƒ

Provider crash

Hey there!

οΏ½[31mβ•·οΏ½[0mοΏ½[0m
οΏ½[31mβ”‚οΏ½[0m οΏ½[0mοΏ½[1mοΏ½[31mError: οΏ½[0mοΏ½[0mοΏ½[1mPlugin did not respondοΏ½[0m
οΏ½[31mβ”‚οΏ½[0m οΏ½[0m
οΏ½[31mβ”‚οΏ½[0m οΏ½[0mοΏ½[0mThe plugin encountered an error, and failed to respond to the
οΏ½[31mβ”‚οΏ½[0m οΏ½[0mplugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
οΏ½[31mβ”‚οΏ½[0m οΏ½[0mcontain more details.
οΏ½[31mβ•΅οΏ½[0mοΏ½[0m

Stack trace from the terraform-provider-qovery_v0.15.0 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xccfb9b]

goroutine 71 [running]:
github.com/qovery/terraform-provider-qovery/qovery.fromGoValueToTfValue({0xd775a0?, 0xc000414ae0?}, {0x0?, 0x0?})
	github.com/qovery/terraform-provider-qovery/qovery/types_conversions.go:263 +0x39b
github.com/qovery/terraform-provider-qovery/qovery.fromStringMap(0xc000244158)
	github.com/qovery/terraform-provider-qovery/qovery/types_conversions.go:302 +0x25d
github.com/qovery/terraform-provider-qovery/qovery.convertResponseToCluster(_)
	github.com/qovery/terraform-provider-qovery/qovery/resource_cluster_model.go:193 +0x3e5
github.com/qovery/terraform-provider-qovery/qovery.clusterResource.Create({_}, {_, _}, {{{{0x10862c8, 0xc0008e09c0}, {0xdd9bc0, 0xc0008d1bf0}}, {0xc000557f80, 0x0, 0x0, ...}}, ...}, ...)
	github.com/qovery/terraform-provider-qovery/qovery/resource_cluster.go:373 +0x16e
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).CreateResource(0xc0002a8160, {0x1081d60, 0xc0008d0f60}, 0xc000161360, 0xc000161300)
	github.com/hashicorp/[email protected]/internal/fwserver/server_createresource.go:97 +0x8ce
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ApplyResourceChange(0x1081d60?, {0x1081d60, 0xc0008d0f60}, 0xc00061dd10, 0xc0001614d0)
	github.com/hashicorp/[email protected]/internal/fwserver/server_applyresourcechange.go:54 +0x4a8
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ApplyResourceChange(0xc0002a8160, {0x1081d60?, 0xc0008d0e10?}, 0xc00061dcc0)
	github.com/hashicorp/[email protected]/internal/proto6server/server_applyresourcechange.go:52 +0x27b
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000194140, {0x1081d60?, 0xc0008d0450?}, 0xc0007873b0)
	github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:816 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0xed3480?, 0xc000194140}, {0x1081d60, 0xc0008d0450}, 0xc000787340, 0x0)
	github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00049e000, {0x10865b8, 0xc0006824e0}, 0xc0008bfe60, 0xc0002008d0, 0x16d67a0, 0x0)
	google.golang.org/[email protected]/server.go:1340 +0xd23
google.golang.org/grpc.(*Server).handleStream(0xc00049e000, {0x10865b8, 0xc0006824e0}, 0xc0008bfe60, 0x0)
	google.golang.org/[email protected]/server.go:1713 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/[email protected]/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:963 +0x28a

Error: The terraform-provider-qovery_v0.15.0 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Bug in Terraform provide in switching auto-preview on

I have a child module that looks like this

resource "qovery_application" "docker_application" {
  environment_id = qovery_environment.my_environment.id
  name           = var.app_name
  git_repository = {
    url       = var.git_url
    branch    = var.branch    # Optional
    root_path = var.root_path # Optional
  }

  build_mode            = var.docker_build_mode
  dockerfile_path       = var.dockerfile_path
  state                 = var.state
  auto_preview          = var.auto_preview
  cpu                   = var.cpu
  memory                = var.memory
  min_running_instances = var.min_running_instances
  max_running_instances = var.max_running_instances
  ports = [
    {
      internal_port       = var.application_internal_port
      external_port       = var.application_external_port
      protocol            = var.application_protocol
      publicly_accessible = var.application_publicly_accessible
    }
  ]
  secrets = var.application_secrets
}

variable "auto_preview" { default = false type = bool }

My root module (which calls the child module) looks like this

module "qovery_app" {

  source = "./modules/qovery/app-docker"

  app_name = "sample-app"

  git_url = "https://github.com/ABC/qovery-sample-app.git"

  branch = "develop"

  min_running_instances = 1

  max_running_instances = 1

  qovery_environment_mode = "DEVELOPMENT"

  qovery_environment_name = "infra-dev"

  qovery_token = var.qovery_token

  application_internal_port = 5555

  auto_preview = true

  application_secrets = [
    {
      key   = "DUMMY_SECRET_KEY"
      value = "DUMMY_SECRET_VALUE"
    },
    {
      key   = "DUMMY_SECRET_KEY2"
      value = "DUMMY_SECRET_VALUE2"
    }
  ]
}

when i execute terraform, i get the following errors

β”‚ Error: Provider produced inconsistent result after apply β”‚ β”‚ When applying changes to β”‚ module.qovery_app.qovery_application.docker_application, provider β”‚ "module.qovery_app.provider[\"registry.terraform.io/qovery/qovery\"]" β”‚ produced an unexpected new value: .auto_preview: was cty.True, but now β”‚ cty.False. β”‚ β”‚ This is a bug in the provider, which should be reported in the provider's β”‚ own issue tracker. β•΅ Operation failed: failed running terraform apply (exit 1)

The problem is that there is bug in the terraform provider to switch auto preview ON while creating an environment or even modifying an environment.

terraform plan failed after upgrade

After upgrading to the latest version (0.17.1) terraform plan starts failing with the following message.

Planning failed. Terraform encountered an error while generating this plan.
β”‚
β”‚ Error: Provider produced invalid plan
β”‚
β”‚ Provider "registry.terraform.io/qovery/qovery" planned an invalid value for
β”‚ module.environment["Staging"].qovery_application.app.secrets: count in plan (cty.UnknownVal(cty.Number)) disagrees with count in
β”‚ config (cty.NumberIntVal(8)).
β”‚
β”‚ This is a bug in the provider, which should be reported in the provider's own issue tracker.
β”‚
β”‚
β”‚ Error: Provider produced invalid plan
β”‚
β”‚ Provider "registry.terraform.io/qovery/qovery" planned an invalid value for
β”‚ module.environment["Staging"].qovery_application.app.environment_variables: count in plan (cty.UnknownVal(cty.Number)) disagrees with
β”‚ count in config (cty.NumberIntVal(8)).
β”‚
β”‚ This is a bug in the provider, which should be reported in the provider's own issue tracker.
β”‚

Unable to set secrets on a job

β”‚ Error: Error on job update
β”‚ failed to update job: invalid job upsert request: invalid secrets diff request: invalid secrets upsert request: Key: 'UpsertRequest.Value' Error:Field validation for 'Value'
β”‚ failed on the 'required' tag

I'm trying to set secrets on a new qovery_job. I'm setting secrets for the job exactly how I'm setting them for a qovery_application but it fails. I tried both when creating the job and when that didn't work I created the job with no secrets and tried to add them as a change and I got the exact same error. Setting environment variables works.

We're running in AWS with the tfstate stored in s3. Let me know if there any any other details you need to reproduce.

Provider produced inconsistent result after apply

Hello there πŸƒ

We are deploying our full stack in STOPPED state using the provider and it's producing an unexpected behaviour for the very last deploying application.

β”‚ Error: Provider produced inconsistent result after apply
β”‚
β”‚ When applying changes to qovery_application.exa_app_finance_web_app,
β”‚ provider "provider["registry.terraform.io/qovery/qovery"]" produced an
β”‚ unexpected new value: .state: was cty.StringVal("STOPPED"), but now
β”‚ cty.StringVal("RUNNING").
β”‚
β”‚ This is a bug in the provider, which should be reported in the provider's
β”‚ own issue tracker.
Operation failed: failed running terraform apply (exit 1)

The stack is deployed this way :
image

We checked the terraform plan logs and we have this last application 'finance-web-app' deployed with the correct settings :

  + state                          = "STOPPED"

Do you have something in mind about this ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.