-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
data.azurerm_api_management
- Support property tenant_access
#19422
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -28,6 +28,18 @@ func TestAccDataSourceApiManagement_basic(t *testing.T) { | |||||||||
}) | ||||||||||
} | ||||||||||
|
||||||||||
func TestAccDataSourceApiManagement_tenantAccess(t *testing.T) { | ||||||||||
data := acceptance.BuildTestData(t, "data.azurerm_api_management", "test") | ||||||||||
r := ApiManagementDataSource{} | ||||||||||
|
||||||||||
data.DataSourceTest(t, []acceptance.TestStep{ | ||||||||||
{ | ||||||||||
Config: r.tenantAccess(data), | ||||||||||
Check: acceptance.ComposeTestCheckFunc(), | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't checking anything, let's check that we have some values here:
Suggested change
we should also update the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for you feedback. For the basic test, In fact the sku name is not consumption should have |
||||||||||
}, | ||||||||||
}) | ||||||||||
} | ||||||||||
|
||||||||||
func TestAccDataSourceApiManagement_identitySystemAssigned(t *testing.T) { | ||||||||||
data := acceptance.BuildTestData(t, "data.azurerm_api_management", "test") | ||||||||||
r := ApiManagementDataSource{} | ||||||||||
|
@@ -89,6 +101,66 @@ func TestAccDataSourceApiManagement_virtualNetwork(t *testing.T) { | |||||||||
}) | ||||||||||
} | ||||||||||
|
||||||||||
func (ApiManagementDataSource) tenantAccess(data acceptance.TestData) string { | ||||||||||
return fmt.Sprintf(` | ||||||||||
provider "azurerm" { | ||||||||||
features {} | ||||||||||
} | ||||||||||
|
||||||||||
resource "azurerm_resource_group" "test" { | ||||||||||
name = "amtestRG-%[1]d" | ||||||||||
location = "%[2]s" | ||||||||||
} | ||||||||||
|
||||||||||
resource "azurerm_api_management" "test" { | ||||||||||
name = "acctestAM-%[1]d" | ||||||||||
location = azurerm_resource_group.test.location | ||||||||||
resource_group_name = azurerm_resource_group.test.name | ||||||||||
publisher_name = "pub1" | ||||||||||
publisher_email = "[email protected]" | ||||||||||
|
||||||||||
sku_name = "Developer_1" | ||||||||||
} | ||||||||||
|
||||||||||
resource "azurerm_api_management_product" "test" { | ||||||||||
product_id = "test-product" | ||||||||||
api_management_name = azurerm_api_management.test.name | ||||||||||
resource_group_name = azurerm_resource_group.test.name | ||||||||||
display_name = "Test Product" | ||||||||||
subscription_required = true | ||||||||||
approval_required = false | ||||||||||
published = true | ||||||||||
} | ||||||||||
|
||||||||||
resource "azurerm_api_management_user" "test" { | ||||||||||
user_id = "acctestuser%[1]d" | ||||||||||
api_management_name = azurerm_api_management.test.name | ||||||||||
resource_group_name = azurerm_resource_group.test.name | ||||||||||
first_name = "Acceptance" | ||||||||||
last_name = "Test" | ||||||||||
email = "azure-acctest%[1][email protected]" | ||||||||||
} | ||||||||||
|
||||||||||
data "azurerm_api_management" "test" { | ||||||||||
name = azurerm_api_management.test.name | ||||||||||
resource_group_name = azurerm_api_management.test.resource_group_name | ||||||||||
} | ||||||||||
|
||||||||||
resource "azurerm_api_management_subscription" "test" { | ||||||||||
subscription_id = "This-Is-A-Valid-Subscription-ID" | ||||||||||
resource_group_name = azurerm_api_management.test.resource_group_name | ||||||||||
api_management_name = azurerm_api_management.test.name | ||||||||||
user_id = azurerm_api_management_user.test.id | ||||||||||
product_id = azurerm_api_management_product.test.id | ||||||||||
display_name = "Butter Parser API Enterprise Edition" | ||||||||||
state = "active" | ||||||||||
allow_tracing = false | ||||||||||
primary_key = data.azurerm_api_management.test.tenant_access[0].primary_key | ||||||||||
secondary_key = data.azurerm_api_management.test.tenant_access[0].secondary_key | ||||||||||
} | ||||||||||
`, data.RandomInteger, data.Locations.Primary) | ||||||||||
} | ||||||||||
|
||||||||||
func (ApiManagementDataSource) basic(data acceptance.TestData) string { | ||||||||||
return fmt.Sprintf(` | ||||||||||
provider "azurerm" { | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -69,6 +69,8 @@ output "api_management_id" { | |||||
|
||||||
* `sku` - A `sku` block as documented below. | ||||||
|
||||||
* `tenant_access` - A `tenant_access` block as defined below. | ||||||
|
||||||
* `tags` - A mapping of tags assigned to the resource. | ||||||
|
||||||
--- | ||||||
|
@@ -177,6 +179,18 @@ A `sku` block exports the following: | |||||
|
||||||
--- | ||||||
|
||||||
A `tenant_access` block supports the following: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is read-only:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for you feedback. Fixed. |
||||||
|
||||||
* `enabled` - Should the access to the management API be enabled? | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is read-only:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for you feedback. Fixed. |
||||||
|
||||||
* `tenant_id` - The identifier for the tenant access information contract. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. presumably:
Suggested change
? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for you feedback. Fixed. |
||||||
|
||||||
* `primary_key` - Primary access key for the tenant access information contract. | ||||||
|
||||||
* `secondary_key` - Secondary access key for the tenant access information contract. | ||||||
|
||||||
--- | ||||||
|
||||||
## Timeouts | ||||||
|
||||||
The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to ensure the
tenant_access
block is always set into the state:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for you feedback. Fixed.