-
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
azurerm_arc_machine
- support identity
and tags
properties
#27987
Changes from 2 commits
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -48,6 +48,50 @@ func TestAccArcMachineResource_requiresImport(t *testing.T) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
func TestAccArcMachineResource_identity(t *testing.T) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data := acceptance.BuildTestData(t, "azurerm_arc_machine", "test") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
r := ArcMachineResource{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data.ResourceSequentialTest(t, r, []acceptance.TestStep{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Config: r.identity(data), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check: acceptance.ComposeTestCheckFunc( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check.That(data.ResourceName).ExistsInAzure(r), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data.ImportStep(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
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. removed |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
func TestAccArcMachineResource_update(t *testing.T) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data := acceptance.BuildTestData(t, "azurerm_arc_machine", "test") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
r := ArcMachineResource{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data.ResourceSequentialTest(t, r, []acceptance.TestStep{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Config: r.basic(data), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check: acceptance.ComposeTestCheckFunc( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check.That(data.ResourceName).ExistsInAzure(r), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data.ImportStep(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Config: r.complete(data), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check: acceptance.ComposeTestCheckFunc( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check.That(data.ResourceName).ExistsInAzure(r), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data.ImportStep(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Config: r.basic(data), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check: acceptance.ComposeTestCheckFunc( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check.That(data.ResourceName).ExistsInAzure(r), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data.ImportStep(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
func (r ArcMachineResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id, err := machines.ParseMachineID(state.ID) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -92,6 +136,52 @@ resource "azurerm_arc_machine" "import" { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
`, r.basic(data)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
func (r ArcMachineResource) complete(data acceptance.TestData) string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return fmt.Sprintf(` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
%s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
provider "azurerm" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
features {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resource "azurerm_arc_machine" "test" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name = "acctest-hcm-%d" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resource_group_name = azurerm_resource_group.test.name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
location = azurerm_resource_group.test.location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kind = "SCVMM" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
identity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type = "SystemAssigned" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tags = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
foo = "bar" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
`, r.template(data), data.RandomInteger) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
func (r ArcMachineResource) identity(data acceptance.TestData) string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return fmt.Sprintf(` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
%s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
provider "azurerm" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
features {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resource "azurerm_arc_machine" "test" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name = "acctest-hcm-%d" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resource_group_name = azurerm_resource_group.test.name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
location = azurerm_resource_group.test.location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kind = "SCVMM" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
identity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type = "SystemAssigned" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
`, r.template(data), data.RandomInteger) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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. Given only one identity type is available here, we can omit this specific
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. removed |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
func (r ArcMachineResource) template(data acceptance.TestData) string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return fmt.Sprintf(` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resource "azurerm_resource_group" "test" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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.
Minor, but for consistency can we please call this
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.
updated