Skip to content

Commit 109c483

Browse files
committed
fix: fixing issues with the payment_method_id check
1 parent 2775e42 commit 109c483

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.github/workflows/terraform_provider_pr.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ jobs:
123123
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
124124
with:
125125
go-version-file: go.mod
126-
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsSubscription"'
126+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsDatabase_CRUDI"'
127+
127128

128129
go_test_smoke_essentials_sub:
129130
name: go test smoke essentials sub
@@ -134,7 +135,7 @@ jobs:
134135
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
135136
with:
136137
go-version-file: go.mod
137-
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsSubscription_CRUDI"'
138+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAccResourceRedisCloudEssentialsSubscription"'
138139

139140

140141
go_test_smoke_pro_db:

provider/resource_rediscloud_essentials_subscription.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ func resourceRedisCloudEssentialsSubscriptionCreate(ctx context.Context, d *sche
9191
}
9292

9393
// payment_method_id only matters if it is a credit card
94-
if d.Get("payment_method").(string) != "credit-card" {
95-
if d.Get("payment_method_id") != nil {
96-
return diag.FromErr(errors.New("payment methods aside from credit-card cannot have a payment ID"))
97-
}
94+
if d.Get("payment_method").(string) != "credit-card" && d.Get("payment_method_id") != 0 {
95+
return diag.FromErr(errors.New("payment methods aside from credit-card cannot have a payment ID"))
96+
}
97+
98+
if v, ok := d.GetOk("payment_method"); ok {
99+
createSubscriptionRequest.PaymentMethod = redis.String(v.(string))
98100
}
99101

100102
if v, ok := d.GetOk("payment_method_id"); ok {

0 commit comments

Comments
 (0)