Skip to content

Commit 1f07c3a

Browse files
authored
Merge pull request #138 from logicmonitor/DEV-241301-ExternalIdFixAWS
AWSExternalIdandCreatedAtFix
2 parents 16e988d + c17cc3a commit 1f07c3a

3 files changed

Lines changed: 42 additions & 9 deletions

File tree

logicmonitor/resources/data_resource_aws_external_id_resource.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ func getAwsExternalId(ctx context.Context, d *schema.ResourceData, m interface{}
4242
}
4343

4444
respModel := resp.GetPayload()
45+
if respModel == nil {
46+
diags = append(diags, diag.Errorf("no AWS external ID returned from API")...)
47+
return diags
48+
}
4549
schemata.SetAwsExternalIDResourceData(d, respModel)
4650
return diags
4751
}

logicmonitor/schemata/aws_external_id_schema.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ func AwsExternalIDSchema() map[string]*schema.Schema {
1111
return map[string]*schema.Schema{
1212
"created_at": {
1313
Type: schema.TypeString,
14-
Optional: true,
14+
Computed: true,
1515
},
1616

1717
"external_id": {
1818
Type: schema.TypeString,
19-
Optional: true,
19+
Computed: true,
2020
},
2121

2222
}
@@ -42,18 +42,12 @@ func SetAwsExternalIDSubResourceData(m []*models.AwsExternalID) (d []*map[string
4242

4343
func AwsExternalIDModel(d map[string]interface{}) *models.AwsExternalID {
4444
// assume that the incoming map only contains the relevant resource data
45-
createdAt := d["created_at"].(string)
46-
externalID := d["external_id"].(string)
4745

4846
return &models.AwsExternalID {
49-
CreatedAt: createdAt,
50-
ExternalID: externalID,
5147
}
5248
}
5349

5450
func GetAwsExternalIDPropertyFields() (t []string) {
5551
return []string{
56-
"created_at",
57-
"external_id",
5852
}
5953
}

models/aws_external_id.go

Lines changed: 36 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)