Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New data source azurerm_communication_service #22426

Merged
merged 2 commits into from
Jul 12, 2023

Conversation

myc2h6o
Copy link
Contributor

@myc2h6o myc2h6o commented Jul 8, 2023

Close #21736

@myc2h6o myc2h6o force-pushed the communication_service_data branch from dc53f7a to 58f3374 Compare July 8, 2023 07:00
@myc2h6o
Copy link
Contributor Author

myc2h6o commented Jul 8, 2023

test result
image

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @myc2h6o

Thanks for this PR - I've taken a look through and left some comments inline, but if we can fix those up then this should otherwise be good to go 👍

Thanks!


keysResp, err := client.ListKeys(ctx, id)
if err != nil {
return fmt.Errorf("listing keys for %s: %+v", id, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data sources should gracefully handle having limited permissions, so we shouldn't raise this error when there's a permissions error (presumably a 401?)

Comment on lines 124 to 138
if model.PrimaryConnectionString != nil {
state.PrimaryConnectionString = *model.PrimaryConnectionString
}

if model.PrimaryKey != nil {
state.PrimaryKey = *model.PrimaryKey
}

if model.SecondaryConnectionString != nil {
state.SecondaryConnectionString = *model.SecondaryConnectionString
}

if model.SecondaryKey != nil {
state.SecondaryKey = *model.SecondaryKey
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW we can reduce this to:

Suggested change
if model.PrimaryConnectionString != nil {
state.PrimaryConnectionString = *model.PrimaryConnectionString
}
if model.PrimaryKey != nil {
state.PrimaryKey = *model.PrimaryKey
}
if model.SecondaryConnectionString != nil {
state.SecondaryConnectionString = *model.SecondaryConnectionString
}
if model.SecondaryKey != nil {
state.SecondaryKey = *model.SecondaryKey
}
state.PrimaryConnectionString = pointer.From(model.PrimaryConnectionString)
state.PrimaryKey = pointer.From(model.PrimaryKey)
state.SecondaryConnectionString = pointer.From(model.SecondaryConnectionString)
state.SecondaryKey = pointer.From(model.SecondaryKey)

@myc2h6o
Copy link
Contributor Author

myc2h6o commented Jul 10, 2023

@tombuildsstuff thanks for reviewing! I've updated the code to use pointer.From, and used a warning message to replace the error. Please take a look.

@myc2h6o
Copy link
Contributor Author

myc2h6o commented Jul 10, 2023

updated test result
image

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for pushing those changes @myc2h6o

@tombuildsstuff tombuildsstuff added this to the v3.65.0 milestone Jul 12, 2023
@tombuildsstuff tombuildsstuff merged commit 3d733a6 into hashicorp:main Jul 12, 2023
@myc2h6o myc2h6o deleted the communication_service_data branch July 12, 2023 08:36
tombuildsstuff added a commit that referenced this pull request Jul 12, 2023
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for azurerm_communication_services data object
2 participants