Skip to content

Commit d6fc468

Browse files
lint - replace deprecated ImportStatePassthrough with ImportStatePassthroughContext
1 parent 4d1c3d7 commit d6fc468

20 files changed

+26
-63
lines changed

codefresh/data_step_types.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ func dataSourceStepTypesRead(d *schema.ResourceData, meta interface{}) error {
7373

7474
}
7575

76-
func mapDataSetTypesToResource(stepTypesVersions cfclient.StepTypesVersions, d *schema.ResourceData) error {
77-
err := d.Set("name", stepTypesVersions.Name)
78-
if err != nil {
79-
return err
80-
}
81-
err = d.Set("version", flattenVersions(stepTypesVersions.Name, stepTypesVersions.Versions))
82-
return err
83-
}
76+
// func mapDataSetTypesToResource(stepTypesVersions cfclient.StepTypesVersions, d *schema.ResourceData) error {
77+
// err := d.Set("name", stepTypesVersions.Name)
78+
// if err != nil {
79+
// return err
80+
// }
81+
// err = d.Set("version", flattenVersions(stepTypesVersions.Name, stepTypesVersions.Versions))
82+
// return err
83+
// }

codefresh/resource_abac_rules.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func resourceGitopsAbacRule() *schema.Resource {
2121
Update: resourceGitopsAbacRuleUpdate,
2222
Delete: resourceGitopsAbacRuleDelete,
2323
Importer: &schema.ResourceImporter{
24-
State: schema.ImportStatePassthrough,
24+
StateContext: schema.ImportStatePassthroughContext,
2525
},
2626
Schema: map[string]*schema.Schema{
2727
"id": {

codefresh/resource_account.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func resourceAccount() *schema.Resource {
1515
Update: resourceAccountUpdate,
1616
Delete: resourceAccountDelete,
1717
Importer: &schema.ResourceImporter{
18-
State: schema.ImportStatePassthrough,
18+
StateContext: schema.ImportStatePassthroughContext,
1919
},
2020
Schema: map[string]*schema.Schema{
2121
"name": {

codefresh/resource_account_admins.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func resourceAccountAdmins() *schema.Resource {
1616
Update: resourceAccountAdminsUpdate,
1717
Delete: resourceAccountAdminsDelete,
1818
Importer: &schema.ResourceImporter{
19-
State: schema.ImportStatePassthrough,
19+
StateContext: schema.ImportStatePassthroughContext,
2020
},
2121
Schema: map[string]*schema.Schema{
2222
"account_id": {

codefresh/resource_account_gitops_settings.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func resourceAccountGitopsSettings() *schema.Resource {
1818
Create: resourceAccountGitopsSettingsUpdate,
1919
Update: resourceAccountGitopsSettingsUpdate,
2020
Importer: &schema.ResourceImporter{
21-
State: schema.ImportStatePassthrough,
21+
StateContext: schema.ImportStatePassthroughContext,
2222
},
2323
// Delete not implemenented as gitops settings cannot be removed, only updated
2424
Delete: resourceAccountGitopsSettingsDelete,

codefresh/resource_account_idp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func resourceAccountIdp() *schema.Resource {
2121
Update: resourceAccountIDPUpdate,
2222
Delete: resourceAccountIDPDelete,
2323
Importer: &schema.ResourceImporter{
24-
State: schema.ImportStatePassthrough,
24+
StateContext: schema.ImportStatePassthroughContext,
2525
},
2626
CustomizeDiff: customdiff.All(
2727
// Recreate idp if the type has changed - we cannot simply do ForceNew on client_type as it is computed

codefresh/resource_account_user_association.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func resourceAccountUserAssociation() *schema.Resource {
1919
Update: resourceAccountUserAssociationUpdate,
2020
Delete: resourceAccountUserAssociationDelete,
2121
Importer: &schema.ResourceImporter{
22-
State: schema.ImportStatePassthrough,
22+
StateContext: schema.ImportStatePassthroughContext,
2323
},
2424
Schema: map[string]*schema.Schema{
2525
"email": {

codefresh/resource_api_key.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func resourceApiKey() *schema.Resource {
2222
Update: resourceApiKeyUpdate,
2323
Delete: resourceApiKeyDelete,
2424
Importer: &schema.ResourceImporter{
25-
State: schema.ImportStatePassthrough,
25+
StateContext: schema.ImportStatePassthroughContext,
2626
},
2727
Schema: map[string]*schema.Schema{
2828
"name": {

codefresh/resource_context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func resourceContext() *schema.Resource {
4848
Update: resourceContextUpdate,
4949
Delete: resourceContextDelete,
5050
Importer: &schema.ResourceImporter{
51-
State: schema.ImportStatePassthrough,
51+
StateContext: schema.ImportStatePassthroughContext,
5252
},
5353
Schema: map[string]*schema.Schema{
5454
"name": {

codefresh/resource_idp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func resourceIdp() *schema.Resource {
2222
Update: resourceIDPUpdate,
2323
Delete: resourceIDPDelete,
2424
Importer: &schema.ResourceImporter{
25-
State: schema.ImportStatePassthrough,
25+
StateContext: schema.ImportStatePassthroughContext,
2626
},
2727
CustomizeDiff: customdiff.All(
2828
// Recreate idp if the type has changed - we cannot simply do ForceNew on client_type as it is computed

codefresh/resource_idp_accounts.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Because of the current Codefresh API limitation it's impossible to remove accoun
1717
Update: resourceIDPAccountsUpdate,
1818
Delete: resourceIDPAccountsDelete,
1919
Importer: &schema.ResourceImporter{
20-
State: schema.ImportStatePassthrough,
20+
StateContext: schema.ImportStatePassthroughContext,
2121
},
2222
Schema: map[string]*schema.Schema{
2323
"idp_id": {

codefresh/resource_permission.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func resourcePermission() *schema.Resource {
2121
Update: resourcePermissionUpdate,
2222
Delete: resourcePermissionDelete,
2323
Importer: &schema.ResourceImporter{
24-
State: schema.ImportStatePassthrough,
24+
StateContext: schema.ImportStatePassthroughContext,
2525
},
2626
Schema: map[string]*schema.Schema{
2727
"_id": {

codefresh/resource_pipeline.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func resourcePipeline() *schema.Resource {
2929
Update: resourcePipelineUpdate,
3030
Delete: resourcePipelineDelete,
3131
Importer: &schema.ResourceImporter{
32-
State: schema.ImportStatePassthrough,
32+
StateContext: schema.ImportStatePassthroughContext,
3333
},
3434
Schema: map[string]*schema.Schema{
3535
"name": {
@@ -1392,13 +1392,6 @@ func getSupportedTerminationPolicyAttributes(policy string) map[string]interface
13921392
return nil
13931393
}
13941394

1395-
func convertOnCreateBranchAttributeToResourceFormat(src string) string {
1396-
var re = regexp.MustCompile(`_[a-z]`)
1397-
return re.ReplaceAllStringFunc(src, func(w string) string {
1398-
return strings.ToUpper(strings.ReplaceAll(w, "_", ""))
1399-
})
1400-
}
1401-
14021395
func convertOnCreateBranchAttributeToPipelineFormat(src string) string {
14031396
var re = regexp.MustCompile(`[A-Z]`)
14041397
return re.ReplaceAllStringFunc(src, func(w string) string {

codefresh/resource_pipeline_test.go

-30
Original file line numberDiff line numberDiff line change
@@ -1486,36 +1486,6 @@ resource "codefresh_pipeline" "test" {
14861486
`, rName, repo, path, revision, context, ignoreTrigger)
14871487
}
14881488

1489-
func testAccCodefreshPipelineOnCreateBranchIgnoreTriggerWithBranchName(rName, repo, path, revision, context, branchName string, ignoreTrigger bool) string {
1490-
return fmt.Sprintf(`
1491-
resource "codefresh_pipeline" "test" {
1492-
1493-
lifecycle {
1494-
ignore_changes = [
1495-
revision
1496-
]
1497-
}
1498-
1499-
name = "%s"
1500-
1501-
spec {
1502-
spec_template {
1503-
repo = %q
1504-
path = %q
1505-
revision = %q
1506-
context = %q
1507-
}
1508-
termination_policy {
1509-
on_create_branch {
1510-
branch_nane = %q
1511-
ignore_trigger = %t
1512-
}
1513-
}
1514-
}
1515-
}
1516-
`, rName, repo, path, revision, context, branchName, ignoreTrigger)
1517-
}
1518-
15191489
func testAccCodefreshPipelineIsPublic(rName, repo, path, revision, context string, isPublic bool) string {
15201490
return fmt.Sprintf(`
15211491
resource "codefresh_pipeline" "test" {

codefresh/resource_project.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You are free to use projects as you see fit. For example, you could create a pro
2323
Update: resourceProjectUpdate,
2424
Delete: resourceProjectDelete,
2525
Importer: &schema.ResourceImporter{
26-
State: schema.ImportStatePassthrough,
26+
StateContext: schema.ImportStatePassthroughContext,
2727
},
2828
Schema: map[string]*schema.Schema{
2929
"name": {

codefresh/resource_registry.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func resourceRegistry() *schema.Resource {
3636
Update: resourceRegistryUpdate,
3737
Delete: resourceRegistryDelete,
3838
Importer: &schema.ResourceImporter{
39-
State: schema.ImportStatePassthrough,
39+
StateContext: schema.ImportStatePassthroughContext,
4040
},
4141
Schema: map[string]*schema.Schema{
4242
"name": {

codefresh/resource_service_account.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func resourceServiceAccount() *schema.Resource {
1616
Update: resourceServiceAccountUpdate,
1717
Delete: resourceServiceAccountDelete,
1818
Importer: &schema.ResourceImporter{
19-
State: schema.ImportStatePassthrough,
19+
StateContext: schema.ImportStatePassthroughContext,
2020
},
2121
Schema: map[string]*schema.Schema{
2222
"name": {

codefresh/resource_step_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The resource allows to handle the life-cycle of the version by allowing specifyi
3030
UpdateContext: resourceStepTypesUpdate,
3131
DeleteContext: resourceStepTypesDelete,
3232
Importer: &schema.ResourceImporter{
33-
State: schema.ImportStatePassthrough,
33+
StateContext: schema.ImportStatePassthroughContext,
3434
},
3535
Schema: map[string]*schema.Schema{
3636
"name": {

codefresh/resource_team.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func resourceTeam() *schema.Resource {
1616
Update: resourceTeamUpdate,
1717
Delete: resourceTeamDelete,
1818
Importer: &schema.ResourceImporter{
19-
State: schema.ImportStatePassthrough,
19+
StateContext: schema.ImportStatePassthroughContext,
2020
},
2121
Schema: map[string]*schema.Schema{
2222
"name": {

codefresh/resource_user.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func resourceUser() *schema.Resource {
1717
Update: resourceUsersUpdate,
1818
Delete: resourceUsersDelete,
1919
Importer: &schema.ResourceImporter{
20-
State: schema.ImportStatePassthrough,
20+
StateContext: schema.ImportStatePassthroughContext,
2121
},
2222
Schema: map[string]*schema.Schema{
2323
"user_name": {

0 commit comments

Comments
 (0)