Skip to content

Commit

Permalink
Warning message review
Browse files Browse the repository at this point in the history
Signed-off-by: Deepa Kumaraswamy <[email protected]>
  • Loading branch information
dkumaras committed Mar 31, 2022
1 parent 75162f6 commit cb476c3
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 77 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This InSpec resource pack uses the Azure REST API and provides the required reso

### Service Principal

Your Azure Service Principal Account must have a minimum of `reader` role of the [Azure roles](https://docs.microsoft.com/en-us/azure/role-based-access-control/rbac-and-directory-admin-roles#azure-roles) to any subscription that you'd like to use this resource pack against.
Your Azure Service Principal Account must have a minimum of `reader` role of the [Azure roles](https://docs.microsoft.com/en-us/azure/role-based-access-control/rbac-and-directory-admin-roles#azure-roles) to any subscription that you'd like to use this resource pack against.

You should have the following pieces of information:

Expand Down Expand Up @@ -110,14 +110,14 @@ The following is a list of generic resources.
- [azure_generic_resources](docs/resources/azure_generic_resources.md)
- [azure_graph_generic_resource](docs/resources/azure_graph_generic_resource.md)
- [azure_graph_generic_resources](docs/resources/azure_graph_generic_resources.md)
With the generic resources:
- Azure cloud resources that this resource pack does not include a static InSpec resource for can be tested.
- Azure resources from different resource providers and resource groups can be tested at the same time.
- Server side filtering can be used for more efficient tests.
The following is a list of static resources.
The following is a list of static resources.
- [azure_active_directory_domain_service](docs/resources/azure_active_directory_domain_service.md)
- [azure_active_directory_domain_services](docs/resources/azure_active_directory_domain_services.md)
Expand Down Expand Up @@ -276,7 +276,7 @@ azure_generic_resources(substring_of_name: 'project_A').ids.each do |id|
its('location') { should eq 'eastus' }
end
end
```
```

### Interrogate All Resources that Have a Tag Defined with the Name `project_A` Regardless of its Value

Expand All @@ -286,7 +286,7 @@ azure_generic_resources(tag_name: 'project_A').ids.each do |id|
its('location') { should eq 'eastus' }
end
end
```
```

### Verify Properties of an Azure Virtual Machine

Expand All @@ -313,11 +313,11 @@ describe azure_network_security_group(resource_group: 'ProductionResourceGroup',
it { should_not allow_rdp_from_internet }
it { should_not allow_ssh_from_internet }
it { should allow(source_ip_range: '0.0.0.0', destination_port: '22', direction: 'inbound') }
it { should allow_in(service_tag: 'Internet', port: %w{1433-1434 1521 4300-4350 5000-6000}) }
it { should allow_in(service_tag: 'Internet', port: %w{1433-1434 1521 4300-4350 5000-6000}) }
end
```

## Parameters Applicable To All Resources
## Parameters Applicable To All Resources

The generic resources and their derivations support following parameters unless stated otherwise in their specific resource page.

Expand Down Expand Up @@ -400,14 +400,15 @@ The behavior of the http client can be defined with the following parameters:

They can be defined as environment variables or resource parameters (has priority).

<hr>
{{< warning >}}

The `azurerm_` resources are removed from the inspec-azure version 2. It is highly recommended to use resources with the `azure_` prefix for a reliable testing experience.

> <b>WARNING</b> The `azurerm_` resources are removed completely from inspec-azure V2.
> It is mandatory to use resources only with `azure_` prefix for an up-to-date testing experience.
{{< /warning >}}

## Development

If you'd like to contribute to this project please see [Contributing Rules](CONTRIBUTING.md).
If you'd like to contribute to this project please see [Contributing Rules](CONTRIBUTING.md).

For a detailed walk-through of resource creation, see the [Resource Creation Guide](dev-docs/resource_creation_guide.md).

Expand All @@ -419,10 +420,10 @@ The easiest way to start is checking the existing static resources. They have de

The common parameters are:

- `resource_provider`: Such as `Microsoft.Compute/virtualMachines`. It has to be hardcoded in the code by the resource author via the `specific_resource_constraint` method, and it should be the first parameter defined in the resource. This method includes user-supplied input validation.
- `resource_provider`: Such as `Microsoft.Compute/virtualMachines`. It has to be hardcoded in the code by the resource author via the `specific_resource_constraint` method, and it should be the first parameter defined in the resource. This method includes user-supplied input validation.
- `display_name`: A generic one will be created unless defined.
- `required_parameters`: Define mandatory parameters. The `resource_group` and resource `name` in the singular resources are default mandatory in the base class.
- `allowed_parameters`: Define optional parameters. The `resource_group` is optional in plural resources, but this can be made mandatory in the static resource.
- `allowed_parameters`: Define optional parameters. The `resource_group` is optional in plural resources, but this can be made mandatory in the static resource.
- `resource_uri`: Azure REST API URI of a resource. This parameter should be used when a resource does not reside in a resource group. It requires `add_subscription_id` to be set to either `true` or `false`. See [azure_policy_definition](libraries/azure_policy_definition.rb) and [azure_policy_definitions](libraries/azure_policy_definitions.rb).
- `add_subscription_id`: It indicates whether the subscription ID should be included in the `resource_uri` or not.

Expand All @@ -433,7 +434,7 @@ The singular resource is used to test a specific resource of a specific type and
- In most cases `resource_group` and resource `name` should be required from the users and a single API call would be enough for creating methods on the resource. See [azure_virtual_machine](libraries/azure_virtual_machine.rb) for a standard singular resource and how to create static methods from resource properties.
- If it is beneficial to accept the resource name with a more specific keyword, such as `server_name`, see [azure_mysql_server](libraries/azure_mysql_server.rb).
- If a resource exists in another resource, such as a subnet on a virtual network, see [azure_subnet](libraries/azure_subnet.rb).
- If it is necessary to make an additional API call within a static method, the `create_additional_properties` should be used. See [azure_key_vault](libraries/azure_key_vault.rb).
- If it is necessary to make an additional API call within a static method, the `create_additional_properties` should be used. See [azure_key_vault](libraries/azure_key_vault.rb).

#### Plural Resources

Expand Down
Loading

0 comments on commit cb476c3

Please sign in to comment.