Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Removing the instana terraform code, resulted in an error when removing the resources #139

Closed
alexross1988 opened this issue Sep 1, 2022 · 2 comments

Comments

@alexross1988
Copy link

We've seen an issue where we were testing some new change using the Instana Terraform provider.
It would create three resources for us instana_alerting_channel_pager_duty, instana_custom_event_spec_threshold_rule and instana_alerting_config. That would be fine. We'd then revert back to our previous Terraform config and expect these resources to all be removed but we get this error:

10:29:18  ��� Warning: Value for undeclared variable
10:29:18  ��� 
10:29:18  ��� The root module does not declare a variable named "instana_alert_filter"
10:29:18  ��� but a value was found in file "terraform.tfvars". If you meant to use this
10:29:18  ��� value, add a "variable" block to the configuration.
10:29:18  ��� 
10:29:18  ��� To silence these warnings, use TF_VAR_... environment variables to provide
10:29:18  ��� certain "global" settings to all configurations in your organization. To
10:29:18  ��� reduce the verbosity of these warnings, use the -compact-warnings option.
10:29:18  ���
10:29:18  ���
10:29:18  ��� Warning: Value for undeclared variable
10:29:18  ��� 
10:29:18  ��� The root module does not declare a variable named "instana_token" but a
10:29:18  ��� value was found in file "terraform.tfvars". If you meant to use this value,
10:29:18  ��� add a "variable" block to the configuration.
10:29:18  ��� 
10:29:18  ��� To silence these warnings, use TF_VAR_... environment variables to provide
10:29:18  ��� certain "global" settings to all configurations in your organization. To
10:29:18  ��� reduce the verbosity of these warnings, use the -compact-warnings option.
10:29:18  ���
10:29:18  ���
10:29:18  ��� Warning: Values for undeclared variables
10:29:18  ��� 
10:29:18  ��� In addition to the other similar warnings shown, 1 other variable(s)
10:29:18  ��� defined without being declared.
10:29:18  ���
10:29:18  ���
10:29:18  ��� Error: Missing required argument
10:29:18  ��� 
10:29:18  ��� The argument "endpoint" is required, but was not set.
10:29:18  ���
10:29:18  ���
10:29:18  ��� Error: Missing required argument
10:29:18  ��� 
10:29:18  ��� The argument "api_token" is required, but was not set.
10:29:18  ���

We thought one workaround might be to just include the provider in our Terraform code, even though we weren't using it, as that would set endpoint and api_token but even doing that did not work.

Long term we're going to keep the Instana config in, so we've just sped up getting our changes merged into master to that Terraform does not try to remove any resources and things keep working. This still felt odd though and could effect things in the future should we wish to remove a resource.

@gessnerfl
Copy link
Owner

Hi @alexross1988,

my understanding is, that you created some terraform config with resources using the instana provider, applied them and then reverted the whole configuration including the provider config and expected the resources to be deleted. Is this correct?
This wouldn't work and would not be an issue of the provider implementation. You first need to remove the resources but keep the provider configuration so that the provider actually can delete the created resources. Afterwards you can remove the remaining part. Otherwise terraform including the instana provider cannot properly determine and apply changes.
I use the provider in production for a long period of time and so far never had issues with removing resources.

@gessnerfl
Copy link
Owner

Closing the issue after more than 6month of inactivity and without receiving feedback.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants