Skip to content

Commit 047781f

Browse files
committed
remove target_name from non hashi migrations and review fixes
1 parent 44725f6 commit 047781f

19 files changed

Lines changed: 245 additions & 200 deletions

akeyless/resource_certificate_discovery.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func resourceCertificateDiscovery() *schema.Resource {
4343
DiffSuppressFunc: common.DiffSuppressOnLeadingSlash,
4444
},
4545
"expiration_event_in": {
46-
Type: schema.TypeList,
46+
Type: schema.TypeSet,
4747
Optional: true,
4848
ForceNew: true,
4949
Description: "How many days before the expiration of the certificate would you like to be notified. To specify multiple events, repeat this argument.",
@@ -55,13 +55,6 @@ func resourceCertificateDiscovery() *schema.Resource {
5555
ForceNew: true,
5656
Description: "The name of the key that protects the certificate value (if empty, the account default key will be used)",
5757
},
58-
"debug": {
59-
Type: schema.TypeBool,
60-
Optional: true,
61-
ForceNew: true,
62-
Default: false,
63-
Description: "Debug mode",
64-
},
6558
"count_new": {
6659
Type: schema.TypeInt,
6760
Computed: true,
@@ -101,9 +94,9 @@ func resourceCertificateDiscoveryCreate(d *schema.ResourceData, m interface{}) e
10194
hosts := strings.ReplaceAll(d.Get("hosts").(string), " ", "")
10295
portRanges := strings.ReplaceAll(d.Get("port_ranges").(string), " ", "")
10396
targetLocation := d.Get("target_location").(string)
104-
expirationEventIn := common.ExpandStringList(d.Get("expiration_event_in").([]interface{}))
97+
expirationEventInSet := d.Get("expiration_event_in").(*schema.Set)
98+
expirationEventIn := common.ExpandStringList(expirationEventInSet.List())
10599
protectionKey := d.Get("protection_key").(string)
106-
debug := d.Get("debug").(bool)
107100

108101
if hosts == "" {
109102
return fmt.Errorf("hosts cannot be empty")
@@ -117,7 +110,6 @@ func resourceCertificateDiscoveryCreate(d *schema.ResourceData, m interface{}) e
117110
common.GetAkeylessPtr(&body.PortRanges, portRanges)
118111
common.GetAkeylessPtr(&body.ExpirationEventIn, expirationEventIn)
119112
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
120-
common.GetAkeylessPtr(&body.Debug, debug)
121113

122114
out, resp, err := client.CertificateDiscovery(ctx).Body(body).Execute()
123115
if err != nil {

akeyless/resource_gateway_migration_aws.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ func resourceGatewayMigrationAws() *schema.Resource {
5151
Optional: true,
5252
Description: "The name of the key that protects the classic key value (if empty, the account default key will be used)",
5353
},
54-
"target_name": {
55-
Type: schema.TypeString,
56-
Optional: true,
57-
Description: "Name of existing target to use to create the migration",
58-
DiffSuppressFunc: common.DiffSuppressOnLeadingSlash,
59-
},
6054
"migration_id": {
6155
Type: schema.TypeString,
6256
Computed: true,
@@ -78,7 +72,6 @@ func resourceGatewayMigrationAwsCreate(d *schema.ResourceData, m interface{}) er
7872
awsKey := d.Get("aws_key").(string)
7973
awsRegion := d.Get("aws_region").(string)
8074
protectionKey := d.Get("protection_key").(string)
81-
targetName := d.Get("target_name").(string)
8275

8376
body := akeyless_api.NewGatewayCreateMigration("", name, "", "", targetLocation)
8477
body.Token = &token
@@ -87,7 +80,6 @@ func resourceGatewayMigrationAwsCreate(d *schema.ResourceData, m interface{}) er
8780
common.GetAkeylessPtr(&body.AwsKey, awsKey)
8881
common.GetAkeylessPtr(&body.AwsRegion, awsRegion)
8982
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
90-
common.GetAkeylessPtr(&body.TargetName, targetName)
9183

9284
out, resp, err := client.GatewayCreateMigration(ctx).Body(*body).Execute()
9385
if err != nil {
@@ -175,7 +167,6 @@ func resourceGatewayMigrationAwsUpdate(d *schema.ResourceData, m interface{}) er
175167
awsKey := d.Get("aws_key").(string)
176168
awsRegion := d.Get("aws_region").(string)
177169
protectionKey := d.Get("protection_key").(string)
178-
targetName := d.Get("target_name").(string)
179170

180171
body := akeyless_api.NewGatewayUpdateMigration("", "", "", targetLocation)
181172
body.Token = &token
@@ -184,7 +175,6 @@ func resourceGatewayMigrationAwsUpdate(d *schema.ResourceData, m interface{}) er
184175
common.GetAkeylessPtr(&body.AwsKey, awsKey)
185176
common.GetAkeylessPtr(&body.AwsRegion, awsRegion)
186177
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
187-
common.GetAkeylessPtr(&body.TargetName, targetName)
188178

189179
_, resp, err := client.GatewayUpdateMigration(ctx).Body(*body).Execute()
190180
if err != nil {

akeyless/resource_gateway_migration_azure_kv.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ func resourceGatewayMigrationAzureKv() *schema.Resource {
6262
Optional: true,
6363
Description: "The name of the key that protects the classic key value (if empty, the account default key will be used)",
6464
},
65-
"target_name": {
66-
Type: schema.TypeString,
67-
Optional: true,
68-
Description: "Name of existing target to use to create the migration",
69-
DiffSuppressFunc: common.DiffSuppressOnLeadingSlash,
70-
},
7165
"migration_id": {
7266
Type: schema.TypeString,
7367
Computed: true,
@@ -90,7 +84,6 @@ func resourceGatewayMigrationAzureKvCreate(d *schema.ResourceData, m interface{}
9084
azureSecret := d.Get("azure_secret").(string)
9185
azureTenantId := d.Get("azure_tenant_id").(string)
9286
protectionKey := d.Get("protection_key").(string)
93-
targetName := d.Get("target_name").(string)
9487

9588
body := akeyless_api.NewGatewayCreateMigration("", name, "", "", targetLocation)
9689
body.Token = &token
@@ -100,7 +93,6 @@ func resourceGatewayMigrationAzureKvCreate(d *schema.ResourceData, m interface{}
10093
common.GetAkeylessPtr(&body.AzureSecret, azureSecret)
10194
common.GetAkeylessPtr(&body.AzureTenantId, azureTenantId)
10295
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
103-
common.GetAkeylessPtr(&body.TargetName, targetName)
10496

10597
expirationEventInSet := d.Get("expiration_event_in").([]interface{})
10698
expirationEventIn := common.ExpandStringList(expirationEventInSet)
@@ -200,7 +192,6 @@ func resourceGatewayMigrationAzureKvUpdate(d *schema.ResourceData, m interface{}
200192
azureSecret := d.Get("azure_secret").(string)
201193
azureTenantId := d.Get("azure_tenant_id").(string)
202194
protectionKey := d.Get("protection_key").(string)
203-
targetName := d.Get("target_name").(string)
204195

205196
body := akeyless_api.NewGatewayUpdateMigration("", "", "", targetLocation)
206197
body.Token = &token
@@ -210,7 +201,6 @@ func resourceGatewayMigrationAzureKvUpdate(d *schema.ResourceData, m interface{}
210201
common.GetAkeylessPtr(&body.AzureSecret, azureSecret)
211202
common.GetAkeylessPtr(&body.AzureTenantId, azureTenantId)
212203
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
213-
common.GetAkeylessPtr(&body.TargetName, targetName)
214204

215205
expirationEventInSet := d.Get("expiration_event_in").([]interface{})
216206
expirationEventIn := common.ExpandStringList(expirationEventInSet)

akeyless/resource_gateway_migration_certificate.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ func resourceGatewayMigrationCertificate() *schema.Resource {
5151
Optional: true,
5252
Description: "The name of the key that protects the classic key value (if empty, the account default key will be used)",
5353
},
54-
"target_name": {
55-
Type: schema.TypeString,
56-
Optional: true,
57-
Description: "Name of existing target to use to create the migration",
58-
DiffSuppressFunc: common.DiffSuppressOnLeadingSlash,
59-
},
6054
"migration_id": {
6155
Type: schema.TypeString,
6256
Computed: true,
@@ -78,7 +72,6 @@ func resourceGatewayMigrationCertificateCreate(d *schema.ResourceData, m interfa
7872
portRanges := d.Get("port_ranges").(string)
7973
expirationEventIn := d.Get("expiration_event_in").([]interface{})
8074
protectionKey := d.Get("protection_key").(string)
81-
targetName := d.Get("target_name").(string)
8275

8376
body := akeyless_api.NewGatewayCreateMigration(hosts, name, "", "", targetLocation)
8477
body.Token = &token
@@ -88,7 +81,6 @@ func resourceGatewayMigrationCertificateCreate(d *schema.ResourceData, m interfa
8881
body.ExpirationEventIn = common.ExpandStringList(expirationEventIn)
8982
}
9083
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
91-
common.GetAkeylessPtr(&body.TargetName, targetName)
9284

9385
out, resp, err := client.GatewayCreateMigration(ctx).Body(*body).Execute()
9486
if err != nil {
@@ -169,7 +161,6 @@ func resourceGatewayMigrationCertificateUpdate(d *schema.ResourceData, m interfa
169161
portRanges := d.Get("port_ranges").(string)
170162
expirationEventIn := d.Get("expiration_event_in").([]interface{})
171163
protectionKey := d.Get("protection_key").(string)
172-
targetName := d.Get("target_name").(string)
173164

174165
body := akeyless_api.NewGatewayUpdateMigration(hosts, "", "", targetLocation)
175166
body.Token = &token
@@ -179,7 +170,6 @@ func resourceGatewayMigrationCertificateUpdate(d *schema.ResourceData, m interfa
179170
body.ExpirationEventIn = common.ExpandStringList(expirationEventIn)
180171
}
181172
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
182-
common.GetAkeylessPtr(&body.TargetName, targetName)
183173

184174
_, resp, err := client.GatewayUpdateMigration(ctx).Body(*body).Execute()
185175
if err != nil {

akeyless/resource_gateway_migration_gcp.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ func resourceGatewayMigrationGcp() *schema.Resource {
4141
Optional: true,
4242
Description: "The name of the key that protects the classic key value (if empty, the account default key will be used)",
4343
},
44-
"target_name": {
45-
Type: schema.TypeString,
46-
Optional: true,
47-
Description: "Name of existing target to use to create the migration",
48-
DiffSuppressFunc: common.DiffSuppressOnLeadingSlash,
49-
},
5044
"migration_id": {
5145
Type: schema.TypeString,
5246
Computed: true,
@@ -66,14 +60,12 @@ func resourceGatewayMigrationGcpCreate(d *schema.ResourceData, m interface{}) er
6660
targetLocation := d.Get("target_location").(string)
6761
gcpKey := d.Get("gcp_key").(string)
6862
protectionKey := d.Get("protection_key").(string)
69-
targetName := d.Get("target_name").(string)
7063

7164
body := akeyless_api.NewGatewayCreateMigration("", name, "", "", targetLocation)
7265
body.Token = &token
7366
body.Type = akeyless_api.PtrString("gcp")
7467
common.GetAkeylessPtr(&body.GcpKey, gcpKey)
7568
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
76-
common.GetAkeylessPtr(&body.TargetName, targetName)
7769

7870
out, resp, err := client.GatewayCreateMigration(ctx).Body(*body).Execute()
7971
if err != nil {
@@ -147,14 +139,12 @@ func resourceGatewayMigrationGcpUpdate(d *schema.ResourceData, m interface{}) er
147139
targetLocation := d.Get("target_location").(string)
148140
gcpKey := d.Get("gcp_key").(string)
149141
protectionKey := d.Get("protection_key").(string)
150-
targetName := d.Get("target_name").(string)
151142

152143
body := akeyless_api.NewGatewayUpdateMigration("", "", "", targetLocation)
153144
body.Token = &token
154145
body.Name = &name
155146
common.GetAkeylessPtr(&body.GcpKey, gcpKey)
156147
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
157-
common.GetAkeylessPtr(&body.TargetName, targetName)
158148

159149
_, resp, err := client.GatewayUpdateMigration(ctx).Body(*body).Execute()
160150
if err != nil {

akeyless/resource_gateway_migration_k8s.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ func resourceGatewayMigrationK8s() *schema.Resource {
8585
Optional: true,
8686
Description: "The name of a key that used to encrypt the secret value (if empty, the account default protectionKey key will be used)",
8787
},
88-
"target_name": {
89-
Type: schema.TypeString,
90-
Optional: true,
91-
Description: "Name of existing target to use to create the migration",
92-
DiffSuppressFunc: common.DiffSuppressOnLeadingSlash,
93-
},
9488
"migration_id": {
9589
Type: schema.TypeString,
9690
Computed: true,
@@ -118,7 +112,6 @@ func resourceGatewayMigrationK8sCreate(d *schema.ResourceData, m interface{}) er
118112
k8sNamespace := d.Get("k8s_namespace").(string)
119113
k8sSkipSystem := d.Get("k8s_skip_system").(bool)
120114
protectionKey := d.Get("protection_key").(string)
121-
targetName := d.Get("target_name").(string)
122115

123116
body := akeyless_api.NewGatewayCreateMigration("", name, "", "", targetLocation)
124117
body.Token = &token
@@ -151,7 +144,6 @@ func resourceGatewayMigrationK8sCreate(d *schema.ResourceData, m interface{}) er
151144
common.GetAkeylessPtr(&body.K8sNamespace, k8sNamespace)
152145
common.GetAkeylessPtr(&body.K8sSkipSystem, k8sSkipSystem)
153146
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
154-
common.GetAkeylessPtr(&body.TargetName, targetName)
155147

156148
out, resp, err := client.GatewayCreateMigration(ctx).Body(*body).Execute()
157149
if err != nil {
@@ -255,7 +247,6 @@ func resourceGatewayMigrationK8sUpdate(d *schema.ResourceData, m interface{}) er
255247
k8sNamespace := d.Get("k8s_namespace").(string)
256248
k8sSkipSystem := d.Get("k8s_skip_system").(bool)
257249
protectionKey := d.Get("protection_key").(string)
258-
targetName := d.Get("target_name").(string)
259250

260251
body := akeyless_api.NewGatewayUpdateMigration("", "", "", targetLocation)
261252
body.Token = &token
@@ -288,7 +279,6 @@ func resourceGatewayMigrationK8sUpdate(d *schema.ResourceData, m interface{}) er
288279
common.GetAkeylessPtr(&body.K8sNamespace, k8sNamespace)
289280
common.GetAkeylessPtr(&body.K8sSkipSystem, k8sSkipSystem)
290281
common.GetAkeylessPtr(&body.ProtectionKey, protectionKey)
291-
common.GetAkeylessPtr(&body.TargetName, targetName)
292282

293283
_, resp, err := client.GatewayUpdateMigration(ctx).Body(*body).Execute()
294284
if err != nil {

akeyless/resource_mcp_secret_bearer_token.go

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,77 @@ func resourceMcpSecretBearerToken() *schema.Resource {
1919
Importer: &schema.ResourceImporter{
2020
State: resourceMcpSecretImport,
2121
},
22-
Schema: mcpSecretCommonSchema(map[string]*schema.Schema{
22+
Schema: map[string]*schema.Schema{
23+
"name": {
24+
Type: schema.TypeString,
25+
Required: true,
26+
ForceNew: true,
27+
Description: "Secret name",
28+
DiffSuppressFunc: common.DiffSuppressOnLeadingSlash,
29+
},
30+
"url": {
31+
Type: schema.TypeString,
32+
Optional: true,
33+
Description: "URL of the MCP service",
34+
},
2335
"bearer_token": {
2436
Type: schema.TypeString,
2537
Optional: true,
2638
Sensitive: true,
2739
Description: "Bearer token value",
2840
},
29-
}),
41+
"accessibility": {
42+
Type: schema.TypeString,
43+
Optional: true,
44+
Description: "For personal password manager",
45+
Default: "regular",
46+
},
47+
"description": {
48+
Type: schema.TypeString,
49+
Optional: true,
50+
Description: "Description of the object",
51+
},
52+
"protection_key": {
53+
Type: schema.TypeString,
54+
Optional: true,
55+
Computed: true,
56+
Description: "The name of a key that is used to encrypt the secret value (if empty, the account default protectionKey key will be used)",
57+
},
58+
"max_versions": {
59+
Type: schema.TypeString,
60+
Optional: true,
61+
Description: "Set the maximum number of versions, limited by the account settings defaults",
62+
},
63+
"delete_protection": {
64+
Type: schema.TypeString,
65+
Optional: true,
66+
Description: "Protection from accidental deletion of this object [true/false]",
67+
Default: "false",
68+
},
69+
"keep_prev_version": {
70+
Type: schema.TypeString,
71+
Optional: true,
72+
Description: "Whether to keep previous version [true/false]. If not set, use default according to account settings",
73+
},
74+
"tags": {
75+
Type: schema.TypeSet,
76+
Optional: true,
77+
Description: "List of the tags attached to this secret",
78+
Elem: &schema.Schema{Type: schema.TypeString},
79+
},
80+
"input_rule": {
81+
Type: schema.TypeList,
82+
Optional: true,
83+
Description: "Agentic input rule in name=...,rule=... format",
84+
Elem: &schema.Schema{Type: schema.TypeString},
85+
},
86+
"output_rule": {
87+
Type: schema.TypeList,
88+
Optional: true,
89+
Description: "Agentic output rule in name=...,rule=... format",
90+
Elem: &schema.Schema{Type: schema.TypeString},
91+
},
92+
},
3093
}
3194
}
3295

0 commit comments

Comments
 (0)