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

Populate headers from config differently #79

Merged
merged 2 commits into from
Jan 5, 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
4 changes: 1 addition & 3 deletions backstage/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ func (p *backstageProvider) Configure(ctx context.Context, req provider.Configur
}
} else {
if !config.Headers.IsNull() {
for k, v := range config.Headers.Elements() {
headers[k] = v.String()
}
config.Headers.ElementsAs(ctx, &headers, true)
}
}

Expand Down
3 changes: 3 additions & 0 deletions backstage/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (

const testAccProviderConfig = `
provider "backstage" {
headers = {
"Custom-Header" = "header_value"
}
}
`

Expand Down
4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ provider "backstage" {
base_url = "https://demo.backstage.io"
# Override the name of default namespace:
default_namespace = "custom-default"
# Set custom headers (might be useful for authentication):
headers = {
"Custom-Header" = "header_value"
}
}
```

Expand Down
4 changes: 4 additions & 0 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ provider "backstage" {
base_url = "https://demo.backstage.io"
# Override the name of default namespace:
default_namespace = "custom-default"
# Set custom headers (might be useful for authentication):
headers = {
"Custom-Header" = "header_value"
}
}
Loading