Skip to content

Commit

Permalink
Ensure that version is not part of the state if not explicitly in t…
Browse files Browse the repository at this point in the history
…he tf file
  • Loading branch information
erikzaadi committed Sep 5, 2024
1 parent 5fbad86 commit c027225
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/resources/port_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: |-
resource "portintegration" "mycustomintegration" {
installationid = "my-custom-integration-id"
title = "My Custom Integration"
version = "1.33.7"
version = "1.33.7" # Optional, can be omitted
config = jsonencode({
createMissingRelatedEntitiesboolean = true
deleteDependentEntities = true,
Expand Down Expand Up @@ -56,7 +56,7 @@ Docs about how to import existing integrations and manage their mappings can be
resource "port_integration" "my_custom_integration" {
installation_id = "my-custom-integration-id"
title = "My Custom Integration"
version = "1.33.7"
version = "1.33.7" # Optional, can be omitted
config = jsonencode({
createMissingRelatedEntitiesboolean = true
deleteDependentEntities = true,
Expand Down
34 changes: 33 additions & 1 deletion examples/resources/port_integration/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
resource "port_integration" "my_custom_integration" {
installation_id = "my-custom-integration-id"
title = "My Custom Integration"
version = "1.33.7"
installation_app_type = "WEBHOOK"
config = jsonencode({
createMissingRelatedEntitiesboolean = true
Expand All @@ -27,3 +26,36 @@ resource "port_integration" "my_custom_integration" {
}]
})
}

resource "port_integration" "my_k8s_exporter" {
installation_id = "my-"
title = "My K8S Exporter with version managed by Terraform"
installation_app_type = "K8S EXPORTER"
# NOTE: This property is by default not used, since it can change outside of terraform
# Include this only if you explicitly want to control the version with Terraform
version = "1.33.7"
config = jsonencode({
createMissingRelatedEntitiesboolean = true
deleteDependentEntities = true
resources = [{
kind = "apps/v1/replicasets"
selector = {
query = ".metadata.namespace | startswith(\"kube\") | not"
}
port = {
entity = {
mappings = [{
identifier = ".metadata.name"
title = ".metadata.name"
blueprint = "'deploymentConfig'"
properties = {
creationTimestamp = ".metadata.creationTimestamp"
annotations = ".metadata.annotations"
status = ".status"
}
}]
}
}
}]
})
}
2 changes: 1 addition & 1 deletion port/integration/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func IntegrationSchema() map[string]schema.Attribute {
},
"version": schema.StringAttribute{
Optional: true,
Computed: true,
},
"title": schema.StringAttribute{
Optional: true,
Expand Down Expand Up @@ -73,7 +74,6 @@ Docs about how to import existing integrations and manage their mappings can be
resource "port_integration" "my_custom_integration" {
installation_id = "my-custom-integration-id"
title = "My Custom Integration"
version = "1.33.7"
config = jsonencode({
createMissingRelatedEntitiesboolean = true
deleteDependentEntities = true,
Expand Down

0 comments on commit c027225

Please sign in to comment.