-
Notifications
You must be signed in to change notification settings - Fork 24
Feature: CDN distribution resource and data source #786
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
base: main
Are you sure you want to change the base?
Feature: CDN distribution resource and data source #786
Conversation
@malteehrlen As said in the PR template, please link an GitHub issue or at least add a description which describes what you want to achieve within your PR. |
5e6d900
to
bc7c08b
Compare
e534c17
to
47e290c
Compare
47e290c
to
4a2267f
Compare
@rubenhoenle I have now published the PR for review, please have a look. |
stackit/provider.go
Outdated
@@ -463,6 +473,7 @@ func (p *Provider) Configure(ctx context.Context, req provider.ConfigureRequest, | |||
// DataSources defines the data sources implemented in the provider. | |||
func (p *Provider) DataSources(_ context.Context) []func() datasource.DataSource { | |||
return []func() datasource.DataSource{ | |||
cdn.NewDistributionDataSource, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep alphabetic order
@@ -105,6 +106,17 @@ func ObservabilityProviderConfig() string { | |||
ObservabilityCustomEndpoint, | |||
) | |||
} | |||
func CdnProviderConfig() string { | |||
if CdnCustomEndpoint == "" { | |||
return `provider "stackit" {}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default_region attribute missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cdn is a global resource without region
"config": "The distribution configuration", | ||
"config_backend": "The configured backend for the distribution", | ||
"config_regions": "The configured regions where content will be hosted", | ||
"config_backend_type": "the ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing description
|
||
func (r *distributionResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { | ||
descriptions := map[string]string{ | ||
"id": "Terrform resource ID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is the id built. check how it is described for other resources
}, | ||
}, | ||
}, | ||
"regions": schema.ListAttribute{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description missing
if resp.Diagnostics.HasError() { | ||
return | ||
} | ||
if model.ProjectId.IsUnknown() || model.ProjectId.IsNull() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my reply above
|
||
func (r *distributionDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { | ||
descriptions := map[string]string{ | ||
"id": "Terrform resource ID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documentation on id missing
"config": "The distribution configuration", | ||
"config_backend": "The configured backend for the distribution", | ||
"config_regions": "The configured regions where content will be hosted", | ||
"config_backend_type": "the ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description missing
} | ||
|
||
func (r *distributionDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { | ||
descriptions := map[string]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created on description map in the resource go and used it for the datasource as well. Easier to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
}, | ||
}, | ||
}, | ||
"regions": schema.ListAttribute{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing description
cf33d95
to
36538a5
Compare
36538a5
to
c1e165e
Compare
Description
Checklist
make fmt
examples/
directory)make generate-docs
(will be checked by CI)make test
(will be checked by CI)make lint
(will be checked by CI)