Skip to content

Commit c1308aa

Browse files
committed
comments addressed
1 parent f2045f6 commit c1308aa

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tfe/resource_tfe_project_policy_set.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func resourceTFEProjectPolicySetCreate(d *schema.ResourceData, meta interface{})
5151
err := config.Client.PolicySets.AddProjects(ctx, policySetID, policySetAddProjectsOptions)
5252
if err != nil {
5353
return fmt.Errorf(
54-
"Error attaching policy set id %s to project %s: %w", policySetID, projectID, err)
54+
"error attaching policy set id %s to project %s: %w", policySetID, projectID, err)
5555
}
5656

5757
d.SetId(fmt.Sprintf("%s_%s", projectID, policySetID))
@@ -75,7 +75,7 @@ func resourceTFEProjectPolicySetRead(d *schema.ResourceData, meta interface{}) e
7575
d.SetId("")
7676
return nil
7777
}
78-
return fmt.Errorf("Error reading configuration of policy set %s: %w", policySetID, err)
78+
return fmt.Errorf("error reading configuration of policy set %s: %w", policySetID, err)
7979
}
8080

8181
isProjectAttached := false
@@ -110,7 +110,7 @@ func resourceTFEProjectPolicySetDelete(d *schema.ResourceData, meta interface{})
110110
err := config.Client.PolicySets.RemoveProjects(ctx, policySetID, policySetRemoveProjectsOptions)
111111
if err != nil {
112112
return fmt.Errorf(
113-
"Error detaching project %s from policy set %s: %w", projectID, policySetID, err)
113+
"error detaching project %s from policy set %s: %w", projectID, policySetID, err)
114114
}
115115

116116
return nil
@@ -126,7 +126,7 @@ func resourceTFEProjectPolicySetImporter(ctx context.Context, d *schema.Resource
126126
)
127127
}
128128

129-
organization, projectID, pSName := splitID[0], splitID[1], splitID[2]
129+
organization, projectID, policySetName := splitID[0], splitID[1], splitID[2]
130130

131131
config := meta.(ConfiguredClient)
132132

@@ -140,21 +140,21 @@ func resourceTFEProjectPolicySetImporter(ctx context.Context, d *schema.Resource
140140
for {
141141
list, err := config.Client.PolicySets.List(ctx, organization, options)
142142
if err != nil {
143-
return nil, fmt.Errorf("Error retrieving policy sets: %w", err)
143+
return nil, fmt.Errorf("error retrieving organization's list of policy sets: %w", err)
144144
}
145145
for _, policySet := range list.Items {
146-
if policySet.Name != pSName {
146+
if policySet.Name != policySetName {
147147
continue
148148
}
149149

150-
for _, pj := range policySet.Projects {
151-
if pj.ID != projectID {
150+
for _, project := range policySet.Projects {
151+
if project.ID != projectID {
152152
continue
153153
}
154154

155-
d.Set("project_id", pj.ID)
155+
d.Set("project_id", project.ID)
156156
d.Set("policy_set_id", policySet.ID)
157-
d.SetId(fmt.Sprintf("%s_%s", pj.ID, policySet.ID))
157+
d.SetId(fmt.Sprintf("%s_%s", project.ID, policySet.ID))
158158

159159
return []*schema.ResourceData{d}, nil
160160
}
@@ -169,5 +169,5 @@ func resourceTFEProjectPolicySetImporter(ctx context.Context, d *schema.Resource
169169
options.PageNumber = list.NextPage
170170
}
171171

172-
return nil, fmt.Errorf("project %s has not been assigned to policy set %s", projectID, pSName)
172+
return nil, fmt.Errorf("project %s has not been assigned to policy set %s", projectID, policySetName)
173173
}

0 commit comments

Comments
 (0)