Skip to content

Commit

Permalink
[SQUASH] ALL ZE DOCS
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzaadi committed May 20, 2024
1 parent b7d6941 commit 502692b
Show file tree
Hide file tree
Showing 27 changed files with 591 additions and 235 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Port is the Developer Platform meant to supercharge your DevOps and Developers,

## Documentation

- [Terraform registry docs](https://registry.terraform.io/providers/port-labs/port/latest/docs)
- [Terraform registry docs](https://registry.terraform.io/providers/port-labs/port-labs/latest/docs)
- [Port docs](https://docs.getport.io/build-your-software-catalog/sync-data-to-catalog/iac/terraform)

## Requirements
Expand Down
113 changes: 80 additions & 33 deletions docs/resources/port_action_permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ description: |-
Example Usage
hcl
resource "port_action_permissions" "restart_microservice_permissions" {
action_identifier = port_action.restart_microservice.identifier
permissions = {
"execute" : {
"roles" : [
"Admin"
],
"users" : [],
"teams" : [],
"owned_by_team" : true
},
"approve" : {
"roles" : ["Member", "Admin"],
"users" : [],
"teams" : []
action_identifier = port_action.restart_microservice.identifier
permissions = {
"execute" : {
"roles" : [
"admin"
],
"users" : [],
"teams" : [],
"owned_by_team" : true
},
"approve" : {
"roles" : ["member", "admin"],
"users" : [],
"teams" : []
}
}
}
}
Example Usage with Policy
Expand Down Expand Up @@ -78,7 +78,29 @@ description: |-
}
```
Disclaimer
Action permissions are created by default when creating a new action, this means that you should use this resource when you want to change the default permissions of an action.When deleting an action permissions resource using terraform, the action permissions will not be deleted from Port, as they are required for the action to work, instead, the action permissions will be removed from the terraform state.
Action permissions are created by default when creating a new action, this means that you should use this resource when you want to change the default permissions of an action.When deleting an action permissions resource using terraform, the action permissions will not be deleted from Port, as they are required for the action to work, instead, the action permissions will be removed from the terraform state.All the permission lists (roles, users, teams) are managed by Port in a sorted manner, this means that if your .tf has for example roles defined out of order, your state will be invalid
E.g:
hcl
resource "port_action_permissions" "restart_microservice_permissions" {
action_identifier = port_action.restart_microservice.identifier
permissions = {
# invalid
"execute" : {
"roles" : [
"member",
"admin",
],
...
},
# valid
"approve" : {
"roles" : [
"admin",
"member",
],
}
}
}
---

# port_action_permissions (Resource)
Expand All @@ -91,22 +113,22 @@ Docs for the Action Permissions resource can be found [here](https://docs.getpor

```hcl
resource "port_action_permissions" "restart_microservice_permissions" {
action_identifier = port_action.restart_microservice.identifier
permissions = {
"execute" : {
"roles" : [
"Admin"
],
"users" : [],
"teams" : [],
"owned_by_team" : true
},
"approve" : {
"roles" : ["Member", "Admin"],
"users" : [],
"teams" : []
}
}
action_identifier = port_action.restart_microservice.identifier
permissions = {
"execute" : {
"roles" : [
"admin"
],
"users" : [],
"teams" : [],
"owned_by_team" : true
},
"approve" : {
"roles" : ["member", "admin"],
"users" : [],
"teams" : []
}
}
}
```

Expand Down Expand Up @@ -166,10 +188,35 @@ resource "port_action_permissions" "restart_microservice_permissions" {
}
```

## Disclaimer
## Disclaimer

- Action permissions are created by default when creating a new action, this means that you should use this resource when you want to change the default permissions of an action.
- When deleting an action permissions resource using terraform, the action permissions will not be deleted from Port, as they are required for the action to work, instead, the action permissions will be removed from the terraform state.
- All the permission lists (roles, users, teams) are managed by Port in a sorted manner, this means that if your `.tf` has for example roles defined out of order, your state will be invalid
E.g:

```hcl
resource "port_action_permissions" "restart_microservice_permissions" {
action_identifier = port_action.restart_microservice.identifier
permissions = {
# invalid
"execute" : {
"roles" : [
"member",
"admin",
],
...
},
# valid
"approve" : {
"roles" : [
"admin",
"member",
],
}
}
}
```



Expand Down
6 changes: 6 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### TBD:

Explanation about how to run the samples


* Edit the provider.tf in this directory, cd into any of the resources/*, `terraform init; terraform plan; terraform apply`
12 changes: 1 addition & 11 deletions examples/main.tf → examples/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@ terraform {
required_providers {
port = {
source = "port-labs/port-labs"
version = "~> 1.0.0"
version = "~> 2.0.0"
}
}
}
provider "port" {
client_id = "{YOUR CLIENT ID}" # or set the environment variable PORT_CLIENT_ID
secret = "{YOUR CLIENT SECRET}" # or set the environment variable PORT_CLIENT_SECRET
}

resource "port_entity" "microservice" {
title = "monolith"
blueprint = "microservice_blueprint"
properties {
string_props = {
"microservice_name" = "golang_monolith"
}
}
}
104 changes: 90 additions & 14 deletions examples/resources/port_action/main.tf
Original file line number Diff line number Diff line change
@@ -1,22 +1,98 @@
resource "port_blueprint" "environment" {
title = "Environment"
icon = "Environment"
identifier = "examples-action-env"
properties = {
string_props = {
"name" = {
type = "string"
title = "name"
}
"docs-url" = {
title = "Docs URL"
format = "url"
}
}
}
}

resource "port_blueprint" "microservice" {
title = "VM"
icon = "GPU"
identifier = "examples-action-microservice"
properties = {
string_props = {
name = {
type = "string"
title = "Name"
},
author = {
type = "string"
title = "Author"
},
url = {
type = "string"
title = "URL"
},
myStringIdentifier = {
description = "This is a string property"
title = "text"
icon = "Terraform"
required = true
min_length = 1
max_length = 10
default = "default"
enum = ["default", "default2"]
pattern = "^[a-zA-Z0-9]*$"
format = "user"
enum_colors = {
default = "red"
default2 = "green"
}
}
}
boolean_props = {
required = {
type = "boolean"
}
}
number_props = {
sum = {
type = "number"
}
}
}

relations = {
"environment" = {
title = "Test Relation"
required = "true"
target = port_blueprint.environment.identifier
}
}
}

resource "port_action" "restart_microservice" {
title = "Restart microservice"
icon = "Terraform"
identifier = "restart-micrservice"
blueprint = port_blueprint.microservice.identifier
trigger = "DAY-2"
identifier = "examples-action-restart-microservice"
self_service_trigger = {
operation = "DAY-2"
blueprint_identifier = port_blueprint.microservice.identifier
user_properties = {
string_props = {
"webhook_url" = {
title = "Webhook URL"
description = "Webhook URL to send the request to"
format = "url"
default = "https://example.com"
pattern = "^https://.*"
}
}
}
}
webhook_method = {
type = "WEBHOOK"
url = "https://app.getport.io"
}
user_properties = {
string_props = {
"webhook_url" = {
title = "Webhook URL"
description = "Webhook URL to send the request to"
format = "url"
default = "https://example.com"
pattern = "^https://.*"
}
}
}
}
1 change: 1 addition & 0 deletions examples/resources/port_action/provider.tf
Loading

0 comments on commit 502692b

Please sign in to comment.