Skip to content

Commit

Permalink
Do not drop actionParameters.cache when it is present in the read (#…
Browse files Browse the repository at this point in the history
…971)

Fixes #957
  • Loading branch information
iwahbe authored Nov 21, 2024
1 parent 455eb54 commit 0fb1dbc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.23.1
require (
github.com/cloudflare/terraform-provider-cloudflare v1.18.2-0.20220823222840-b2cee3be8c57
github.com/pulumi/providertest v0.1.3
github.com/pulumi/pulumi-terraform-bridge/v3 v3.95.0
github.com/pulumi/pulumi-terraform-bridge/v3 v3.95.1-0.20241121121133-30cb60afd961
github.com/pulumi/pulumi/sdk/v3 v3.137.0
github.com/stretchr/testify v1.9.0
)
Expand Down
4 changes: 2 additions & 2 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1975,8 +1975,8 @@ github.com/pulumi/providertest v0.1.3 h1:GpNKRy/haNjRHiUA9bi4diU4Op2zf3axYXbga5A
github.com/pulumi/providertest v0.1.3/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.16.1 h1:orHnDWFbpOERwaBLry9f+6nqPX7x0MsrIkaa5QDGAns=
github.com/pulumi/pulumi-java/pkg v0.16.1/go.mod h1:QH0DihZkWYle9XFc+LJ76m4hUo+fA3RdyaM90pqOaSM=
github.com/pulumi/pulumi-terraform-bridge/v3 v3.95.0 h1:zChnIrzR89muOosXFxcd/HTnOw7lkbm7EXKiXQI0/2Y=
github.com/pulumi/pulumi-terraform-bridge/v3 v3.95.0/go.mod h1:1d07wF5+u3d9xOtzuX/3K9+QF4/ISp0QKdC/orX0abI=
github.com/pulumi/pulumi-terraform-bridge/v3 v3.95.1-0.20241121121133-30cb60afd961 h1:31I1GK6WUUlQqjyW7S2bfSO6h5LU5SiRrPFgHmhhCL4=
github.com/pulumi/pulumi-terraform-bridge/v3 v3.95.1-0.20241121121133-30cb60afd961/go.mod h1:1d07wF5+u3d9xOtzuX/3K9+QF4/ISp0QKdC/orX0abI=
github.com/pulumi/pulumi-yaml v1.11.1 h1:ULUL9fpb2Bwgf3jJHx0FamKYm0ld0KxBQr/uSAslRLk=
github.com/pulumi/pulumi-yaml v1.11.1/go.mod h1:RdXRBupRGGAD1kbYNG1V1h6pyFnXisvQsl0AANvVjGI=
github.com/pulumi/pulumi/pkg/v3 v3.137.0 h1:/KPFQQaB5W0/GhVxSTGnEzv3ZW5uieGN5Q2q+Lsr+Zw=
Expand Down
41 changes: 25 additions & 16 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

pfbridge "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/pf/tfbridge"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/info"
tfbridgetokens "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen"
shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
Expand All @@ -46,7 +47,7 @@ const (
var metadata []byte

// Provider returns additional overlaid schema and metadata associated with the provider..
func Provider() tfbridge.ProviderInfo {
func Provider() info.Provider {
// Instantiate the Terraform provider
p := pfbridge.MuxShimWithPF(context.Background(),
shimv2.NewProvider(
Expand All @@ -61,7 +62,7 @@ func Provider() tfbridge.ProviderInfo {
}

// Create a Pulumi provider mapping
prov := tfbridge.ProviderInfo{
prov := info.Provider{
P: p,
Name: "cloudflare",
Description: "A Pulumi package for creating and managing Cloudflare cloud resources.",
Expand All @@ -73,47 +74,47 @@ func Provider() tfbridge.ProviderInfo {
UpstreamRepoPath: "./upstream",
Version: version.Version,
MetadataInfo: tfbridge.NewProviderMetadata(metadata),
DocRules: &tfbridge.DocRuleInfo{EditRules: docEditRules},
Config: map[string]*tfbridge.SchemaInfo{
DocRules: &info.DocRule{EditRules: docEditRules},
Config: map[string]*info.Schema{
"rps": {
Default: &tfbridge.DefaultInfo{
Default: &info.Default{
Value: 4,
EnvVars: []string{"CLOUDFLARE_RPS"},
},
},
"retries": {
Default: &tfbridge.DefaultInfo{
Default: &info.Default{
Value: 3,
EnvVars: []string{"CLOUDFLARE_RETRIES"},
},
},
"min_backoff": {
Default: &tfbridge.DefaultInfo{
Default: &info.Default{
Value: 1,
EnvVars: []string{"CLOUDFLARE_MIN_BACKOFF"},
},
},
"max_backoff": {
Default: &tfbridge.DefaultInfo{
Default: &info.Default{
Value: 30,
EnvVars: []string{"CLOUDFLARE_MAX_BACKOFF"},
},
},
"api_client_logging": {
Default: &tfbridge.DefaultInfo{
Default: &info.Default{
Value: false,
EnvVars: []string{"CLOUDFLARE_API_CLIENT_LOGGING"},
},
},
},

Resources: map[string]*tfbridge.ResourceInfo{
Resources: map[string]*info.Resource{
"cloudflare_access_keys_configuration": {
// This resource has no upstream docs:
Docs: &tfbridge.DocInfo{AllowMissing: true},
Docs: &info.Doc{AllowMissing: true},
},
"cloudflare_zone": {
Fields: map[string]*tfbridge.SchemaInfo{
Fields: map[string]*info.Schema{
"zone": {CSharpName: "ZoneName"},
},
},
Expand All @@ -139,7 +140,7 @@ func Provider() tfbridge.ProviderInfo {
"cloudflare_turnstile_widget": {ComputeID: delegateID("id")},
"cloudflare_hyperdrive_config": {
ComputeID: delegateID("accountId"),
Fields: map[string]*tfbridge.SchemaInfo{
Fields: map[string]*info.Schema{
"id": {
Name: "resourceId",
},
Expand All @@ -164,8 +165,16 @@ func Provider() tfbridge.ProviderInfo {
},
},

"cloudflare_ruleset": {Fields: map[string]*info.Schema{
"rules": {Elem: &info.Schema{Fields: map[string]*info.Schema{
"action_parameters": {Elem: &info.Schema{Fields: map[string]*info.Schema{
"cache": {XAlwaysIncludeInImport: true},
}}},
}}},
}},

"cloudflare_zero_trust_risk_score_integration": {
Docs: &tfbridge.DocInfo{AllowMissing: true},
Docs: &info.Doc{AllowMissing: true},
},
},
JavaScript: &tfbridge.JavaScriptInfo{
Expand Down Expand Up @@ -213,15 +222,15 @@ func Provider() tfbridge.ProviderInfo {
return prov
}

func docEditRules(defaults []tfbridge.DocsEdit) []tfbridge.DocsEdit {
func docEditRules(defaults []info.DocsEdit) []info.DocsEdit {
return append(
defaults,
skipGettingStartedSection,
)
}

// Removes a "Getting Started" section that links to a tF tutorial
var skipGettingStartedSection = tfbridge.DocsEdit{
var skipGettingStartedSection = info.DocsEdit{
Path: "index.md",
Edit: func(_ string, content []byte) ([]byte, error) {
return tfgen.SkipSectionByHeaderContent(content, func(headerText string) bool {
Expand Down

0 comments on commit 0fb1dbc

Please sign in to comment.