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

Creating opslevel_service using v0.11.0 is failing #304

Open
oponomarov-tu opened this issue Apr 19, 2024 · 4 comments
Open

Creating opslevel_service using v0.11.0 is failing #304

oponomarov-tu opened this issue Apr 19, 2024 · 4 comments

Comments

@oponomarov-tu
Copy link

We've been using v0.11.0 successfully in the last couple of weeks. Since recently, when adding new opslevel_service resource with lifecycle { ignore_changes = ... } it started to fail. This is not the first time we can not use a locked-down provider version to manage existing resources or create new ones with same configuration.

Example HCL:

resource "opslevel_service" "kafka" {
  for_each = {
    for topic in local.kafka_topics : topic.topicName => topic
  }
  name = each.value.topicName

  description = "Kafka topic {each.value.topicName}"
  framework   = "kafka"
  language    = "kafka"
  product     = "<redacted>"

  tags = ["kafka_topic:True"]
  lifecycle {
    ignore_changes = [
      description,
      owner,
    ]
  }
}

Terraform apply:

$ terraform apply -target='opslevel_service.kafka["<redacted>"]'

...

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:

  # opslevel_service.kafka["<redacted>"] will be created
  + resource "opslevel_service" "kafka" {
      + description  = "Kafka topic {each.value.topicName}"
      + framework    = "kafka"
      + id           = (known after apply)
      + language     = "kafka"
      + last_updated = (known after apply)
      + name         = "<redacted>"
      + product      = "<redacted>"
      + tags         = [
          + "kafka_topic:True",
        ]
    }

Plan: 1 to add, 0 to change, 0 to destroy.
╷
│ Warning: Resource targeting is in effect
│
│ You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration.
│
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵

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

opslevel_service.kafka["<redacted>"]: Creating...
╷
│ Warning: Applied changes may be incomplete
│
│ The plan was created with the -target option in effect, so some changes requested in the configuration may have been ignored and the output values may not be fully updated. Run the following command to verify that no other changes are pending:
│     terraform plan
│
│ Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵
╷
│ Error: OpsLevel API Errors:
│       - 'lifecycleAlias' '' was not found
│       - 'tierAlias' '' was not found
│
│
│   with opslevel_service.kafka["<redacted>"],
│   on kafka_topics.tf line 5, in resource "opslevel_service" "kafka":
│    5: resource "opslevel_service" "kafka" {
@rocktavious
Copy link
Collaborator

Hey @oponomarov-tu - we are in the middle of a massive refactor of the codebase bringing it up to the lastest SDK version. I think we won't beable to test this out until that is shipped and then we'll most likely want to have your roll forward to that one to see if this is fixed there. I'll add this to our queue for checking on post refactor.

@oponomarov-tu
Copy link
Author

Hey @oponomarov-tu - we are in the middle of a massive refactor of the codebase bringing it up to the lastest SDK version. I think we won't beable to test this out until that is shipped and then we'll most likely want to have your roll forward to that one to see if this is fixed there. I'll add this to our queue for checking on post refactor.

Thanks for prompt feedback. I guess this is most likely blocking everyone from using OpsLevel provider and opslevel_service resources in particular. Well, guess we have to wait then. Have a nice Friday!

@rocktavious
Copy link
Collaborator

@oponomarov-tu - we are going to look at getting your other issue as a fix into the pre-release so maybe once thats in you try to roll forward. The newest terraform provider gives provider writes alot more control over the state, config and plan/apply that we think might actually fix this. We suspect this is due to an underlying change with opslevel-go and unfortunately the current provider is an un tested codebase. Moving to the latest provider SDK will allow us to way more easily write tests for our code with an aim to stabilize the provider and move towards 1.0

@vini-mw
Copy link
Contributor

vini-mw commented Apr 24, 2024

@oponomarov-tu
i had the same thing. and although this is an issue, it doesnt make the opslevel_service resource un-usable.

the clue is in the error message. Although the lifecycle_alias and tier_alias inputs are categorised as optional for this resource, the creation of the service wont work without them.

so all you gotta do in order to create a service via tf is specify those inputs. check the example usage on the link i referenced above to see how to go about that using data sources.

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