For everyone upgrading from a version before v1.0.0, we recommend upgrading straight to v1.2 or higher.
Important
If you have created checks in 1.0.x or 1.1.x you will first need to upgrade to 1.1.4 before jumping to >= 1.2.5
We at OpsLevel have been working on upgrading our Terraform provider to version 1.0.0.
While the majority of these improvements are under the hood, there are a few Terraform configuration changes to be aware of.
For errors encountered during terraform apply
, see the State Migration section below - Applies only to v1.0.0 up to v1.1.x
The following resources with fields that were “block type fields" will need an “=” added.
- opslevel_check_manual
# OLD - no "=" sign
resource "opslevel_check_manual" "example" {
update_frequency { ... }
}
# New has "=" sign
resource "opslevel_check_manual" "example" {
update_frequency = { ... }
}
Just like opslevel_check_manual.update_frequency
, the following opslevel_resource.field
s will need an "=" added.
opslevel_check_alert_source_usage.alert_name_predicate
opslevel_check_repository_file.file_contents_predicate
opslevel_check_repository_grep.file_contents_predicate
opslevel_check_repository_search.file_contents_predicate
opslevel_check_service_ownership.tag_predicate
opslevel_check_service_property.predicate
opslevel_infrastructure.provider_data
data.opslevel_repositories.filter
(datasource)data.opslevel_services.filter
(datasource)
Many of our datasources were updated to provide a better user experience and may require a few small updates.
When upgrading from versions older than 0.12.0-0, updating the outputs of "plural" datasources may be needed.
# Requesting the datasource remains the same
data "opslevel_domains" "all" {}
# OLD - before v0.12.0-0
output "all" {
value = data.opslevel_domains.all
}
output "domain_names" {
value = data.opslevel_domains.all.names
}
# NEW - versions v0.12.0-0 and after
output "all" {
value = data.opslevel_domains.all.domains
}
output "domain_names" {
value = data.opslevel_domains.all.domains[*].name
}
This same pattern applies to data.opslevel_scorecards
, data.opslevel_services
, data.opslevel_teams
, etc.
Given this configuration:
data "opslevel_domains" "all" {}
output "all" {
value = data.opslevel_domains.all.domains
}
output "domain_names" {
value = sort(data.opslevel_domains.all.domains[*].name)
}
Will return:
data.opslevel_domains.all: Reading...
data.opslevel_domains.all: Read complete after 1s
Changes to Outputs:
+ all = [
+ {
+ aliases = [
+ "alias_1",
+ "alias_2",
]
+ description = null
+ id = "Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzEwOTk2NjU"
+ name = "Big Domain"
+ owner = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xNDQwNg"
},
+ {
+ aliases = [
+ "example_1",
+ "example_2",
]
+ description = "Example description"
+ id = "Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzE4ODg2NzA"
+ name = "Example Domain"
+ owner = "Z2lkOi8vb3BzbGV2ZWwvVGVhbS85NzU5"
},
]
+ domain_names = [
+ "Big Domain",
+ "Example Domain",
]
Given this configuration:
data "opslevel_domains" "all" {}
output "all" {
value = data.opslevel_domains.all
}
output "domain_names" {
value = sort(data.opslevel_domains.all.names)
}
Will return:
data.opslevel_domains.all: Reading...
data.opslevel_domains.all: Read complete after 1s
Changes to Outputs:
+ all = [
+ aliases = [
+ "alias_1",
+ "alias_2",
+ "example_1",
+ "example_2",
]
+ descriptions = [
+ "",
+ "Example description",
]
+ ids = [
+ "Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzEwOTk2NjU",
+ "Z2lkOi8vb3BzbGV2ZWwvRW50aXR5T2JqZWN0LzE4ODg2NzA",
]
+ names = [
+ "Big Domain",
+ "Example Domain",
]
+ owners = [
+ "Z2lkOi8vb3BzbGV2ZWwvVGVhbS8xNDQwNg",
+ "Z2lkOi8vb3BzbGV2ZWwvVGVhbS85NzU5",
]
}
+ domain_names = [
+ "Big Domain",
+ "Example Domain",
]
We recommend upgrading straight to v1.2 or higher. But for versions between v1.0.0 and v1.1.x, the following may be needed.
The structure of some resource data has changed from v0.11.0 to v1.0.0.
If you encounter erros like Error: Unable to Read Previously Saved State for UpgradeResourceState
while upgrading to the OpsLevel v1.0.0 Terraform provider, the following will get you unstuck.
Assuming opslevel_check_tag_defined.my_tag
raises an error like
AttributeName("environment_predicate"): invalid JSON, expected "{", got "["
, run
terraform state show opslevel_check_tag_defined.my_tag
and extract the value of id
.
Extract and keep all ids for resources that raise errors.
If terraform state show ...
raises an error, try terraform state pull > my_tf_state.json
and extract ids from my_tf_state.json
.
This does NOT remove the resources from OpsLevel - only from Terraform's state.
Run terraform state rm opslevel_check_tag_defined.my_tag
and repeat for all
resources that raise errors.
Optionally verify resources removed from state with terraform state list
.
Import OpsLevel resources into Terraform's state by running
terraform import opslevel_check_tag_defined.my_tag <resource-id>
and repeat
for all resources that raise errors. Note matches the id
of the OpsLevel
resource as returned by the OpsLevel cli, if id
is
not otherwise known.
Optionally verify resources imported to state with terraform state list
.