Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzaadi committed May 20, 2024
1 parent 1d8afe1 commit c5632cd
Show file tree
Hide file tree
Showing 26 changed files with 815 additions and 395 deletions.
6 changes: 3 additions & 3 deletions 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 All @@ -30,7 +30,7 @@ terraform {
required_providers {
port = {
source = "port-labs/port-labs"
version = "~> 1.0.0"
version = "~> 2.0.0"
}
}
}
Expand All @@ -49,4 +49,4 @@ terraform init

## Examples

please refer to the [examples](./examples) directory
Please refer to the [examples](./examples) directory
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
Loading

0 comments on commit c5632cd

Please sign in to comment.