Skip to content

Commit

Permalink
kubernetes_manifest schema refactor (hashicorp#2408)
Browse files Browse the repository at this point in the history
* refactor of manifest schema and getMetadata

* gh test

* use keys from GetProvider functions for GetMetadata schema

* update terraform versions to latest in check_examples yaml
  • Loading branch information
BBBmau authored Jan 25, 2024
1 parent c04862b commit 4db62a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
strategy:
matrix:
terraform_version:
- "1.0.11"
- "1.1.9"
- "1.2.9"
- "1.3.9"
- "1.4.0"
- "1.6.0"
- "1.7.0"
env:
TF_X_KUBERNETES_MANIFEST_RESOURCE: 1
TERM: linux
Expand Down
25 changes: 14 additions & 11 deletions manifest/provider/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,21 @@ func (s *RawProviderServer) PrepareProviderConfig(ctx context.Context, req *tfpr
func (s *RawProviderServer) GetMetadata(ctx context.Context, req *tfprotov5.GetMetadataRequest) (*tfprotov5.GetMetadataResponse, error) {
s.logger.Trace("[GetMetadata][Request]\n%s\n", dump(*req))

sch := GetProviderResourceSchema()
rs := make([]tfprotov5.ResourceMetadata, 0, len(sch))
for k := range sch {
rs = append(rs, tfprotov5.ResourceMetadata{TypeName: k})
}

sch = GetProviderDataSourceSchema()
ds := make([]tfprotov5.DataSourceMetadata, 0, len(sch))
for k := range sch {
ds = append(ds, tfprotov5.DataSourceMetadata{TypeName: k})
}

resp := &tfprotov5.GetMetadataResponse{
Resources: []tfprotov5.ResourceMetadata{{
TypeName: "kubernetes_manifest",
}},
DataSources: []tfprotov5.DataSourceMetadata{
{
TypeName: "kubernetes_resource",
},
{
TypeName: "kubernetes_resources",
},
},
Resources: rs,
DataSources: ds,
}
return resp, nil
}
Expand Down

0 comments on commit 4db62a7

Please sign in to comment.