@@ -54,22 +54,41 @@ func resourceGithubActionsEnvironmentSecret() *schema.Resource {
5454 Type : schema .TypeString ,
5555 Optional : true ,
5656 Computed : true ,
57- ConflictsWith : []string {"plaintext_value" },
57+ RequiredWith : []string {"value_encrypted" },
58+ ConflictsWith : []string {"value" , "plaintext_value" },
5859 Description : "ID of the public key used to encrypt the secret." ,
5960 },
61+ "value" : {
62+ Type : schema .TypeString ,
63+ Optional : true ,
64+ Sensitive : true ,
65+ ExactlyOneOf : []string {"value" , "value_encrypted" , "encrypted_value" , "plaintext_value" },
66+ Description : "Plaintext value to be encrypted." ,
67+ },
68+ "value_encrypted" : {
69+ Type : schema .TypeString ,
70+ Optional : true ,
71+ Sensitive : true ,
72+ ExactlyOneOf : []string {"value" , "value_encrypted" , "encrypted_value" , "plaintext_value" },
73+ ValidateDiagFunc : validation .ToDiagFunc (validation .StringIsBase64 ),
74+ Description : "Value encrypted with the GitHub public key, defined by key_id, in Base64 format." ,
75+ },
6076 "encrypted_value" : {
6177 Type : schema .TypeString ,
6278 Optional : true ,
63- ExactlyOneOf : []string {"encrypted_value" , "plaintext_value" },
79+ Sensitive : true ,
80+ ExactlyOneOf : []string {"value" , "value_encrypted" , "encrypted_value" , "plaintext_value" },
6481 ValidateDiagFunc : validation .ToDiagFunc (validation .StringIsBase64 ),
6582 Description : "Encrypted value of the secret using the GitHub public key in Base64 format." ,
83+ Deprecated : "Use value_encrypted and key_id." ,
6684 },
6785 "plaintext_value" : {
6886 Type : schema .TypeString ,
6987 Optional : true ,
7088 Sensitive : true ,
71- ExactlyOneOf : []string {"encrypted_value" , "plaintext_value" },
89+ ExactlyOneOf : []string {"value" , "value_encrypted" , " encrypted_value" , "plaintext_value" },
7290 Description : "Plaintext value of the secret to be encrypted." ,
91+ Deprecated : "Use value." ,
7392 },
7493 "created_at" : {
7594 Type : schema .TypeString ,
@@ -112,7 +131,7 @@ func resourceGithubActionsEnvironmentSecretCreate(ctx context.Context, d *schema
112131 envName := d .Get ("environment" ).(string )
113132 secretName := d .Get ("secret_name" ).(string )
114133 keyID := d .Get ("key_id" ).(string )
115- encryptedValue := d . Get ( " encrypted_value").( string )
134+ encryptedValue , _ := resourceKeysGetOk [ string ]( d , "value_encrypted" , " encrypted_value" )
116135
117136 escapedEnvName := url .PathEscape (envName )
118137
@@ -134,7 +153,7 @@ func resourceGithubActionsEnvironmentSecretCreate(ctx context.Context, d *schema
134153 }
135154
136155 if len (encryptedValue ) == 0 {
137- plaintextValue := d . Get ( " plaintext_value").( string )
156+ plaintextValue , _ := resourceKeysGetOk [ string ]( d , "value" , " plaintext_value" )
138157
139158 encryptedBytes , err := encryptPlaintext (plaintextValue , publicKey )
140159 if err != nil {
@@ -239,7 +258,7 @@ func resourceGithubActionsEnvironmentSecretUpdate(ctx context.Context, d *schema
239258 envName := d .Get ("environment" ).(string )
240259 secretName := d .Get ("secret_name" ).(string )
241260 keyID := d .Get ("key_id" ).(string )
242- encryptedValue := d . Get ( " encrypted_value").( string )
261+ encryptedValue , _ := resourceKeysGetOk [ string ]( d , "value_encrypted" , " encrypted_value" )
243262
244263 escapedEnvName := url .PathEscape (envName )
245264
@@ -255,7 +274,7 @@ func resourceGithubActionsEnvironmentSecretUpdate(ctx context.Context, d *schema
255274 }
256275
257276 if len (encryptedValue ) == 0 {
258- plaintextValue := d . Get ( " plaintext_value").( string )
277+ plaintextValue , _ := resourceKeysGetOk [ string ]( d , "value" , " plaintext_value" )
259278
260279 encryptedBytes , err := encryptPlaintext (plaintextValue , publicKey )
261280 if err != nil {
0 commit comments