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

No account_id in import of newrelic_alert_policy_channel #1862

Closed
6 tasks done
tamirFireFly opened this issue Jun 23, 2022 · 1 comment
Closed
6 tasks done

No account_id in import of newrelic_alert_policy_channel #1862

tamirFireFly opened this issue Jun 23, 2022 · 1 comment

Comments

@tamirFireFly
Copy link

tamirFireFly commented Jun 23, 2022

Hi there,

Im trying to import newrelic_alert_policy_channel and in imports it but dont put the account_id in the ft_state. In the code it seems to take from the provider config. In other resources like newrelic_one_dashboard_raw account_id works well (I see in the code it reads from the sdk client and not the provider config the account_id).
This is my provider config

provider "newrelic" {
  account_id = "*******"
  region = "US" 
  api_key = "NRAK-**************"
}

This is tf state after import

{
  "version": 4,
  "terraform_version": "1.2.3",
  "serial": 1,
  "lineage": "***********",
  "outputs": {},
  "resources": [
    {
      "mode": "managed",
      "type": "newrelic_alert_policy_channel",
      "name": "foo",
      "provider": "provider[\"registry.terraform.io/newrelic/newrelic\"]",
      "instances": [
        {
          "schema_version": 1,
          "attributes": {
            "account_id": null,
            "channel_ids": [
              *******
            ],
            "id": "policyId:channelId",
            "policy_id": ******
          },
          "sensitive_attributes": [],
          "private": "******"
        }
      ]
    }
  ]
}

Maybe it also reproduced in another resources too. I hope i can get the real account id in the tf state on such import.
Thanks in advance :)

⚠️ Important: Failure to include the following, such as omitting the Terraform configuration in question, may delay resolving the issue.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Affected Resource(s)

Please list the resources as a list, for example:

  • newrelic_alert_policy
  • newrelic_alert_channel

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration

Please include your provider configuration (sensitive details redacted) as well as the configuration of the resources and/or data sources related to the bug report.

Terraform v1.2.3
on darwin_arm64
+ provider registry.terraform.io/newrelic/newrelic v2.47.0

Actual Behavior

What actually happened?

Expected Behavior

What should have happened?

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Init provider
  2. Config policy channel like in the documentation of terraform
  3. Try tf import it in another folder (after terraform init there with same provider configruatino)

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

@mbazhlekova
Copy link
Contributor

Hi @tamirFireFly 👋 this resource uses our legacy REST API which doesn't return the account ID in the payload. That's why it's not imported into the TF state.

@kidk kidk closed this as completed Aug 1, 2022
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

No branches or pull requests

3 participants