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

(Docs): Documentation for machine identity auth #32

Merged
merged 9 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ terraform {

provider "infisical" {
host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com
service_token = "<>" # Get token https://infisical.com/docs/documentation/platform/token
client_id = "<>"
client_secret = "<>"
}

data "infisical_secrets" "common-secrets" {
env_slug = "dev"
folder_path = "/some-folder/another-folder"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/some-folder/another-folder"
}

data "infisical_secrets" "backend-secrets" {
env_slug = "prod"
folder_path = "/"
env_slug = "prod"
workspace_id = "PROJECT_ID"
folder_path = "/"
}

output "all-project-secrets" {
Expand All @@ -34,7 +37,6 @@ output "all-project-secrets" {
output "single-secret" {
value = data.infisical_secrets.backend-secrets.secrets["SECRET-NAME"]
}

```

# Development
Expand Down
18 changes: 13 additions & 5 deletions docs/data-sources/secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,27 @@ terraform {
infisical = {
# version = <latest version>
source = "infisical/infisical"

}
}
}

provider "infisical" {
host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com
service_token = "<>"
client_id = "<>"
client_secret = "<>"
}

data "infisical_secrets" "common-secrets" {
env_slug = "dev"
folder_path = "/some-folder/another-folder"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/some-folder/another-folder"
}

data "infisical_secrets" "backend-secrets" {
env_slug = "prod"
folder_path = "/"
env_slug = "prod"
workspace_id = "PROJECT_ID"
folder_path = "/"
}

output "all-project-secrets" {
Expand All @@ -54,6 +58,10 @@ output "single-secret" {
- `env_slug` (String) The environment from where secrets should be fetched from
- `folder_path` (String) The path to the folder from where secrets should be fetched from

### Optional

- `workspace_id` (String) The Infisical project ID (Required for Machine Identity auth, and service tokens with multiple scopes)

### Read-Only

- `secrets` (Attributes Map) (see [below for nested schema](#nestedatt--secrets))
Expand Down
8 changes: 6 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ terraform {
infisical = {
# version = <latest version>
source = "infisical/infisical"

}
}
}

provider "infisical" {
host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com
service_token = "<>"
client_id = "<>"
client_secret = "<>"
}
```

Expand All @@ -33,5 +35,7 @@ provider "infisical" {

### Optional

- `client_id` (String, Sensitive) Machine identity client ID. Used to fetch/modify secrets for a given project
- `client_secret` (String, Sensitive) Machine identity client secret. Used to fetch/modify secrets for a given project
- `host` (String) Used to point the client to fetch secrets from your self hosted instance of Infisical. If not host is provided, https://app.infisical.com is the default host.
- `service_token` (String, Sensitive) Used to fetch/modify secrets for a given project
- `service_token` (String, Sensitive) (DEPRECATED, USE MACHINE IDENTITY), Used to fetch/modify secrets for a given project
32 changes: 18 additions & 14 deletions docs/resources/secret.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,32 @@ terraform {

provider "infisical" {
host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com
service_token = "<>"
client_id = "<>"
client_secret = "<>"
}

resource "infisical_secret" "mongo_secret" {
name = "MONGO_DB"
value = "<some-key>"
env_slug = "dev"
folder_path = "/"
name = "MONGO_DB"
value = "<some-key>"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/"
}

resource "infisical_secret" "smtp_secret" {
name = "SMTP"
value = "<some key>"
env_slug = "dev"
folder_path = "/mail-service"
name = "SMTP"
value = "<some key>"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/mail-service"
}

resource "infisical_secret" "github_action_secret" {
name = "GITHUB_ACTION"
value = "<some value>"
env_slug = "dev"
folder_path = "/"
name = "GITHUB_ACTION"
value = "<some value>"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/"
}
```

Expand All @@ -61,7 +65,7 @@ resource "infisical_secret" "github_action_secret" {

### Optional

- `workspace_id` (String) The Infisical project ID
- `workspace_id` (String) The Infisical project ID (Required for Machine Identity auth, and service tokens with multiple scopes)

### Read-Only

Expand Down
13 changes: 8 additions & 5 deletions examples/data-sources/infisical_secrets/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ terraform {

provider "infisical" {
host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com
service_token = "<>"
client_id = "<>"
client_secret = "<>"
}

data "infisical_secrets" "common-secrets" {
env_slug = "dev"
folder_path = "/some-folder/another-folder"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/some-folder/another-folder"
}

data "infisical_secrets" "backend-secrets" {
env_slug = "prod"
folder_path = "/"
env_slug = "prod"
workspace_id = "PROJECT_ID"
folder_path = "/"
}

output "all-project-secrets" {
Expand Down
3 changes: 2 additions & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ terraform {

provider "infisical" {
host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com
service_token = "<>"
client_id = "<>"
client_secret = "<>"
}
30 changes: 17 additions & 13 deletions examples/resources/infisical_secret/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,30 @@ terraform {

provider "infisical" {
host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com
service_token = "<>"
client_id = "<>"
client_secret = "<>"
}

resource "infisical_secret" "mongo_secret" {
name = "MONGO_DB"
value = "<some-key>"
env_slug = "dev"
folder_path = "/"
name = "MONGO_DB"
value = "<some-key>"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/"
}

resource "infisical_secret" "smtp_secret" {
name = "SMTP"
value = "<some key>"
env_slug = "dev"
folder_path = "/mail-service"
name = "SMTP"
value = "<some key>"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/mail-service"
}

resource "infisical_secret" "github_action_secret" {
name = "GITHUB_ACTION"
value = "<some value>"
env_slug = "dev"
folder_path = "/"
name = "GITHUB_ACTION"
value = "<some value>"
env_slug = "dev"
workspace_id = "PROJECT_ID"
folder_path = "/"
}
2 changes: 1 addition & 1 deletion infisical/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (p *infisicalProvider) Schema(ctx context.Context, _ provider.SchemaRequest
"service_token": schema.StringAttribute{
Optional: true,
Sensitive: true,
Description: "Used to fetch/modify secrets for a given project",
Description: " (DEPRECATED, USE MACHINE IDENTITY), Used to fetch/modify secrets for a given project",
},

"client_id": schema.StringAttribute{
Expand Down
2 changes: 1 addition & 1 deletion infisical/provider/secret_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (r *secretResource) Schema(_ context.Context, _ resource.SchemaRequest, res
Computed: false,
},
"workspace_id": schema.StringAttribute{
Description: "The Infisical project ID (Required for Machine Identity auth)",
Description: "The Infisical project ID (Required for Machine Identity auth, and service tokens with multiple scopes)",
Optional: true,
Computed: true,
},
Expand Down
2 changes: 1 addition & 1 deletion infisical/provider/secrets_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (d *SecretsDataSource) Schema(ctx context.Context, req datasource.SchemaReq
},

"workspace_id": schema.StringAttribute{
Description: "The Infisical project ID (Required for Machine Identity auth)",
Description: "The Infisical project ID (Required for Machine Identity auth, and service tokens with multiple scopes)",
Optional: true,
Computed: true,
},
Expand Down
2 changes: 1 addition & 1 deletion provider-install-verification/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
required_providers {
infisical = {
source = "hashicorp.com/edu/infisical"
source = "infisical/infisical"
}
}
}
Expand Down
Loading