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

Unable to import existing data forwarding rules #701

Open
eambrosyupgrade opened this issue Nov 4, 2024 · 2 comments
Open

Unable to import existing data forwarding rules #701

eambrosyupgrade opened this issue Nov 4, 2024 · 2 comments
Labels

Comments

@eambrosyupgrade
Copy link

Terraform Version

% terraform --version
Terraform v1.9.2
on darwin_arm64
+ provider registry.terraform.io/sumologic/sumologic v2.31.5

Affected Resource(s)

sumologic_data_forwarding_rule

Terraform Configuration Files

import {
  to = sumologic_data_forwarding_rule.test_rule
  id = "[rule id]"
}

resource "sumologic_data_forwarding_rule" "test_rule" {
  index_id       = partition.id
  destination_id = destination.id
  enabled        = true
  payload_schema = "builtInFields"
  format         = "csv"
}

I am unable to import my existing configuration. I am able to pull down the ID from the API of this rule.

>>> r = requests.get(f'{base_url}/logsDataForwarding/rules', auth=auth)
>>> for x in r.json()['data']:
...   if x['bucket']['destinationName'] == 'MY-DESTINATION-NAME':
...     print(x['id'])
... 
[rule id]

Debug Output

│ Error: Cannot import non-existent remote object
│ 
│ While attempting to import an existing object to "sumologic_data_forwarding_rule.test_rule", the
│ provider detected that no object exists with the given id. Only pre-existing objects can be
│ imported; check that the id is correct and that it is associated with the provider's configured
│ region or endpoint, or use "terraform apply" to create a new remote object for this resource.

Expected Behavior

I should be able to import data forwarding rules into terraform

Actual Behavior

Plan fails as its unable to find the id

Steps to Reproduce

  • Create a data forwarding rule.
  • Attempt to import it into terraform

It looks like you aren't supporting id's for rules?

func resourceToDataForwardingRule(d *schema.ResourceData) DataForwardingRule {
return DataForwardingRule{
IndexId: d.Get("index_id").(string),
DestinationId: d.Get("destination_id").(string),
Enabled: d.Get("enabled").(bool),
FileFormat: d.Get("file_format").(string),
PayloadSchema: d.Get("payload_schema").(string),
Format: d.Get("format").(string),
}

@eambrosyupgrade
Copy link
Author

This issue was identified in a PR which was not merged here

It looks like it was "resovled" in this review comment #688 (comment) & #688 (comment) but I don't believe this is correct. based on being unable to import a rule.

@dlinsumo
Copy link
Collaborator

dlinsumo commented Nov 8, 2024

Internal jira SUMO-250676

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

No branches or pull requests

2 participants